From 1c3e52fc022b6233eef769fa5f5c372e9411dfa3 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 07:22:35 -0500 Subject: [PATCH 01/20] refactor: consolidate grid arrays into type(grid_axis) :: x, y, z Replace flat allocatable arrays x_cb/y_cb/z_cb, x_cc/y_cc/z_cc, and dx/dy/dz with a derived type having .cb, .cc, and .spacing components. All three executables (pre_process, simulation, post_process) updated across 47 files. Key design decisions: - pre_process keeps scalar dx/dy/dz as minimum cell-width scalars; only x_cb and x_cc are folded into x%cb and x%cc - OpenMP GPU target uses whole-struct declare target (x, y, z) since component-level declare target is invalid; OpenACC uses component-level - 2dHardcodedIC.fpp wraps dx*dy in #ifdef MFC_PRE_PROCESS for the scalar vs per-cell context difference Special variable collisions fixed: - m_chemistry.fpp: local integer x/y/z -> cx/cy/cz - m_weno.fpp: local real y(1:4) scratch -> ys - m_viscous.fpp: local real dx(1:3) scratch -> ds - m_ibm.fpp: local scalar dx/dy/dz -> dx_loc/dy_loc/dz_loc - m_cbc.fpp: Fypp template d${XYZ}$ -> ${XYZ}$%spacing --- src/common/include/1dHardcodedIC.fpp | 20 +- src/common/include/2dHardcodedIC.fpp | 130 ++-- src/common/include/3dHardcodedIC.fpp | 28 +- src/common/include/ExtrusionHardcodedIC.fpp | 12 +- src/common/m_boundary_common.fpp | 64 +- src/common/m_chemistry.fpp | 123 +-- src/common/m_derived_types.fpp | 5 + src/common/m_model.fpp | 10 +- src/common/m_mpi_common.fpp | 48 +- src/post_process/m_data_input.f90 | 24 +- src/post_process/m_data_output.fpp | 60 +- src/post_process/m_derived_variables.fpp | 20 +- src/post_process/m_global_parameters.fpp | 39 +- src/post_process/m_mpi_proxy.fpp | 42 +- src/post_process/m_start_up.fpp | 6 +- src/pre_process/m_assign_variables.fpp | 22 +- src/pre_process/m_boundary_conditions.fpp | 22 +- src/pre_process/m_data_output.fpp | 48 +- src/pre_process/m_global_parameters.fpp | 22 +- src/pre_process/m_grid.f90 | 64 +- src/pre_process/m_icpp_patches.fpp | 141 ++-- src/pre_process/m_perturbation.fpp | 18 +- src/pre_process/m_start_up.fpp | 72 +- src/simulation/m_acoustic_src.fpp | 15 +- src/simulation/m_bubbles_EE.fpp | 10 +- src/simulation/m_bubbles_EL.fpp | 108 +-- src/simulation/m_bubbles_EL_kernels.fpp | 36 +- src/simulation/m_cbc.fpp | 52 +- src/simulation/m_collisions.fpp | 8 +- src/simulation/m_compute_levelset.fpp | 26 +- src/simulation/m_data_output.fpp | 74 +- src/simulation/m_derived_variables.fpp | 32 +- src/simulation/m_global_parameters.fpp | 62 +- src/simulation/m_hyperelastic.fpp | 6 +- src/simulation/m_hypoelastic.fpp | 20 +- src/simulation/m_ib_patches.fpp | 90 +-- src/simulation/m_ibm.fpp | 109 +-- src/simulation/m_igr.fpp | 810 ++++++++++---------- src/simulation/m_qbmm.fpp | 75 +- src/simulation/m_rhs.fpp | 109 +-- src/simulation/m_riemann_solvers.fpp | 14 +- src/simulation/m_sim_helpers.fpp | 42 +- src/simulation/m_start_up.fpp | 46 +- src/simulation/m_surface_tension.fpp | 6 +- src/simulation/m_thinc.fpp | 8 +- src/simulation/m_viscous.fpp | 76 +- src/simulation/m_weno.fpp | 740 +++++++++--------- 47 files changed, 1831 insertions(+), 1783 deletions(-) diff --git a/src/common/include/1dHardcodedIC.fpp b/src/common/include/1dHardcodedIC.fpp index bcb44edd0b..e812d9ea4a 100644 --- a/src/common/include/1dHardcodedIC.fpp +++ b/src/common/include/1dHardcodedIC.fpp @@ -7,12 +7,12 @@ select case (patch_icpp(patch_id)%hcid) case (150) ! 1D Smooth Alfven Case for MHD ! velocity - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, 0, 0) = 0.1_wp*sin(2._wp*pi*x_cc(i)) - q_prim_vf(eqn_idx%mom%beg + 2)%sf(i, 0, 0) = 0.1_wp*cos(2._wp*pi*x_cc(i)) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, 0, 0) = 0.1_wp*sin(2._wp*pi*x%cc(i)) + q_prim_vf(eqn_idx%mom%beg + 2)%sf(i, 0, 0) = 0.1_wp*cos(2._wp*pi*x%cc(i)) ! magnetic field - q_prim_vf(eqn_idx%B%end - 1)%sf(i, 0, 0) = 0.1_wp*sin(2._wp*pi*x_cc(i)) - q_prim_vf(eqn_idx%B%end)%sf(i, 0, 0) = 0.1_wp*cos(2._wp*pi*x_cc(i)) + q_prim_vf(eqn_idx%B%end - 1)%sf(i, 0, 0) = 0.1_wp*sin(2._wp*pi*x%cc(i)) + q_prim_vf(eqn_idx%B%end)%sf(i, 0, 0) = 0.1_wp*cos(2._wp*pi*x%cc(i)) case (170) ! 1D profile from external data (e.g. Cantera, SDtoolbox) ! This hardcoded case can be used to start a simulation with initial conditions given from a known 1D profile (e.g. Cantera, ! SDtoolbox) @@ -21,17 +21,17 @@ ! This is patch is hard-coded for test suite optimization used in the 1D_shuoser cases: "patch_icpp(2)%alpha_rho(1)": "1 + ! 0.2*sin(5*x)" if (patch_id == 2) then - q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, 0, 0) = 1 + 0.2*sin(5*x_cc(i)) + q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, 0, 0) = 1 + 0.2*sin(5*x%cc(i)) end if case (181) ! Titarev-Torro problem ! This is patch is hard-coded for test suite optimization used in the 1D_titarevtorro cases: "patch_icpp(2)%alpha_rho(1)": ! "1 + 0.1*sin(20*x*pi)" - q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, 0, 0) = 1 + 0.1*sin(20*x_cc(i)*pi) + q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, 0, 0) = 1 + 0.1*sin(20*x%cc(i)*pi) case (182) ! Multi-component diffusion ! This patch is a hard-coded for test suite optimization (multiple component diffusion) x_mid_diffu = 0.05_wp/2.0_wp width_sq = (2.5_wp*10.0_wp**(-3.0_wp))**2 - profile_shape = 1.0_wp - 0.5_wp*exp(-(x_cc(i) - x_mid_diffu)**2/width_sq) + profile_shape = 1.0_wp - 0.5_wp*exp(-(x%cc(i) - x_mid_diffu)**2/width_sq) q_prim_vf(eqn_idx%mom%beg)%sf(i, 0, 0) = 0.0_wp q_prim_vf(eqn_idx%E)%sf(i, 0, 0) = 1.01325_wp*(10.0_wp)**5 q_prim_vf(eqn_idx%adv%beg)%sf(i, 0, 0) = 1.0_wp @@ -58,10 +58,10 @@ q_prim_vf(eqn_idx%mom%beg)%sf(i, 0, 0) = 0.0_wp q_prim_vf(eqn_idx%species%beg)%sf(i, 0, 0) = 1.0_wp - if (x_cc(i) <= 0.025_wp) then - temp = 700.0_wp + ((1000.0_wp - 700.0_wp)/0.025_wp)*x_cc(i) + if (x%cc(i) <= 0.025_wp) then + temp = 700.0_wp + ((1000.0_wp - 700.0_wp)/0.025_wp)*x%cc(i) else - temp = 1200.0_wp + ((900.0_wp - 1000.0_wp)/0.025_wp)*(x_cc(i) - 0.025_wp) + temp = 1200.0_wp + ((900.0_wp - 1000.0_wp)/0.025_wp)*(x%cc(i) - 0.025_wp) end if molar_mass_inv = 1.0_wp/2.01588_wp diff --git a/src/common/include/2dHardcodedIC.fpp b/src/common/include/2dHardcodedIC.fpp index d6c3fed97f..0f9a33c33b 100644 --- a/src/common/include/2dHardcodedIC.fpp +++ b/src/common/include/2dHardcodedIC.fpp @@ -33,7 +33,7 @@ #:def Hardcoded2D() select case (patch_icpp(patch_id)%hcid) ! 2D_hardcoded_ic example case case (200) ! Two-fluid cubic interface - if (y_cc(j) <= (-x_cc(i)**3 + 1)**(1._wp/3._wp)) then + if (y%cc(j) <= (-x%cc(i)**3 + 1)**(1._wp/3._wp)) then ! Volume Fractions q_prim_vf(eqn_idx%adv%beg)%sf(i, j, 0) = eps q_prim_vf(eqn_idx%adv%end)%sf(i, j, 0) = 1._wp - eps @@ -42,7 +42,7 @@ q_prim_vf(eqn_idx%E)%sf(i, j, 0) = 1000._wp end if case (202) ! Gresho vortex (Gouasmi et al 2022 JCP) - r = ((x_cc(i) - 0.5_wp)**2 + (y_cc(j) - 0.5_wp)**2)**0.5_wp + r = ((x%cc(i) - 0.5_wp)**2 + (y%cc(j) - 0.5_wp)**2)**0.5_wp rmax = 0.2_wp gam = 1._wp + 1._wp/fluid_pp(1)%gamma @@ -50,12 +50,12 @@ p0 = umax**2*(1._wp/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5_wp) if (r < rmax) then - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(y_cc(j) - 0.5_wp)*umax/rmax - q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = (x_cc(i) - 0.5_wp)*umax/rmax + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(y%cc(j) - 0.5_wp)*umax/rmax + q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = (x%cc(i) - 0.5_wp)*umax/rmax q_prim_vf(eqn_idx%E)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2._wp/2._wp) else if (r < 2*rmax) then - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -((y_cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) - q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = ((x_cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -((y%cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = ((x%cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) q_prim_vf(eqn_idx%E)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp + 4*(1 - (r/rmax) + log(r/rmax))) else q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = 0._wp @@ -63,7 +63,7 @@ q_prim_vf(eqn_idx%E)%sf(i, j, 0) = p0 + umax**2*(-2 + 4*log(2._wp)) end if case (203) ! Gresho vortex (Gouasmi et al 2022 JCP) with density correction - r = ((x_cc(i) - 0.5_wp)**2._wp + (y_cc(j) - 0.5_wp)**2)**0.5_wp + r = ((x%cc(i) - 0.5_wp)**2._wp + (y%cc(j) - 0.5_wp)**2)**0.5_wp rmax = 0.2_wp gam = 1._wp + 1._wp/fluid_pp(1)%gamma @@ -71,12 +71,12 @@ p0 = umax**2*(1._wp/(gam*patch_icpp(patch_id)%vel(2)**2) - 0.5_wp) if (r < rmax) then - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(y_cc(j) - 0.5_wp)*umax/rmax - q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = (x_cc(i) - 0.5_wp)*umax/rmax + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(y%cc(j) - 0.5_wp)*umax/rmax + q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = (x%cc(i) - 0.5_wp)*umax/rmax q_prim_vf(eqn_idx%E)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2._wp/2._wp) else if (r < 2*rmax) then - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -((y_cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) - q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = ((x_cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -((y%cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax) + q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = ((x%cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax) q_prim_vf(eqn_idx%E)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp + 4._wp*(1._wp - (r/rmax) + log(r/rmax))) else q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = 0._wp @@ -95,35 +95,35 @@ wl = 2._wp*pi/lam amp = 0.05_wp/wl - intH = amp*sin(2._wp*pi*x_cc(i)/lam - pi/2._wp) + h + intH = amp*sin(2._wp*pi*x%cc(i)/lam - pi/2._wp) + h - alph = 0.5_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp)) + alph = 0.5_wp*(1._wp + tanh((y%cc(j) - intH)/2.5e-3_wp)) if (alph < eps) alph = eps if (alph > 1._wp - eps) alph = 1._wp - eps - if (y_cc(j) > intH) then + if (y%cc(j) > intH) then q_prim_vf(eqn_idx%adv%beg)%sf(i, j, 0) = alph q_prim_vf(eqn_idx%adv%end)%sf(i, j, 0) = 1._wp - alph q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = alph*rhoH q_prim_vf(eqn_idx%cont%end)%sf(i, j, 0) = (1._wp - alph)*rhoL - q_prim_vf(eqn_idx%E)%sf(i, j, 0) = pref + rhoH*9.81_wp*(1.2_wp - y_cc(j)) + q_prim_vf(eqn_idx%E)%sf(i, j, 0) = pref + rhoH*9.81_wp*(1.2_wp - y%cc(j)) else q_prim_vf(eqn_idx%adv%beg)%sf(i, j, 0) = alph q_prim_vf(eqn_idx%adv%end)%sf(i, j, 0) = 1._wp - alph q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = alph*rhoH q_prim_vf(eqn_idx%cont%end)%sf(i, j, 0) = (1._wp - alph)*rhoL pInt = pref + rhoH*9.81_wp*(1.2_wp - intH) - q_prim_vf(eqn_idx%E)%sf(i, j, 0) = pInt + rhoL*9.81_wp*(intH - y_cc(j)) + q_prim_vf(eqn_idx%E)%sf(i, j, 0) = pInt + rhoL*9.81_wp*(intH - y%cc(j)) end if case (205) ! 2D lung wave interaction problem h = 0.0_wp ! non dim origin y lam = 1.0_wp ! non dim lambda amp = patch_icpp(patch_id)%a(2) ! to be changed later! !non dim amplitude - intH = amp*sin(2*pi*x_cc(i)/lam - pi/2) + h + intH = amp*sin(2*pi*x%cc(i)/lam - pi/2) + h - if (y_cc(j) > intH) then + if (y%cc(j) > intH) then q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = patch_icpp(1)%alpha_rho(1) q_prim_vf(eqn_idx%cont%end)%sf(i, j, 0) = patch_icpp(1)%alpha_rho(2) q_prim_vf(eqn_idx%E)%sf(i, j, 0) = patch_icpp(1)%pres @@ -135,9 +135,9 @@ lam = 1.0_wp ! non dim lambda amp = patch_icpp(patch_id)%a(2) - intL = amp*sin(2*pi*y_cc(j)/lam - pi/2) + h + intL = amp*sin(2*pi*y%cc(j)/lam - pi/2) + h - if (x_cc(i) > intL) then ! this is the liquid + if (x%cc(i) > intL) then ! this is the liquid q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = patch_icpp(1)%alpha_rho(1) q_prim_vf(eqn_idx%cont%end)%sf(i, j, 0) = patch_icpp(1)%alpha_rho(2) q_prim_vf(eqn_idx%E)%sf(i, j, 0) = patch_icpp(1)%pres @@ -146,17 +146,21 @@ end if case (207) ! Kelvin Helmholtz Instability sigma = 0.05_wp/sqrt(2.0_wp) - gauss1 = exp(-(y_cc(j) - 0.75_wp)**2/(2.0_wp*sigma**2)) - gauss2 = exp(-(y_cc(j) - 0.25_wp)**2/(2.0_wp*sigma**2)) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 0.1_wp*sin(4.0_wp*pi*x_cc(i))*(gauss1 + gauss2) + gauss1 = exp(-(y%cc(j) - 0.75_wp)**2/(2.0_wp*sigma**2)) + gauss2 = exp(-(y%cc(j) - 0.25_wp)**2/(2.0_wp*sigma**2)) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 0.1_wp*sin(4.0_wp*pi*x%cc(i))*(gauss1 + gauss2) case (208) ! Richtmeyer Meshkov Instability lam = 1.0_wp eps = 1.0e-6_wp ei = 5.0_wp ! Smoothening function to smooth out sharp discontinuity in the interface - if (x_cc(i) <= 0.7_wp*lam) then - d = x_cc(i) - lam*(0.4_wp - 0.1_wp*sin(2.0_wp*pi*(y_cc(j)/lam + 0.25_wp))) + if (x%cc(i) <= 0.7_wp*lam) then + d = x%cc(i) - lam*(0.4_wp - 0.1_wp*sin(2.0_wp*pi*(y%cc(j)/lam + 0.25_wp))) +#ifdef MFC_PRE_PROCESS fsm = 0.5_wp*(1.0_wp + erf(d/(ei*sqrt(dx*dy)))) +#else + fsm = 0.5_wp*(1.0_wp + erf(d/(ei*sqrt(x%spacing(i)*y%spacing(j))))) +#endif alpha_air = eps + (1.0_wp - 2.0_wp*eps)*fsm alpha_sf6 = 1.0_wp - alpha_air q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = alpha_sf6*5.04_wp @@ -168,18 +172,18 @@ ! gamma = 5/3 rho = 25/(36*pi) p = 5/(12*pi) v = (-sin(2*pi*y), sin(2*pi*x), 0) B = (-sin(2*pi*y)/sqrt(4*pi), ! sin(4*pi*x)/sqrt(4*pi), 0) - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -sin(2._wp*pi*y_cc(j)) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = sin(2._wp*pi*x_cc(i)) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -sin(2._wp*pi*y%cc(j)) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = sin(2._wp*pi*x%cc(i)) - q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = -sin(2._wp*pi*y_cc(j))/sqrt(4._wp*pi) - q_prim_vf(eqn_idx%B%beg + 1)%sf(i, j, 0) = sin(4._wp*pi*x_cc(i))/sqrt(4._wp*pi) + q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = -sin(2._wp*pi*y%cc(j))/sqrt(4._wp*pi) + q_prim_vf(eqn_idx%B%beg + 1)%sf(i, j, 0) = sin(4._wp*pi*x%cc(i))/sqrt(4._wp*pi) case (251) ! RMHD Cylindrical Blast Wave [Mignone, 2006: Section 4.3.1] - if (x_cc(i)**2 + y_cc(j)**2 < 0.08_wp**2) then + if (x%cc(i)**2 + y%cc(j)**2 < 0.08_wp**2) then q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = 0.01 q_prim_vf(eqn_idx%E)%sf(i, j, 0) = 1.0 - else if (x_cc(i)**2 + y_cc(j)**2 <= 1._wp**2) then + else if (x%cc(i)**2 + y%cc(j)**2 <= 1._wp**2) then ! Linear interpolation between r=0.08 and r=1.0 - factor = (1.0_wp - sqrt(x_cc(i)**2 + y_cc(j)**2))/(1.0_wp - 0.08_wp) + factor = (1.0_wp - sqrt(x%cc(i)**2 + y%cc(j)**2))/(1.0_wp - 0.08_wp) q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = 0.01_wp*factor + 1.e-4_wp*(1.0_wp - factor) q_prim_vf(eqn_idx%E)%sf(i, j, 0) = 1.0_wp*factor + 3.e-5_wp*(1.0_wp - factor) else @@ -195,7 +199,7 @@ ! velocity w=20, giving v_tan=2 at r=0.1 ! Calculate distance squared from the center - r_sq = (x_cc(i) - 0.5_wp)**2 + (y_cc(j) - 0.5_wp)**2 + r_sq = (x%cc(i) - 0.5_wp)**2 + (y%cc(j) - 0.5_wp)**2 ! inner radius of 0.1 if (r_sq <= 0.1**2) then @@ -203,32 +207,32 @@ q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = 10._wp ! Set vup constant rotation of rate v=2 v_x = -omega * (y - y_c) v_y = omega * (x - x_c) - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -20._wp*(y_cc(j) - 0.5_wp) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 20._wp*(x_cc(i) - 0.5_wp) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -20._wp*(y%cc(j) - 0.5_wp) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 20._wp*(x%cc(i) - 0.5_wp) ! taper width of 0.015 else if (r_sq <= 0.115**2) then ! linearly smooth the function between r = 0.1 and 0.115 q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = 1._wp + 9._wp*(0.115_wp - sqrt(r_sq))/(0.015_wp) - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(2._wp/sqrt(r_sq))*(y_cc(j) - 0.5_wp)*(0.115_wp - sqrt(r_sq))/(0.015_wp) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = (2._wp/sqrt(r_sq))*(x_cc(i) - 0.5_wp)*(0.115_wp - sqrt(r_sq))/(0.015_wp) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = -(2._wp/sqrt(r_sq))*(y%cc(j) - 0.5_wp)*(0.115_wp - sqrt(r_sq))/(0.015_wp) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = (2._wp/sqrt(r_sq))*(x%cc(i) - 0.5_wp)*(0.115_wp - sqrt(r_sq))/(0.015_wp) end if case (253) ! MHD Smooth Magnetic Vortex ! Section 5.2 of Implicit hybridized discontinuous Galerkin methods for compressible magnetohydrodynamics C. Ciuca, P. ! Fernandez, A. Christophe, N.C. Nguyen, J. Peraire ! velocity - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = 1._wp - (y_cc(j)*exp(1 - (x_cc(i)**2 + y_cc(j)**2))/(2.*pi)) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 1._wp + (x_cc(i)*exp(1 - (x_cc(i)**2 + y_cc(j)**2))/(2.*pi)) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = 1._wp - (y%cc(j)*exp(1 - (x%cc(i)**2 + y%cc(j)**2))/(2.*pi)) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, 0) = 1._wp + (x%cc(i)*exp(1 - (x%cc(i)**2 + y%cc(j)**2))/(2.*pi)) ! magnetic field - q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = -y_cc(j)*exp(1 - (x_cc(i)**2 + y_cc(j)**2))/(2.*pi) - q_prim_vf(eqn_idx%B%beg + 1)%sf(i, j, 0) = x_cc(i)*exp(1 - (x_cc(i)**2 + y_cc(j)**2))/(2.*pi) + q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = -y%cc(j)*exp(1 - (x%cc(i)**2 + y%cc(j)**2))/(2.*pi) + q_prim_vf(eqn_idx%B%beg + 1)%sf(i, j, 0) = x%cc(i)*exp(1 - (x%cc(i)**2 + y%cc(j)**2))/(2.*pi) ! pressure q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) = 1._wp + (1 - 2._wp*(x_cc(i)**2 + y_cc(j)**2))*exp(1 - (x_cc(i)**2 + y_cc(j)**2))/((2._wp*pi)**3) + & 0) = 1._wp + (1 - 2._wp*(x%cc(i)**2 + y%cc(j)**2))*exp(1 - (x%cc(i)**2 + y%cc(j)**2))/((2._wp*pi)**3) case (260) ! Gaussian Divergence Pulse ! Bx(x) = 1 + C * erf((x-0.5)/\sigma) => \partialBx/\partialx = C * (2/\sqrt\pi) * exp[-((x-0.5)/\sigma)**2] * (1/\sigma) ! Choose C = \epsilon * \sigma * \sqrt\pi / 2 => \partialBx/\partialx = \epsilon * exp[-((x-0.5)/\sigma)**2] \psi is @@ -239,10 +243,10 @@ C_mhd = eps_mhd*sigma*sqrt(pi)*0.5_wp ! B-field - q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = 1._wp + C_mhd*erf((x_cc(i) - 0.5_wp)/sigma) + q_prim_vf(eqn_idx%B%beg)%sf(i, j, 0) = 1._wp + C_mhd*erf((x%cc(i) - 0.5_wp)/sigma) case (261) ! Blob r0 = 1._wp/sqrt(8._wp) - r2 = x_cc(i)**2 + y_cc(j)**2 + r2 = x%cc(i)**2 + y%cc(j)**2 r = sqrt(r2) alpha = r/r0 if (alpha < 1) then @@ -257,7 +261,7 @@ cosA = cos(alpha) sinA = sin(alpha) ! projection along shock normal - r = x_cc(i)*cosA + y_cc(j)*sinA + r = x%cc(i)*cosA + y%cc(j)*sinA if (r <= 0.5_wp) then ! LEFT state: \rho=1, v\parallel=+10, v\perp=0, p=20, B\parallel=B\perp=5/\sqrt(4\pi) @@ -285,39 +289,39 @@ ! geometry 2 if (patch_id == 1) then q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) = 1.0*(1.0 - (1.0/1.0)*(5.0/(2.0*pi))*(5.0/(8.0*1.0*(1.4 + 1.0)*pi))*exp(2.0*1.0*(1.0 - (x_cc(i) & - & - patch_icpp(1)%x_centroid)**2.0 - (y_cc(j) - patch_icpp(1)%y_centroid)**2.0)))**(1.4 + 1.0) + & 0) = 1.0*(1.0 - (1.0/1.0)*(5.0/(2.0*pi))*(5.0/(8.0*1.0*(1.4 + 1.0)*pi))*exp(2.0*1.0*(1.0 - (x%cc(i) & + & - patch_icpp(1)%x_centroid)**2.0 - (y%cc(j) - patch_icpp(1)%y_centroid)**2.0)))**(1.4 + 1.0) q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, j, & - & 0) = 1.0*(1.0 - (1.0/1.0)*(5.0/(2.0*pi))*(5.0/(8.0*1.0*(1.4 + 1.0)*pi))*exp(2.0*1.0*(1.0 - (x_cc(i) & - & - patch_icpp(1)%x_centroid)**2.0 - (y_cc(j) - patch_icpp(1)%y_centroid)**2.0)))**1.4 + & 0) = 1.0*(1.0 - (1.0/1.0)*(5.0/(2.0*pi))*(5.0/(8.0*1.0*(1.4 + 1.0)*pi))*exp(2.0*1.0*(1.0 - (x%cc(i) & + & - patch_icpp(1)%x_centroid)**2.0 - (y%cc(j) - patch_icpp(1)%y_centroid)**2.0)))**1.4 q_prim_vf(eqn_idx%mom%beg + 0)%sf(i, j, & - & 0) = patch_icpp(1)%vel(1) + (y_cc(j) - patch_icpp(1)%y_centroid)*(5.0/(2.0*pi))*exp(1.0*(1.0 - (x_cc(i) & - & - patch_icpp(1) %x_centroid)**2.0 - (y_cc(j) - patch_icpp(1)%y_centroid)**2.0)) + & 0) = patch_icpp(1)%vel(1) + (y%cc(j) - patch_icpp(1)%y_centroid)*(5.0/(2.0*pi))*exp(1.0*(1.0 - (x%cc(i) & + & - patch_icpp(1) %x_centroid)**2.0 - (y%cc(j) - patch_icpp(1)%y_centroid)**2.0)) q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, & - & 0) = patch_icpp(1)%vel(2) - (x_cc(i) - patch_icpp(1)%x_centroid)*(5.0/(2.0*pi))*exp(1.0*(1.0 - (x_cc(i) & - & - patch_icpp(1) %x_centroid)**2.0 - (y_cc(j) - patch_icpp(1)%y_centroid)**2.0)) + & 0) = patch_icpp(1)%vel(2) - (x%cc(i) - patch_icpp(1)%x_centroid)*(5.0/(2.0*pi))*exp(1.0*(1.0 - (x%cc(i) & + & - patch_icpp(1) %x_centroid)**2.0 - (y%cc(j) - patch_icpp(1)%y_centroid)**2.0)) end if case (281) ! Acoustic pulse ! This is patch is hard-coded for test suite optimization used in the 2D_acoustic_pulse case: This analytic patch uses ! geometry 2 if (patch_id == 2) then q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) = 101325*(1 - 0.5*(1.4 - 1)*(0.4)**2*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))))**(1.4/(1.4 - 1)) + & 0) = 101325*(1 - 0.5*(1.4 - 1)*(0.4)**2*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))))**(1.4/(1.4 - 1)) q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, j, & - & 0) = 1*(1 - 0.5*(1.4 - 1)*(0.4)**2*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))))**(1/(1.4 - 1)) + & 0) = 1*(1 - 0.5*(1.4 - 1)*(0.4)**2*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))))**(1/(1.4 - 1)) end if case (282) ! Zero-circulation vortex ! This is patch is hard-coded for test suite optimization used in the 2D_zero_circ_vortex case: This analytic patch uses ! geometry 2 if (patch_id == 2) then q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) = 101325*(1 - 0.5*(1.4 - 1)*(0.1/0.3)**2*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))))**(1.4/(1.4 - 1)) + & 0) = 101325*(1 - 0.5*(1.4 - 1)*(0.1/0.3)**2*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))))**(1.4/(1.4 - 1)) q_prim_vf(eqn_idx%cont%beg + 0)%sf(i, j, & - & 0) = 1*(1 - 0.5*(1.4 - 1)*(0.1/0.3)**2*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))))**(1/(1.4 - 1)) + & 0) = 1*(1 - 0.5*(1.4 - 1)*(0.1/0.3)**2*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))))**(1/(1.4 - 1)) q_prim_vf(eqn_idx%mom%beg + 0)%sf(i, j, & - & 0) = 112.99092883944267*(1 - (0.1/0.3))*y_cc(j)*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))) + & 0) = 112.99092883944267*(1 - (0.1/0.3))*y%cc(j)*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))) q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, & - & 0) = 112.99092883944267*((0.1/0.3))*x_cc(i)*exp(0.5*(1 - sqrt(x_cc(i)**2 + y_cc(j)**2))) + & 0) = 112.99092883944267*((0.1/0.3))*x%cc(i)*exp(0.5*(1 - sqrt(x%cc(i)**2 + y%cc(j)**2))) end if case (283) ! Isentropic vortex: conserved-variable GL cell averages (3-pt tensor product) ! GL averages of conserved variables (rho, rho*u, rho*v, E) eliminate the O(h^2) error that primitive-variable averaging @@ -331,8 +335,8 @@ rho_avg = 0._wp; rhou_avg = 0._wp; rhov_avg = 0._wp; E_avg = 0._wp do igq = 1, 3 do jgq = 1, 3 - xq = x_cc(i) + gauss_xi(igq)*(x_cb(i) - x_cb(i - 1))*0.5_wp - yq = y_cc(j) + gauss_xi(jgq)*(y_cb(j) - y_cb(j - 1))*0.5_wp + xq = x%cc(i) + gauss_xi(igq)*(x%cb(i) - x%cb(i - 1))*0.5_wp + yq = y%cc(j) + gauss_xi(jgq)*(y%cb(j) - y%cb(j - 1))*0.5_wp r2q = (xq - patch_icpp(patch_id)%x_centroid)**2._wp + (yq - patch_icpp(patch_id)%y_centroid)**2._wp T_facq = 1._wp - (vortex_eps/(2._wp*pi))*(vortex_eps/(8._wp*(1.4_wp + 1._wp)*pi))*exp(2._wp*(1._wp - r2q)) wq = gauss_w(igq)*gauss_w(jgq) @@ -375,8 +379,8 @@ Y_N2 = 0.767_wp Y_O2 = 0.233_wp R_mix = 8.314462618_wp*((Y_N2/MW_N2) + (Y_O2/MW_O2)) - bottom_blend_u = tanh(y_cc(j)/delta_shear) - bottom_blend_T = tanh(y_cc(j)/delta_th) + bottom_blend_u = tanh(y%cc(j)/delta_shear) + bottom_blend_T = tanh(y%cc(j)/delta_th) u_mean = u_max*bottom_blend_u T_loc = T_wall + (T_inf - T_wall)*bottom_blend_T q_prim_vf(eqn_idx%cont%beg)%sf(i, j, 0) = P_atm/(R_mix*T_loc) diff --git a/src/common/include/3dHardcodedIC.fpp b/src/common/include/3dHardcodedIC.fpp index 6f4be25f56..22310283a8 100644 --- a/src/common/include/3dHardcodedIC.fpp +++ b/src/common/include/3dHardcodedIC.fpp @@ -55,7 +55,7 @@ do l = 0, n rcut = 0._wp do s = 0, NJet - 1 - r = sqrt((y_cc(l) - y_th_arr(s))**2._wp + (z_cc(q) - z_th_arr(s))**2._wp) + r = sqrt((y%cc(l) - y_th_arr(s))**2._wp + (z%cc(q) - z_th_arr(s))**2._wp) rcut = rcut + f_cut_on(r - r_th_arr(s), eps_smooth) end do rcut_arr(l, q) = rcut @@ -76,33 +76,33 @@ wl = 2._wp*pi/lam amp = 0.025_wp/wl - intH = amp*(sin(2._wp*pi*x_cc(i)/lam - pi/2._wp) + sin(2._wp*pi*z_cc(k)/lam - pi/2._wp)) + h + intH = amp*(sin(2._wp*pi*x%cc(i)/lam - pi/2._wp) + sin(2._wp*pi*z%cc(k)/lam - pi/2._wp)) + h - alph = 5.e-1_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp)) + alph = 5.e-1_wp*(1._wp + tanh((y%cc(j) - intH)/2.5e-3_wp)) if (alph < eps) alph = eps if (alph > 1._wp - eps) alph = 1._wp - eps - if (y_cc(j) > intH) then + if (y%cc(j) > intH) then q_prim_vf(eqn_idx%adv%beg)%sf(i, j, k) = alph q_prim_vf(eqn_idx%adv%end)%sf(i, j, k) = 1._wp - alph q_prim_vf(eqn_idx%cont%beg)%sf(i, j, k) = alph*rhoH q_prim_vf(eqn_idx%cont%end)%sf(i, j, k) = (1._wp - alph)*rhoL - q_prim_vf(eqn_idx%E)%sf(i, j, k) = pref + rhoH*9.81_wp*(1.2_wp - y_cc(j)) + q_prim_vf(eqn_idx%E)%sf(i, j, k) = pref + rhoH*9.81_wp*(1.2_wp - y%cc(j)) else q_prim_vf(eqn_idx%adv%beg)%sf(i, j, k) = alph q_prim_vf(eqn_idx%adv%end)%sf(i, j, k) = 1._wp - alph q_prim_vf(eqn_idx%cont%beg)%sf(i, j, k) = alph*rhoH q_prim_vf(eqn_idx%cont%end)%sf(i, j, k) = (1._wp - alph)*rhoL pInt = pref + rhoH*9.81_wp*(1.2_wp - intH) - q_prim_vf(eqn_idx%E)%sf(i, j, k) = pInt + rhoL*9.81_wp*(intH - y_cc(j)) + q_prim_vf(eqn_idx%E)%sf(i, j, k) = pInt + rhoL*9.81_wp*(intH - y%cc(j)) end if case (301) ! (3D lung geometry in X direction, |sin(*)+sin(*)|) h = 0.0_wp lam = 1.0_wp amp = patch_icpp(patch_id)%a(2) - intH = amp*abs((sin(2*pi*y_cc(j)/lam - pi/2) + sin(2*pi*z_cc(k)/lam - pi/2)) + h) - if (x_cc(i) > intH) then + intH = amp*abs((sin(2*pi*y%cc(j)/lam - pi/2) + sin(2*pi*z%cc(k)/lam - pi/2)) + h) + if (x%cc(i) > intH) then q_prim_vf(eqn_idx%cont%beg)%sf(i, j, k) = patch_icpp(1)%alpha_rho(1) q_prim_vf(eqn_idx%cont%end)%sf(i, j, k) = patch_icpp(1)%alpha_rho(2) q_prim_vf(eqn_idx%E)%sf(i, j, k) = patch_icpp(1)%pres @@ -122,9 +122,9 @@ eps_smooth = 1._wp eps = 1e-6 - r = sqrt((y_cc(j) - y_th)**2._wp + (z_cc(k) - z_th)**2._wp) + r = sqrt((y%cc(j) - y_th)**2._wp + (z%cc(k) - z_th)**2._wp) rcut = f_cut_on(r - r_th, eps_smooth) - xcut = f_cut_on(x_cc(i), eps_smooth) + xcut = f_cut_on(x%cc(i), eps_smooth) q_prim_vf(eqn_idx%mom%beg)%sf(i, j, k) = ux_th*rcut*xcut + ux_am q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, k) = 0._wp @@ -150,7 +150,7 @@ eps = 1e-6 rcut = rcut_arr(j, k) - xcut = f_cut_on(x_cc(i), eps_smooth) + xcut = f_cut_on(x%cc(i), eps_smooth) q_prim_vf(eqn_idx%mom%beg)%sf(i, j, k) = ux_th*rcut*xcut + ux_am q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, k) = 0._wp @@ -174,9 +174,9 @@ Mach = 0.1 if (patch_id == 1) then q_prim_vf(eqn_idx%E)%sf(i, j, & - & k) = 101325 + (Mach**2*376.636429464809**2/16)*(cos(2*x_cc(i)/1) + cos(2*y_cc(j)/1))*(cos(2*z_cc(k)/1) + 2) - q_prim_vf(eqn_idx%mom%beg + 0)%sf(i, j, k) = Mach*376.636429464809*sin(x_cc(i)/1)*cos(y_cc(j)/1)*sin(z_cc(k)/1) - q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, k) = -Mach*376.636429464809*cos(x_cc(i)/1)*sin(y_cc(j)/1)*sin(z_cc(k)/1) + & k) = 101325 + (Mach**2*376.636429464809**2/16)*(cos(2*x%cc(i)/1) + cos(2*y%cc(j)/1))*(cos(2*z%cc(k)/1) + 2) + q_prim_vf(eqn_idx%mom%beg + 0)%sf(i, j, k) = Mach*376.636429464809*sin(x%cc(i)/1)*cos(y%cc(j)/1)*sin(z%cc(k)/1) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(i, j, k) = -Mach*376.636429464809*cos(x%cc(i)/1)*sin(y%cc(j)/1)*sin(z%cc(k)/1) end if case default call s_int_to_str(patch_id, iStr) diff --git a/src/common/include/ExtrusionHardcodedIC.fpp b/src/common/include/ExtrusionHardcodedIC.fpp index 762876ecc3..42dd6f8d82 100644 --- a/src/common/include/ExtrusionHardcodedIC.fpp +++ b/src/common/include/ExtrusionHardcodedIC.fpp @@ -97,8 +97,8 @@ ! Calculate offsets domain_xstart = x_coords(1) - x_step = x_cc(1) - x_cc(0) - delta_x = merge(x_cc(0) - domain_xstart + x_step/2.0, x_cc(index_x) - domain_xstart + x_step/2.0, num_dims == 1) + x_step = x%cc(1) - x%cc(0) + delta_x = merge(x%cc(0) - domain_xstart + x_step/2.0, x%cc(index_x) - domain_xstart + x_step/2.0, num_dims == 1) global_offset_x = nint(abs(delta_x)/x_step) case (3) ! 3D case - determine grid structure ! Find yRows by counting rows with same x @@ -156,10 +156,10 @@ end do ! Calculate offsets - x_step = x_cc(1) - x_cc(0) - y_step = y_cc(1) - y_cc(0) - delta_x = x_cc(index_x) - x_coords(1) + x_step/2.0_wp - delta_y = y_cc(index_y) - y_coords(1) + y_step/2.0_wp + x_step = x%cc(1) - x%cc(0) + y_step = y%cc(1) - y%cc(0) + delta_x = x%cc(index_x) - x_coords(1) + x_step/2.0_wp + delta_y = y%cc(index_y) - y_coords(1) + y_step/2.0_wp global_offset_x = nint(abs(delta_x)/x_step) global_offset_y = nint(abs(delta_y)/y_step) end select diff --git a/src/common/m_boundary_common.fpp b/src/common/m_boundary_common.fpp index 6eb5383f75..5bb805469a 100644 --- a/src/common/m_boundary_common.fpp +++ b/src/common/m_boundary_common.fpp @@ -784,7 +784,7 @@ contains integer :: j, q, i do j = 1, buff_size - if (z_cc(l) < pi) then + if (z%cc(l) < pi) then do i = 1, eqn_idx%mom%beg q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, j - 1, l + ((p + 1)/2)) end do @@ -815,7 +815,7 @@ contains do i = 1, nb do q = 1, nnode do j = 1, buff_size - if (z_cc(l) < pi) then + if (z%cc(l) < pi) then pb_in(k, -j, l, q, i) = pb_in(k, j - 1, l + ((p + 1)/2), q, i) mv_in(k, -j, l, q, i) = mv_in(k, j - 1, l + ((p + 1)/2), q, i) else @@ -2166,25 +2166,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(1, -1) else if (bc_x%beg <= BC_GHOST_EXTRAP) then do i = 1, buff_size - dx(-i) = dx(0) + x%spacing(-i) = x%spacing(0) end do else if (bc_x%beg == BC_REFLECTIVE) then do i = 1, buff_size - dx(-i) = dx(i - 1) + x%spacing(-i) = x%spacing(i - 1) end do else if (bc_x%beg == BC_PERIODIC) then do i = 1, buff_size - dx(-i) = dx(m - (i - 1)) + x%spacing(-i) = x%spacing(m - (i - 1)) end do end if ! Computing the cell-boundary and center locations buffer at bc_x%beg do i = 1, offset_x%beg - x_cb(-1 - i) = x_cb(-i) - dx(-i) + x%cb(-1 - i) = x%cb(-i) - x%spacing(-i) end do do i = 1, buff_size - x_cc(-i) = x_cc(1 - i) - (dx(1 - i) + dx(-i))/2._wp + x%cc(-i) = x%cc(1 - i) - (x%spacing(1 - i) + x%spacing(-i))/2._wp end do ! Populating the cell-width distribution buffer at bc_x%end @@ -2192,25 +2192,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(1, 1) else if (bc_x%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size - dx(m + i) = dx(m) + x%spacing(m + i) = x%spacing(m) end do else if (bc_x%end == BC_REFLECTIVE) then do i = 1, buff_size - dx(m + i) = dx(m - (i - 1)) + x%spacing(m + i) = x%spacing(m - (i - 1)) end do else if (bc_x%end == BC_PERIODIC) then do i = 1, buff_size - dx(m + i) = dx(i - 1) + x%spacing(m + i) = x%spacing(i - 1) end do end if ! Populating the cell-boundary and center locations buffer at bc_x%end do i = 1, offset_x%end - x_cb(m + i) = x_cb(m + (i - 1)) + dx(m + i) + x%cb(m + i) = x%cb(m + (i - 1)) + x%spacing(m + i) end do do i = 1, buff_size - x_cc(m + i) = x_cc(m + (i - 1)) + (dx(m + (i - 1)) + dx(m + i))/2._wp + x%cc(m + i) = x%cc(m + (i - 1)) + (x%spacing(m + (i - 1)) + x%spacing(m + i))/2._wp end do ! Population of Buffers in y-direction @@ -2222,25 +2222,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(2, -1) else if (bc_y%beg <= BC_GHOST_EXTRAP .and. bc_y%beg /= BC_AXIS) then do i = 1, buff_size - dy(-i) = dy(0) + y%spacing(-i) = y%spacing(0) end do else if (bc_y%beg == BC_REFLECTIVE .or. bc_y%beg == BC_AXIS) then do i = 1, buff_size - dy(-i) = dy(i - 1) + y%spacing(-i) = y%spacing(i - 1) end do else if (bc_y%beg == BC_PERIODIC) then do i = 1, buff_size - dy(-i) = dy(n - (i - 1)) + y%spacing(-i) = y%spacing(n - (i - 1)) end do end if ! Computing the cell-boundary and center locations buffer at bc_y%beg do i = 1, offset_y%beg - y_cb(-1 - i) = y_cb(-i) - dy(-i) + y%cb(-1 - i) = y%cb(-i) - y%spacing(-i) end do do i = 1, buff_size - y_cc(-i) = y_cc(1 - i) - (dy(1 - i) + dy(-i))/2._wp + y%cc(-i) = y%cc(1 - i) - (y%spacing(1 - i) + y%spacing(-i))/2._wp end do ! Populating the cell-width distribution buffer at bc_y%end @@ -2248,25 +2248,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(2, 1) else if (bc_y%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size - dy(n + i) = dy(n) + y%spacing(n + i) = y%spacing(n) end do else if (bc_y%end == BC_REFLECTIVE) then do i = 1, buff_size - dy(n + i) = dy(n - (i - 1)) + y%spacing(n + i) = y%spacing(n - (i - 1)) end do else if (bc_y%end == BC_PERIODIC) then do i = 1, buff_size - dy(n + i) = dy(i - 1) + y%spacing(n + i) = y%spacing(i - 1) end do end if ! Populating the cell-boundary and center locations buffer at bc_y%end do i = 1, offset_y%end - y_cb(n + i) = y_cb(n + (i - 1)) + dy(n + i) + y%cb(n + i) = y%cb(n + (i - 1)) + y%spacing(n + i) end do do i = 1, buff_size - y_cc(n + i) = y_cc(n + (i - 1)) + (dy(n + (i - 1)) + dy(n + i))/2._wp + y%cc(n + i) = y%cc(n + (i - 1)) + (y%spacing(n + (i - 1)) + y%spacing(n + i))/2._wp end do ! Population of Buffers in z-direction @@ -2278,25 +2278,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(3, -1) else if (bc_z%beg <= BC_GHOST_EXTRAP) then do i = 1, buff_size - dz(-i) = dz(0) + z%spacing(-i) = z%spacing(0) end do else if (bc_z%beg == BC_REFLECTIVE) then do i = 1, buff_size - dz(-i) = dz(i - 1) + z%spacing(-i) = z%spacing(i - 1) end do else if (bc_z%beg == BC_PERIODIC) then do i = 1, buff_size - dz(-i) = dz(p - (i - 1)) + z%spacing(-i) = z%spacing(p - (i - 1)) end do end if ! Computing the cell-boundary and center locations buffer at bc_z%beg do i = 1, offset_z%beg - z_cb(-1 - i) = z_cb(-i) - dz(-i) + z%cb(-1 - i) = z%cb(-i) - z%spacing(-i) end do do i = 1, buff_size - z_cc(-i) = z_cc(1 - i) - (dz(1 - i) + dz(-i))/2._wp + z%cc(-i) = z%cc(1 - i) - (z%spacing(1 - i) + z%spacing(-i))/2._wp end do ! Populating the cell-width distribution buffer at bc_z%end @@ -2304,25 +2304,25 @@ contains call s_mpi_sendrecv_grid_variables_buffers(3, 1) else if (bc_z%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size - dz(p + i) = dz(p) + z%spacing(p + i) = z%spacing(p) end do else if (bc_z%end == BC_REFLECTIVE) then do i = 1, buff_size - dz(p + i) = dz(p - (i - 1)) + z%spacing(p + i) = z%spacing(p - (i - 1)) end do else if (bc_z%end == BC_PERIODIC) then do i = 1, buff_size - dz(p + i) = dz(i - 1) + z%spacing(p + i) = z%spacing(i - 1) end do end if ! Populating the cell-boundary and center locations buffer at bc_z%end do i = 1, offset_z%end - z_cb(p + i) = z_cb(p + (i - 1)) + dz(p + i) + z%cb(p + i) = z%cb(p + (i - 1)) + z%spacing(p + i) end do do i = 1, buff_size - z_cc(p + i) = z_cc(p + (i - 1)) + (dz(p + (i - 1)) + dz(p + i))/2._wp + z%cc(p + i) = z%cc(p + (i - 1)) + (z%spacing(p + (i - 1)) + z%spacing(p + i))/2._wp end do #endif diff --git a/src/common/m_chemistry.fpp b/src/common/m_chemistry.fpp index 4f35e3e77e..22d817f911 100644 --- a/src/common/m_chemistry.fpp +++ b/src/common/m_chemistry.fpp @@ -56,27 +56,27 @@ contains type(scalar_field), intent(inout) :: q_T_sf type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf type(int_bounds_info), dimension(1:3), intent(in) :: bounds - integer :: x, y, z, eqn + integer :: cx, cy, cz, eqn real(wp) :: energy, T_in real(wp), dimension(num_species) :: Ys - do z = bounds(3)%beg, bounds(3)%end - do y = bounds(2)%beg, bounds(2)%end - do x = bounds(1)%beg, bounds(1)%end + do cz = bounds(3)%beg, bounds(3)%end + do cy = bounds(2)%beg, bounds(2)%end + do cx = bounds(1)%beg, bounds(1)%end do eqn = eqn_idx%species%beg, eqn_idx%species%end - Ys(eqn - eqn_idx%species%beg + 1) = q_cons_vf(eqn)%sf(x, y, z)/q_cons_vf(eqn_idx%cont%beg)%sf(x, y, z) + Ys(eqn - eqn_idx%species%beg + 1) = q_cons_vf(eqn)%sf(cx, cy, cz)/q_cons_vf(eqn_idx%cont%beg)%sf(cx, cy, cz) end do ! e = E - 1/2*|u|^2 cons. eqn_idx%E = \rho E cons. eqn_idx%cont%beg = \rho (1-fluid model) cons. eqn_idx%mom%beg ! + i = \rho u_i - energy = q_cons_vf(eqn_idx%E)%sf(x, y, z)/q_cons_vf(eqn_idx%cont%beg)%sf(x, y, z) + energy = q_cons_vf(eqn_idx%E)%sf(cx, cy, cz)/q_cons_vf(eqn_idx%cont%beg)%sf(cx, cy, cz) do eqn = eqn_idx%mom%beg, eqn_idx%mom%end - energy = energy - 0.5_wp*(q_cons_vf(eqn)%sf(x, y, z)/q_cons_vf(eqn_idx%cont%beg)%sf(x, y, z))**2._wp + energy = energy - 0.5_wp*(q_cons_vf(eqn)%sf(cx, cy, cz)/q_cons_vf(eqn_idx%cont%beg)%sf(cx, cy, cz))**2._wp end do - T_in = real(q_T_sf%sf(x, y, z), kind=wp) + T_in = real(q_T_sf%sf(cx, cy, cz), kind=wp) call get_temperature(energy, dflt_T_guess, Ys, .true., T_in) - q_T_sf%sf(x, y, z) = T_in + q_T_sf%sf(cx, cy, cz) = T_in end do end do end do @@ -89,19 +89,20 @@ contains type(scalar_field), intent(inout) :: q_T_sf type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf type(int_bounds_info), dimension(1:3), intent(in) :: bounds - integer :: x, y, z, i + integer :: cx, cy, cz, i real(wp), dimension(num_species) :: Ys real(wp) :: mix_mol_weight - do z = bounds(3)%beg, bounds(3)%end - do y = bounds(2)%beg, bounds(2)%end - do x = bounds(1)%beg, bounds(1)%end + do cz = bounds(3)%beg, bounds(3)%end + do cy = bounds(2)%beg, bounds(2)%end + do cx = bounds(1)%beg, bounds(1)%end do i = eqn_idx%species%beg, eqn_idx%species%end - Ys(i - eqn_idx%species%beg + 1) = q_prim_vf(i)%sf(x, y, z) + Ys(i - eqn_idx%species%beg + 1) = q_prim_vf(i)%sf(cx, cy, cz) end do call get_mixture_molecular_weight(Ys, mix_mol_weight) - q_T_sf%sf(x, y, z) = q_prim_vf(eqn_idx%E)%sf(x, y, z)*mix_mol_weight/(gas_constant*q_prim_vf(1)%sf(x, y, z)) + q_T_sf%sf(cx, cy, cz) = q_prim_vf(eqn_idx%E)%sf(cx, cy, cz)*mix_mol_weight/(gas_constant*q_prim_vf(1)%sf(cx, & + & cy, cz)) end do end do end do @@ -115,7 +116,7 @@ contains type(scalar_field), intent(inout) :: q_T_sf type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_qp, q_prim_qp type(int_bounds_info), dimension(1:3), intent(in) :: bounds - integer :: x, y, z + integer :: cx, cy, cz integer :: eqn real(wp) :: T real(wp) :: rho, omega_m @@ -129,16 +130,16 @@ contains #:endif $:GPU_PARALLEL_LOOP(collapse=3, private='[Ys, omega, eqn, T, rho, omega_m]', copyin='[bounds]') - do z = bounds(3)%beg, bounds(3)%end - do y = bounds(2)%beg, bounds(2)%end - do x = bounds(1)%beg, bounds(1)%end + do cz = bounds(3)%beg, bounds(3)%end + do cy = bounds(2)%beg, bounds(2)%end + do cx = bounds(1)%beg, bounds(1)%end $:GPU_LOOP(parallelism='[seq]') do eqn = eqn_idx%species%beg, eqn_idx%species%end - Ys(eqn - eqn_idx%species%beg + 1) = q_prim_qp(eqn)%sf(x, y, z) + Ys(eqn - eqn_idx%species%beg + 1) = q_prim_qp(eqn)%sf(cx, cy, cz) end do - rho = q_cons_qp(eqn_idx%cont%end)%sf(x, y, z) - T = q_T_sf%sf(x, y, z) + rho = q_cons_qp(eqn_idx%cont%end)%sf(cx, cy, cz) + T = q_T_sf%sf(cx, cy, cz) call get_net_production_rates(rho, T, Ys, omega) @@ -150,7 +151,7 @@ contains #:else omega_m = molecular_weights(eqn - eqn_idx%species%beg + 1)*omega(eqn - eqn_idx%species%beg + 1) #:endif - rhs_vf(eqn)%sf(x, y, z) = rhs_vf(eqn)%sf(x, y, z) + omega_m + rhs_vf(eqn)%sf(cx, cy, cz) = rhs_vf(eqn)%sf(cx, cy, cz) + omega_m end do end do end do @@ -186,7 +187,7 @@ contains real(wp) :: Cp_L, Cp_R real(wp) :: diffusivity_L, diffusivity_R, diffusivity_cell real(wp) :: hmix_L, hmix_R, dh_dxi - integer :: x, y, z, i, n, eqn + integer :: cx, cy, cz, i, n, eqn integer, dimension(3) :: offsets isc1 = irx; isc2 = iry; isc3 = irz @@ -200,29 +201,30 @@ contains ! Model 1: Mixture-Average Transport if (chem_params%transport_model == 1) then ! Note: Added 'i' and 'eqn' to private list. - $:GPU_PARALLEL_LOOP(collapse=3, private='[x, y, z, i, eqn, Ys_L, Ys_R, Ys_cell, Xs_L, Xs_R, & + $:GPU_PARALLEL_LOOP(collapse=3, private='[cx, cy, cz, i, eqn, Ys_L, Ys_R, Ys_cell, Xs_L, Xs_R, & & mass_diffusivities_mixavg1, mass_diffusivities_mixavg2, mass_diffusivities_mixavg_Cell, & & h_l, h_r, Xs_cell, h_k, dXk_dxi, Mass_Diffu_Flux, Mass_Diffu_Energy, MW_L, MW_R, MW_cell, & & T_L, T_R, P_L, P_R, rho_L, rho_R, rho_cell, rho_Vic, lambda_L, lambda_R, lambda_Cell, & & dT_dxi, grid_spacing]', copyin='[offsets]') - do z = isc3%beg, isc3%end - do y = isc2%beg, isc2%end - do x = isc1%beg, isc1%end + do cz = isc3%beg, isc3%end + do cy = isc2%beg, isc2%end + do cx = isc1%beg, isc1%end ! Calculate grid spacing using direction-based indexing select case (idir) case (1) - grid_spacing = x_cc(x + 1) - x_cc(x) + grid_spacing = x%cc(cx + 1) - x%cc(cx) case (2) - grid_spacing = y_cc(y + 1) - y_cc(y) + grid_spacing = y%cc(cy + 1) - y%cc(cy) case (3) - grid_spacing = z_cc(z + 1) - z_cc(z) + grid_spacing = z%cc(cz + 1) - z%cc(cz) end select ! Extract species mass fractions $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - Ys_L(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(x, y, z) - Ys_R(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + Ys_L(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(cx, cy, cz) + Ys_R(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(cx + offsets(1), cy + offsets(2), & + & cz + offsets(3)) Ys_cell(i - eqn_idx%species%beg + 1) = 0.5_wp*(Ys_L(i - eqn_idx%species%beg + 1) + Ys_R(i & & - eqn_idx%species%beg + 1)) end do @@ -235,14 +237,14 @@ contains call get_mole_fractions(MW_L, Ys_L, Xs_L) call get_mole_fractions(MW_R, Ys_R, Xs_R) - P_L = q_prim_qp(eqn_idx%E)%sf(x, y, z) - P_R = q_prim_qp(eqn_idx%E)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + P_L = q_prim_qp(eqn_idx%E)%sf(cx, cy, cz) + P_R = q_prim_qp(eqn_idx%E)%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) - rho_L = q_prim_qp(1)%sf(x, y, z) - rho_R = q_prim_qp(1)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + rho_L = q_prim_qp(1)%sf(cx, cy, cz) + rho_R = q_prim_qp(1)%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) - T_L = q_T_sf%sf(x, y, z) - T_R = q_T_sf%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + T_L = q_T_sf%sf(cx, cy, cz) + T_R = q_T_sf%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) rho_cell = 0.5_wp*(rho_L + rho_R) dT_dxi = (T_R - T_L)/grid_spacing @@ -322,12 +324,12 @@ contains Mass_Diffu_Energy = lambda_Cell*dT_dxi + Mass_Diffu_Energy ! Update flux arrays - flux_src_vf(eqn_idx%E)%sf(x, y, z) = flux_src_vf(eqn_idx%E)%sf(x, y, z) - Mass_Diffu_Energy + flux_src_vf(eqn_idx%E)%sf(cx, cy, cz) = flux_src_vf(eqn_idx%E)%sf(cx, cy, cz) - Mass_Diffu_Energy $:GPU_LOOP(parallelism='[seq]') do eqn = eqn_idx%species%beg, eqn_idx%species%end - flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, & - & z) - Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) + flux_src_vf(eqn)%sf(cx, cy, cz) = flux_src_vf(eqn)%sf(cx, cy, & + & cz) - Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) end do end do end do @@ -337,28 +339,29 @@ contains ! Model 2: Unity Lewis Number else if (chem_params%transport_model == 2) then ! Note: Added ALL scalars and 'i'/'eqn' to private list to prevent race conditions. - $:GPU_PARALLEL_LOOP(collapse=3, private='[x, y, z, i, eqn, Ys_L, Ys_R, Ys_cell, dYk_dxi, Mass_Diffu_Flux, & + $:GPU_PARALLEL_LOOP(collapse=3, private='[cx, cy, cz, i, eqn, Ys_L, Ys_R, Ys_cell, dYk_dxi, Mass_Diffu_Flux, & & grid_spacing, MW_L, MW_R, MW_cell, P_L, P_R, rho_L, rho_R, rho_cell, T_L, T_R, Cp_L, Cp_R, & & hmix_L, hmix_R, dh_dxi, lambda_L, lambda_R, lambda_Cell, diffusivity_L, diffusivity_R, & & diffusivity_cell, Mass_Diffu_Energy]', copyin='[offsets]') - do z = isc3%beg, isc3%end - do y = isc2%beg, isc2%end - do x = isc1%beg, isc1%end + do cz = isc3%beg, isc3%end + do cy = isc2%beg, isc2%end + do cx = isc1%beg, isc1%end ! Calculate grid spacing using direction-based indexing select case (idir) case (1) - grid_spacing = x_cc(x + 1) - x_cc(x) + grid_spacing = x%cc(cx + 1) - x%cc(cx) case (2) - grid_spacing = y_cc(y + 1) - y_cc(y) + grid_spacing = y%cc(cy + 1) - y%cc(cy) case (3) - grid_spacing = z_cc(z + 1) - z_cc(z) + grid_spacing = z%cc(cz + 1) - z%cc(cz) end select ! Extract species mass fractions $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - Ys_L(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(x, y, z) - Ys_R(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + Ys_L(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(cx, cy, cz) + Ys_R(i - eqn_idx%species%beg + 1) = q_prim_qp(i)%sf(cx + offsets(1), cy + offsets(2), & + & cz + offsets(3)) Ys_cell(i - eqn_idx%species%beg + 1) = 0.5_wp*(Ys_L(i - eqn_idx%species%beg + 1) + Ys_R(i & & - eqn_idx%species%beg + 1)) end do @@ -368,14 +371,14 @@ contains call get_mixture_molecular_weight(Ys_R, MW_R) MW_cell = 0.5_wp*(MW_L + MW_R) - P_L = q_prim_qp(eqn_idx%E)%sf(x, y, z) - P_R = q_prim_qp(eqn_idx%E)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + P_L = q_prim_qp(eqn_idx%E)%sf(cx, cy, cz) + P_R = q_prim_qp(eqn_idx%E)%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) - rho_L = q_prim_qp(1)%sf(x, y, z) - rho_R = q_prim_qp(1)%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + rho_L = q_prim_qp(1)%sf(cx, cy, cz) + rho_R = q_prim_qp(1)%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) - T_L = q_T_sf%sf(x, y, z) - T_R = q_T_sf%sf(x + offsets(1), y + offsets(2), z + offsets(3)) + T_L = q_T_sf%sf(cx, cy, cz) + T_R = q_T_sf%sf(cx + offsets(1), cy + offsets(2), cz + offsets(3)) rho_cell = 0.5_wp*(rho_L + rho_R) @@ -414,12 +417,12 @@ contains Mass_Diffu_Energy = rho_cell*diffusivity_cell*dh_dxi ! Update flux arrays - flux_src_vf(eqn_idx%E)%sf(x, y, z) = flux_src_vf(eqn_idx%E)%sf(x, y, z) - Mass_Diffu_Energy + flux_src_vf(eqn_idx%E)%sf(cx, cy, cz) = flux_src_vf(eqn_idx%E)%sf(cx, cy, cz) - Mass_Diffu_Energy $:GPU_LOOP(parallelism='[seq]') do eqn = eqn_idx%species%beg, eqn_idx%species%end - flux_src_vf(eqn)%sf(x, y, z) = flux_src_vf(eqn)%sf(x, y, & - & z) - Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) + flux_src_vf(eqn)%sf(cx, cy, cz) = flux_src_vf(eqn)%sf(cx, cy, & + & cz) - Mass_Diffu_Flux(eqn - eqn_idx%species%beg + 1) end do end do end do diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 6ee2e836a5..c06090472e 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -13,6 +13,11 @@ module m_derived_types implicit none + !> Derived type for a single spatial grid axis: cell-boundary, cell-center, and per-cell spacing arrays + type grid_axis + real(wp), allocatable, dimension(:) :: cb, cc, spacing + end type grid_axis + !> Derived type adding the field position (fp) as an attribute type field_position real(stp), allocatable, dimension(:,:,:) :: fp !< Field position diff --git a/src/common/m_model.fpp b/src/common/m_model.fpp index 0dab036f9b..88ce8f8237 100644 --- a/src/common/m_model.fpp +++ b/src/common/m_model.fpp @@ -980,8 +980,8 @@ contains real(wp) :: grid_mm(1:3,1:2) real(wp), dimension(1:4,1:4) :: transform, transform_n - dx_local = minval(dx); dy_local = minval(dy) - if (p /= 0) dz_local = minval(dz) + dx_local = minval(x%spacing); dy_local = minval(y%spacing) + if (p /= 0) dz_local = minval(z%spacing) allocate (stl_bounding_boxes(num_ibs,1:3,1:3)) @@ -1036,11 +1036,11 @@ contains write (*, "(A, 3(2X, F20.10))") " > Cen:", (bbox%min(1:3) + bbox%max(1:3))/2._wp write (*, "(A, 3(2X, F20.10))") " > Max:", bbox%max(1:3) - grid_mm(1,:) = (/minval(x_cc(0:m)) - 0.5_wp*dx_local, maxval(x_cc(0:m)) + 0.5_wp*dx_local/) - grid_mm(2,:) = (/minval(y_cc(0:n)) - 0.5_wp*dy_local, maxval(y_cc(0:n)) + 0.5_wp*dy_local/) + grid_mm(1,:) = (/minval(x%cc(0:m)) - 0.5_wp*dx_local, maxval(x%cc(0:m)) + 0.5_wp*dx_local/) + grid_mm(2,:) = (/minval(y%cc(0:n)) - 0.5_wp*dy_local, maxval(y%cc(0:n)) + 0.5_wp*dy_local/) if (p > 0) then - grid_mm(3,:) = (/minval(z_cc(0:p)) - 0.5_wp*dz_local, maxval(z_cc(0:p)) + 0.5_wp*dz_local/) + grid_mm(3,:) = (/minval(z%cc(0:p)) - 0.5_wp*dz_local, maxval(z%cc(0:p)) + 0.5_wp*dz_local/) else grid_mm(3,:) = (/0._wp, 0._wp/) end if diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index 7d4b92705c..b2d6465243 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -1443,57 +1443,57 @@ contains if (pbc_loc == -1) then ! PBC at the beginning if (bc_x%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(dx(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, dx(-buff_size), buff_size, mpi_p, & - & bc_x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, x%spacing(-buff_size), & + & buff_size, mpi_p, bc_x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(dx(0), buff_size, mpi_p, bc_x%beg, 1, dx(-buff_size), buff_size, mpi_p, bc_x%beg, 0, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc_x%beg, 1, x%spacing(-buff_size), buff_size, mpi_p, & + & bc_x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end if (bc_x%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(dx(0), buff_size, mpi_p, bc_x%beg, 1, dx(m + 1), buff_size, mpi_p, bc_x%end, 1, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc_x%beg, 1, x%spacing(m + 1), buff_size, mpi_p, bc_x%end, & + & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(dx(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, dx(m + 1), buff_size, mpi_p, & - & bc_x%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, x%spacing(m + 1), buff_size, & + & mpi_p, bc_x%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if else if (mpi_dir == 2) then if (pbc_loc == -1) then ! PBC at the beginning if (bc_y%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(dy(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, dy(-buff_size), buff_size, mpi_p, & - & bc_y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, y%spacing(-buff_size), & + & buff_size, mpi_p, bc_y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(dy(0), buff_size, mpi_p, bc_y%beg, 1, dy(-buff_size), buff_size, mpi_p, bc_y%beg, 0, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc_y%beg, 1, y%spacing(-buff_size), buff_size, mpi_p, & + & bc_y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end if (bc_y%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(dy(0), buff_size, mpi_p, bc_y%beg, 1, dy(n + 1), buff_size, mpi_p, bc_y%end, 1, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc_y%beg, 1, y%spacing(n + 1), buff_size, mpi_p, bc_y%end, & + & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(dy(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, dy(n + 1), buff_size, mpi_p, & - & bc_y%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, y%spacing(n + 1), buff_size, & + & mpi_p, bc_y%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if else if (pbc_loc == -1) then ! PBC at the beginning if (bc_z%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(dz(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, dz(-buff_size), buff_size, mpi_p, & - & bc_z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, z%spacing(-buff_size), & + & buff_size, mpi_p, bc_z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(dz(0), buff_size, mpi_p, bc_z%beg, 1, dz(-buff_size), buff_size, mpi_p, bc_z%beg, 0, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc_z%beg, 1, z%spacing(-buff_size), buff_size, mpi_p, & + & bc_z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end if (bc_z%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(dz(0), buff_size, mpi_p, bc_z%beg, 1, dz(p + 1), buff_size, mpi_p, bc_z%end, 1, & - & MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc_z%beg, 1, z%spacing(p + 1), buff_size, mpi_p, bc_z%end, & + & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(dz(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, dz(p + 1), buff_size, mpi_p, & - & bc_z%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, z%spacing(p + 1), buff_size, & + & mpi_p, bc_z%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if end if diff --git a/src/post_process/m_data_input.f90 b/src/post_process/m_data_input.f90 index 287a8a505c..f6bee854f6 100644 --- a/src/post_process/m_data_input.f90 +++ b/src/post_process/m_data_input.f90 @@ -215,13 +215,13 @@ impure subroutine s_read_serial_data_files(t_step) ! actual arrays. Without slicing, when offset_x%beg or buff_size > 0 (i.e. format=1 parallel 3D ranks), Fortran's ! assumed-shape re-mapping shifts the read by that many slots and leaves the last interior cells uninitialized - corrupting ! downstream ghost-cell extrapolation. - call s_read_grid_data_direction(t_step_dir, 'x', x_cb(-1:m), dx(0:m), x_cc(0:m), m) + call s_read_grid_data_direction(t_step_dir, 'x', x%cb(-1:m), x%spacing(0:m), x%cc(0:m), m) if (n > 0) then - call s_read_grid_data_direction(t_step_dir, 'y', y_cb(-1:n), dy(0:n), y_cc(0:n), n) + call s_read_grid_data_direction(t_step_dir, 'y', y%cb(-1:n), y%spacing(0:n), y%cc(0:n), n) if (p > 0) then - call s_read_grid_data_direction(t_step_dir, 'z', z_cb(-1:p), dz(0:p), z_cc(0:p), p) + call s_read_grid_data_direction(t_step_dir, 'z', z%cb(-1:p), z%spacing(0:p), z%cc(0:p), p) end if end if @@ -296,9 +296,9 @@ impure subroutine s_read_parallel_data_files(t_step) call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.') end if - x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) - dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp + x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) + x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) + x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp if (n > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat' @@ -320,9 +320,9 @@ impure subroutine s_read_parallel_data_files(t_step) call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.') end if - y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) - dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp + y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) + y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) + y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp if (p > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat' @@ -344,9 +344,9 @@ impure subroutine s_read_parallel_data_files(t_step) call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.') end if - z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) - dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp + z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) + z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) + z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp end if end if diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index aece31ff8d..79e7427330 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -326,21 +326,21 @@ contains upper_bound = ${M}$ + offset_${X}$%end do i = lower_bound, upper_bound - if (${X}$_cc(i) > ${X}$_output%beg) then + if (${X}$%cc(i) > ${X}$_output%beg) then ${X}$_output_idx%beg = i + offset_${X}$%beg exit end if end do do i = upper_bound, lower_bound, -1 - if (${X}$_cc(i) < ${X}$_output%end) then + if (${X}$%cc(i) < ${X}$_output%end) then ${X}$_output_idx%end = i + offset_${X}$%beg exit end if end do ! If no grid points are within the output region - if ((${X}$_cc(lower_bound) > ${X}$_output%end) .or. (${X}$_cc(upper_bound) < ${X}$_output%beg)) then + if ((${X}$%cc(lower_bound) > ${X}$_output%end) .or. (${X}$%cc(upper_bound) < ${X}$_output%beg)) then ${X}$_output_idx%beg = 0 ${X}$_output_idx%end = 0 end if @@ -455,14 +455,14 @@ contains call s_mpi_gather_spatial_extents(spatial_extents) else if (p > 0) then if (grid_geometry == 3) then - spatial_extents(:,0) = (/minval(y_cb), minval(z_cb), minval(x_cb), maxval(y_cb), maxval(z_cb), maxval(x_cb)/) + spatial_extents(:,0) = (/minval(y%cb), minval(z%cb), minval(x%cb), maxval(y%cb), maxval(z%cb), maxval(x%cb)/) else - spatial_extents(:,0) = (/minval(x_cb), minval(y_cb), minval(z_cb), maxval(x_cb), maxval(y_cb), maxval(z_cb)/) + spatial_extents(:,0) = (/minval(x%cb), minval(y%cb), minval(z%cb), maxval(x%cb), maxval(y%cb), maxval(z%cb)/) end if else if (n > 0) then - spatial_extents(:,0) = (/minval(x_cb), minval(y_cb), maxval(x_cb), maxval(y_cb)/) + spatial_extents(:,0) = (/minval(x%cb), minval(y%cb), maxval(x%cb), maxval(y%cb)/) else - spatial_extents(:,0) = (/minval(x_cb), maxval(x_cb)/) + spatial_extents(:,0) = (/minval(x%cb), maxval(x%cb)/) end if ! Next, the root processor proceeds to record all of the spatial extents in the formatted database master file. In @@ -492,10 +492,10 @@ contains err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, size(lo_offset), lo_offset) err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, size(hi_offset), hi_offset) if (grid_geometry == 3) then - err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, y_cb, z_cb, x_cb, dims, 3, DB_DOUBLE, & + err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, y%cb, z%cb, x%cb, dims, 3, DB_DOUBLE, & & DB_COLLINEAR, optlist, ierr) else - err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x_cb, y_cb, z_cb, dims, 3, DB_DOUBLE, & + err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x%cb, y%cb, z%cb, dims, 3, DB_DOUBLE, & & DB_COLLINEAR, optlist, ierr) end if err = DBFREEOPTLIST(optlist) @@ -503,14 +503,14 @@ contains err = DBMKOPTLIST(2, optlist) err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, size(lo_offset), lo_offset) err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, size(hi_offset), hi_offset) - err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x_cb, y_cb, DB_F77NULL, dims, 2, DB_DOUBLE, & + err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x%cb, y%cb, DB_F77NULL, dims, 2, DB_DOUBLE, & & DB_COLLINEAR, optlist, ierr) err = DBFREEOPTLIST(optlist) else err = DBMKOPTLIST(2, optlist) err = DBADDIAOPT(optlist, DBOPT_LO_OFFSET, size(lo_offset), lo_offset) err = DBADDIAOPT(optlist, DBOPT_HI_OFFSET, size(hi_offset), hi_offset) - err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x_cb, DB_F77NULL, DB_F77NULL, dims, 1, & + err = DBPUTQM(dbfile, 'rectilinear_grid', 16, 'x', 1, 'y', 1, 'z', 1, x%cb, DB_F77NULL, DB_F77NULL, dims, 1, & & DB_DOUBLE, DB_COLLINEAR, optlist, ierr) err = DBFREEOPTLIST(optlist) end if @@ -519,23 +519,23 @@ contains ! maintained in multidimensions. if (p > 0) then if (precision == 1) then - write (dbfile) real(x_cb, sp), real(y_cb, sp), real(z_cb, sp) + write (dbfile) real(x%cb, sp), real(y%cb, sp), real(z%cb, sp) else if (output_partial_domain) then - write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end), y_cb(y_output_idx%beg - 1:y_output_idx%end), & - & z_cb(z_output_idx%beg - 1:z_output_idx%end) + write (dbfile) x%cb(x_output_idx%beg - 1:x_output_idx%end), y%cb(y_output_idx%beg - 1:y_output_idx%end), & + & z%cb(z_output_idx%beg - 1:z_output_idx%end) else - write (dbfile) x_cb, y_cb, z_cb + write (dbfile) x%cb, y%cb, z%cb end if end if else if (n > 0) then if (precision == 1) then - write (dbfile) real(x_cb, sp), real(y_cb, sp) + write (dbfile) real(x%cb, sp), real(y%cb, sp) else if (output_partial_domain) then - write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end), y_cb(y_output_idx%beg - 1:y_output_idx%end) + write (dbfile) x%cb(x_output_idx%beg - 1:x_output_idx%end), y%cb(y_output_idx%beg - 1:y_output_idx%end) else - write (dbfile) x_cb, y_cb + write (dbfile) x%cb, y%cb end if end if @@ -543,19 +543,19 @@ contains ! is put together by the root process and written to the master file. else if (precision == 1) then - write (dbfile) real(x_cb, sp) + write (dbfile) real(x%cb, sp) else if (output_partial_domain) then - write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end) + write (dbfile) x%cb(x_output_idx%beg - 1:x_output_idx%end) else - write (dbfile) x_cb + write (dbfile) x%cb end if end if if (num_procs > 1) then call s_mpi_defragment_1d_grid_variable() else - x_root_cb(:) = x_cb(:) + x_root_cb(:) = x%cb(:) end if if (proc_rank == 0) then @@ -1189,7 +1189,7 @@ contains call s_mpi_allreduce_max(maxalph_loc, maxalph_glb) if (p > 0) then do l = 0, p - if (z_cc(l) < dz(l) .and. z_cc(l) > 0) then + if (z%cc(l) < z%spacing(l) .and. z%cc(l) > 0) then cent = l end if end do @@ -1208,18 +1208,18 @@ contains & .or. (ayp < thres .and. aym > thres)) then if (counter == 0) then counter = counter + 1 - x_d1(counter) = x_cc(j) - y_d1(counter) = y_cc(k) + x_d1(counter) = x%cc(j) + y_d1(counter) = y%cc(k) else - tgp = sqrt(dx(j)**2 + dy(k)**2) + tgp = sqrt(x%spacing(j)**2 + y%spacing(k)**2) do i = 1, counter - euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2) + euc_d = sqrt((x%cc(j) - x_d1(i))**2 + (y%cc(k) - y_d1(i))**2) if (euc_d < tgp) then exit else if (i == counter) then counter = counter + 1 - x_d1(counter) = x_cc(j) - y_d1(counter) = y_cc(k) + x_d1(counter) = x%cc(j) + y_d1(counter) = y%cc(k) end if end do end if @@ -1278,7 +1278,7 @@ contains do j = 0, n do i = 0, m pres = 0._wp - dV = dx(i)*dy(j)*dz(k) + dV = x%spacing(i)*y%spacing(j)*z%spacing(k) rho = 0._wp gamma = 0._wp pi_inf = 0._wp diff --git a/src/post_process/m_derived_variables.fpp b/src/post_process/m_derived_variables.fpp index 9676e44396..a22c7bbdfc 100644 --- a/src/post_process/m_derived_variables.fpp +++ b/src/post_process/m_derived_variables.fpp @@ -218,8 +218,8 @@ contains do r = -fd_number, fd_number if (grid_geometry == 3) then - q_sf(j, k, l) = q_sf(j, k, l) + 1._wp/y_cc(k)*(fd_coeff_y(r, & - & k)*y_cc(r + k)*q_prim_vf(eqn_idx%mom%end)%sf(j, r + k, l) - fd_coeff_z(r, & + q_sf(j, k, l) = q_sf(j, k, l) + 1._wp/y%cc(k)*(fd_coeff_y(r, & + & k)*y%cc(r + k)*q_prim_vf(eqn_idx%mom%end)%sf(j, r + k, l) - fd_coeff_z(r, & & l)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(j, k, r + l)) else q_sf(j, k, l) = q_sf(j, k, l) + fd_coeff_y(r, k)*q_prim_vf(eqn_idx%mom%end)%sf(j, r + k, & @@ -237,7 +237,7 @@ contains do r = -fd_number, fd_number if (grid_geometry == 3) then - q_sf(j, k, l) = q_sf(j, k, l) + fd_coeff_z(r, l)/y_cc(k)*q_prim_vf(eqn_idx%mom%beg)%sf(j, k, & + q_sf(j, k, l) = q_sf(j, k, l) + fd_coeff_z(r, l)/y%cc(k)*q_prim_vf(eqn_idx%mom%beg)%sf(j, k, & & r + l) - fd_coeff_x(r, j)*q_prim_vf(eqn_idx%mom%end)%sf(r + j, k, l) else q_sf(j, k, l) = q_sf(j, k, l) + fd_coeff_z(r, l)*q_prim_vf(eqn_idx%mom%beg)%sf(j, k, & @@ -284,13 +284,13 @@ contains do r = -fd_number, fd_number do jj = 1, 3 - ! d()/dx + ! d()/x%spacing q_jacobian_sf(jj, 1) = q_jacobian_sf(jj, 1) + fd_coeff_x(r, & & j)*q_prim_vf(eqn_idx%mom%beg + jj - 1)%sf(r + j, k, l) - ! d()/dy + ! d()/y%spacing q_jacobian_sf(jj, 2) = q_jacobian_sf(jj, 2) + fd_coeff_y(r, & & k)*q_prim_vf(eqn_idx%mom%beg + jj - 1)%sf(j, r + k, l) - ! d()/dz + ! d()/z%spacing q_jacobian_sf(jj, 3) = q_jacobian_sf(jj, 3) + fd_coeff_z(r, & & l)*q_prim_vf(eqn_idx%mom%beg + jj - 1)%sf(j, k, r + l) end do @@ -362,11 +362,11 @@ contains do r = -fd_number, fd_number do i = 1, 3 - ! d()/dx + ! d()/x%spacing vgt(i, 1) = vgt(i, 1) + fd_coeff_x(r, j)*q_prim_vf(eqn_idx%mom%beg + i - 1)%sf(r + j, k, l) - ! d()/dy + ! d()/y%spacing vgt(i, 2) = vgt(i, 2) + fd_coeff_y(r, k)*q_prim_vf(eqn_idx%mom%beg + i - 1)%sf(j, r + k, l) - ! d()/dz + ! d()/z%spacing vgt(i, 3) = vgt(i, 3) + fd_coeff_z(r, l)*q_prim_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, r + l) end do end do @@ -464,7 +464,7 @@ contains do i = -fd_number, fd_number if (grid_geometry == 3) then - drho_dz = drho_dz + fd_coeff_z(i, l)/y_cc(k)*rho_sf(j, k, i + l) + drho_dz = drho_dz + fd_coeff_z(i, l)/y%cc(k)*rho_sf(j, k, i + l) else drho_dz = drho_dz + fd_coeff_z(i, l)*rho_sf(j, k, i + l) end if diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 122fb73a86..1e19b61598 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -50,22 +50,13 @@ module m_global_parameters integer :: num_dims !< Number of spatial dimensions integer :: num_vels !< Number of velocity components (different from num_dims for mhd) - !> @name Cell-boundary locations in the x-, y- and z-coordinate directions + !> @name Cell-boundary (cb), cell-center (cc), and spacing arrays per direction !> @{ - real(wp), allocatable, dimension(:) :: x_cb, x_root_cb, y_cb, z_cb - !> @} - - !> @name Cell-center locations in the x-, y- and z-coordinate directions - !> @{ - real(wp), allocatable, dimension(:) :: x_cc, x_root_cc, y_cc, z_cc + type(grid_axis) :: x, y, z + real(wp), allocatable, dimension(:) :: x_root_cb, x_root_cc real(sp), allocatable, dimension(:) :: x_root_cc_s, x_cc_s !> @} - !> Cell-width distributions in the x-, y- and z-coordinate directions - !> @{ - real(wp), allocatable, dimension(:) :: dx, dy, dz - !> @} - integer :: buff_size !< Number of ghost cells for boundary condition storage integer :: t_step_start !< First time-step directory integer :: t_step_stop !< Last time-step directory @@ -819,20 +810,20 @@ contains allocate (x_cc_s(-buff_size:m + buff_size)) ! Allocating the grid variables in the x-coordinate direction - allocate (x_cb(-1 - offset_x%beg:m + offset_x%end)) - allocate (x_cc(-buff_size:m + buff_size)) - allocate (dx(-buff_size:m + buff_size)) + allocate (x%cb(-1 - offset_x%beg:m + offset_x%end)) + allocate (x%cc(-buff_size:m + buff_size)) + allocate (x%spacing(-buff_size:m + buff_size)) ! Allocating grid variables in the y- and z-coordinate directions if (n > 0) then - allocate (y_cb(-1 - offset_y%beg:n + offset_y%end)) - allocate (y_cc(-buff_size:n + buff_size)) - allocate (dy(-buff_size:n + buff_size)) + allocate (y%cb(-1 - offset_y%beg:n + offset_y%end)) + allocate (y%cc(-buff_size:n + buff_size)) + allocate (y%spacing(-buff_size:n + buff_size)) if (p > 0) then - allocate (z_cb(-1 - offset_z%beg:p + offset_z%end)) - allocate (z_cc(-buff_size:p + buff_size)) - allocate (dz(-buff_size:p + buff_size)) + allocate (z%cb(-1 - offset_z%beg:p + offset_z%end)) + allocate (z%cc(-buff_size:p + buff_size)) + allocate (z%spacing(-buff_size:p + buff_size)) end if ! Allocating the grid variables, only used for the 1D simulations, and containing the defragmented computational domain @@ -904,13 +895,13 @@ contains ! Deallocating the grid variables for the x-coordinate direction - deallocate (x_cc, x_cb, dx) + deallocate (x%cc, x%cb, x%spacing) ! Deallocating grid variables for the y- and z-coordinate directions if (n > 0) then - deallocate (y_cc, y_cb, dy) + deallocate (y%cc, y%cb, y%spacing) if (p > 0) then - deallocate (z_cc, z_cb, dz) + deallocate (z%cc, z%cb, z%spacing) end if else ! Deallocating the grid variables, only used for the 1D simulations, and containing the defragmented computational diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index b9288d58b0..ab32967cc2 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -156,77 +156,77 @@ contains if (p > 0) then if (grid_geometry == 3) then ! Minimum spatial extent in the r-direction - call MPI_GATHERV(minval(y_cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(y%cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Minimum spatial extent in the theta-direction - call MPI_GATHERV(minval(z_cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(z%cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Minimum spatial extent in the z-direction - call MPI_GATHERV(minval(x_cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(x%cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the r-direction - call MPI_GATHERV(maxval(y_cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(y%cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the theta-direction - call MPI_GATHERV(maxval(z_cb), 1, mpi_p, spatial_extents(5, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(z%cb), 1, mpi_p, spatial_extents(5, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the z-direction - call MPI_GATHERV(maxval(x_cb), 1, mpi_p, spatial_extents(6, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(x%cb), 1, mpi_p, spatial_extents(6, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) else ! Minimum spatial extent in the x-direction - call MPI_GATHERV(minval(x_cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(x%cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Minimum spatial extent in the y-direction - call MPI_GATHERV(minval(y_cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(y%cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Minimum spatial extent in the z-direction - call MPI_GATHERV(minval(z_cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(minval(z%cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the x-direction - call MPI_GATHERV(maxval(x_cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(x%cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the y-direction - call MPI_GATHERV(maxval(y_cb), 1, mpi_p, spatial_extents(5, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(y%cb), 1, mpi_p, spatial_extents(5, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) ! Maximum spatial extent in the z-direction - call MPI_GATHERV(maxval(z_cb), 1, mpi_p, spatial_extents(6, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & + call MPI_GATHERV(maxval(z%cb), 1, mpi_p, spatial_extents(6, 0), recvcounts, 6*displs, mpi_p, 0, MPI_COMM_WORLD, & & ierr) end if ! Simulation is 2D else if (n > 0) then ! Minimum spatial extent in the x-direction - call MPI_GATHERV(minval(x_cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(minval(x%cb), 1, mpi_p, spatial_extents(1, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) ! Minimum spatial extent in the y-direction - call MPI_GATHERV(minval(y_cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(minval(y%cb), 1, mpi_p, spatial_extents(2, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) ! Maximum spatial extent in the x-direction - call MPI_GATHERV(maxval(x_cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(maxval(x%cb), 1, mpi_p, spatial_extents(3, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) ! Maximum spatial extent in the y-direction - call MPI_GATHERV(maxval(y_cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(maxval(y%cb), 1, mpi_p, spatial_extents(4, 0), recvcounts, 4*displs, mpi_p, 0, MPI_COMM_WORLD, ierr) ! Simulation is 1D else ! For 1D, recvcounts/displs are sized for grid defragmentation (m+1 per rank), not for scalar gathers. Use MPI_GATHER ! instead. ! Minimum spatial extent in the x-direction - call MPI_GATHER(minval(x_cb), 1, mpi_p, ext_temp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHER(minval(x%cb), 1, mpi_p, ext_temp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) if (proc_rank == 0) spatial_extents(1,:) = ext_temp ! Maximum spatial extent in the x-direction - call MPI_GATHER(maxval(x_cb), 1, mpi_p, ext_temp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHER(maxval(x%cb), 1, mpi_p, ext_temp, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) if (proc_rank == 0) spatial_extents(2,:) = ext_temp end if #endif @@ -242,13 +242,13 @@ contains ! Silo-HDF5 database format if (format == 1) then - call MPI_GATHERV(x_cc(0), m + 1, mpi_p, x_root_cc(0), recvcounts, displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(x%cc(0), m + 1, mpi_p, x_root_cc(0), recvcounts, displs, mpi_p, 0, MPI_COMM_WORLD, ierr) ! Binary database format else - call MPI_GATHERV(x_cb(0), m + 1, mpi_p, x_root_cb(0), recvcounts, displs, mpi_p, 0, MPI_COMM_WORLD, ierr) + call MPI_GATHERV(x%cb(0), m + 1, mpi_p, x_root_cb(0), recvcounts, displs, mpi_p, 0, MPI_COMM_WORLD, ierr) - if (proc_rank == 0) x_root_cb(-1) = x_cb(-1) + if (proc_rank == 0) x_root_cb(-1) = x%cb(-1) end if #endif diff --git a/src/post_process/m_start_up.fpp b/src/post_process/m_start_up.fpp index ce51702f93..8f18e621c0 100644 --- a/src/post_process/m_start_up.fpp +++ b/src/post_process/m_start_up.fpp @@ -224,15 +224,15 @@ contains call s_write_grid_to_formatted_database_file(t_step) if (omega_wrt(2) .or. omega_wrt(3) .or. qm_wrt .or. liutex_wrt .or. schlieren_wrt) then - call s_compute_finite_difference_coefficients(m, x_cc, fd_coeff_x, buff_size, fd_number, fd_order, offset_x) + call s_compute_finite_difference_coefficients(m, x%cc, fd_coeff_x, buff_size, fd_number, fd_order, offset_x) end if if (omega_wrt(1) .or. omega_wrt(3) .or. qm_wrt .or. liutex_wrt .or. (n > 0 .and. schlieren_wrt)) then - call s_compute_finite_difference_coefficients(n, y_cc, fd_coeff_y, buff_size, fd_number, fd_order, offset_y) + call s_compute_finite_difference_coefficients(n, y%cc, fd_coeff_y, buff_size, fd_number, fd_order, offset_y) end if if (omega_wrt(1) .or. omega_wrt(2) .or. qm_wrt .or. liutex_wrt .or. (p > 0 .and. schlieren_wrt)) then - call s_compute_finite_difference_coefficients(p, z_cc, fd_coeff_z, buff_size, fd_number, fd_order, offset_z) + call s_compute_finite_difference_coefficients(p, z%cc, fd_coeff_z, buff_size, fd_number, fd_order, offset_z) end if if ((model_eqns == 2) .or. (model_eqns == 3) .or. (model_eqns == 4)) then diff --git a/src/pre_process/m_assign_variables.fpp b/src/pre_process/m_assign_variables.fpp index 667e360079..67b7497187 100644 --- a/src/pre_process/m_assign_variables.fpp +++ b/src/pre_process/m_assign_variables.fpp @@ -97,15 +97,15 @@ contains do i = 1, eqn_idx%E - eqn_idx%mom%beg q_prim_vf(i + 1)%sf(j, k, l) = 1._wp/q_prim_vf(1)%sf(j, k, & - & l)*(eta*patch_icpp(patch_id)%rho*patch_icpp(patch_id)%vel(i) + (1._wp - eta) & - & *patch_icpp(smooth_patch_id)%rho*patch_icpp(smooth_patch_id)%vel(i)) + & l)*(eta*patch_icpp(patch_id)%rho*patch_icpp(patch_id)%vel(i) + (1._wp - eta)*patch_icpp(smooth_patch_id) & + & %rho*patch_icpp(smooth_patch_id)%vel(i)) end do q_prim_vf(eqn_idx%gamma)%sf(j, k, l) = eta*patch_icpp(patch_id)%gamma + (1._wp - eta)*patch_icpp(smooth_patch_id)%gamma q_prim_vf(eqn_idx%E)%sf(j, k, l) = 1._wp/q_prim_vf(eqn_idx%gamma)%sf(j, k, & - & l)*(eta*patch_icpp(patch_id)%gamma*patch_icpp(patch_id)%pres + (1._wp - eta) & - & *patch_icpp(smooth_patch_id)%gamma*patch_icpp(smooth_patch_id)%pres) + & l)*(eta*patch_icpp(patch_id)%gamma*patch_icpp(patch_id)%pres + (1._wp - eta)*patch_icpp(smooth_patch_id) & + & %gamma*patch_icpp(smooth_patch_id)%pres) q_prim_vf(eqn_idx%pi_inf)%sf(j, k, l) = eta*patch_icpp(patch_id)%pi_inf + (1._wp - eta)*patch_icpp(smooth_patch_id)%pi_inf @@ -384,18 +384,18 @@ contains if (hyperelasticity) then if (pre_stress) then ! pre stressed initial condition in spatial domain - rcoord = sqrt((x_cc(j)**2 + y_cc(k)**2 + z_cc(l)**2)) - theta = atan2(y_cc(k), x_cc(j)) - phi = atan2(sqrt(x_cc(j)**2 + y_cc(k)**2), z_cc(l)) + rcoord = sqrt((x%cc(j)**2 + y%cc(k)**2 + z%cc(l)**2)) + theta = atan2(y%cc(k), x%cc(j)) + phi = atan2(sqrt(x%cc(j)**2 + y%cc(k)**2), z%cc(l)) ! spherical coord, assuming Rmax=1 xi_sph = (rcoord**3 - R0ref**3 + 1._wp)**(1._wp/3._wp) xi_cart(1) = xi_sph*sin(phi)*cos(theta) xi_cart(2) = xi_sph*sin(phi)*sin(theta) xi_cart(3) = xi_sph*cos(phi) else - xi_cart(1) = x_cc(j) - xi_cart(2) = y_cc(k) - xi_cart(3) = z_cc(l) + xi_cart(1) = x%cc(j) + xi_cart(2) = y%cc(k) + xi_cart(3) = z%cc(l) end if ! assigning the reference map to the q_prim vector field @@ -464,7 +464,7 @@ contains ! Set streamwise velocity to hyperbolic tangent function of y if (mixlayer_vel_profile) then q_prim_vf(1 + eqn_idx%cont%end)%sf(j, k, & - & l) = (eta*patch_icpp(patch_id)%vel(1)*tanh(y_cc(k)*mixlayer_vel_coef) + (1._wp - eta)*orig_prim_vf(1 & + & l) = (eta*patch_icpp(patch_id)%vel(1)*tanh(y%cc(k)*mixlayer_vel_coef) + (1._wp - eta)*orig_prim_vf(1 & & + eqn_idx%cont%end)) end if diff --git a/src/pre_process/m_boundary_conditions.fpp b/src/pre_process/m_boundary_conditions.fpp index 70c3485a12..b1352c2319 100644 --- a/src/pre_process/m_boundary_conditions.fpp +++ b/src/pre_process/m_boundary_conditions.fpp @@ -43,7 +43,7 @@ contains #:for BOUND, X, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'm+i', 1, 2)] if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then do j = 0, n - if (y_cc(j) > y_boundary%beg .and. y_cc(j) < y_boundary%end) then + if (y%cc(j) > y_boundary%beg .and. y%cc(j) < y_boundary%end) then bc_type(1, ${IDX}$)%sf(0, j, 0) = patch_bc(patch_id)%type end if end do @@ -63,7 +63,7 @@ contains #:for BOUND, Y, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'n+i', 1, 2)] if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then do j = 0, m - if (x_cc(j) > x_boundary%beg .and. x_cc(j) < x_boundary%end) then + if (x%cc(j) > x_boundary%beg .and. x%cc(j) < x_boundary%end) then bc_type(2, ${IDX}$)%sf(j, 0, 0) = patch_bc(patch_id)%type end if end do @@ -89,7 +89,7 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then do k = 0, p do j = 0, n - if ((z_cc(k) - z_centroid)**2._wp + (y_cc(j) - y_centroid)**2._wp <= radius**2._wp) then + if ((z%cc(k) - z_centroid)**2._wp + (y%cc(j) - y_centroid)**2._wp <= radius**2._wp) then bc_type(1, ${IDX}$)%sf(0, j, k) = patch_bc(patch_id)%type end if end do @@ -106,7 +106,7 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then do k = 0, p do j = 0, m - if ((z_cc(k) - z_centroid)**2._wp + (x_cc(j) - x_centroid)**2._wp <= radius**2._wp) then + if ((z%cc(k) - z_centroid)**2._wp + (x%cc(j) - x_centroid)**2._wp <= radius**2._wp) then bc_type(2, ${IDX}$)%sf(j, 0, k) = patch_bc(patch_id)%type end if end do @@ -122,7 +122,7 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_z%${BOUND}$ < 0) then do k = 0, n do j = 0, m - if ((y_cc(k) - y_centroid)**2._wp + (x_cc(j) - x_centroid)**2._wp <= radius**2._wp) then + if ((y%cc(k) - y_centroid)**2._wp + (x%cc(j) - x_centroid)**2._wp <= radius**2._wp) then bc_type(3, ${IDX}$)%sf(j, k, 0) = patch_bc(patch_id)%type end if end do @@ -156,8 +156,8 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then do k = 0, p do j = 0, n - if (y_boundary%beg <= y_cc(j) .and. y_boundary%end >= y_cc(j) .and. z_boundary%beg <= z_cc(k) & - & .and. z_boundary%end >= z_cc(k)) then + if (y_boundary%beg <= y%cc(j) .and. y_boundary%end >= y%cc(j) .and. z_boundary%beg <= z%cc(k) & + & .and. z_boundary%end >= z%cc(k)) then bc_type(1, ${IDX}$)%sf(0, j, k) = patch_bc(patch_id)%type end if end do @@ -181,8 +181,8 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then do k = 0, p do j = 0, m - if (x_boundary%beg <= x_cc(j) .and. x_boundary%end >= x_cc(j) .and. z_boundary%beg <= z_cc(k) & - & .and. z_boundary%end >= z_cc(k)) then + if (x_boundary%beg <= x%cc(j) .and. x_boundary%end >= x%cc(j) .and. z_boundary%beg <= z%cc(k) & + & .and. z_boundary%end >= z%cc(k)) then bc_type(2, ${IDX}$)%sf(j, 0, k) = patch_bc(patch_id)%type end if end do @@ -205,8 +205,8 @@ contains if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_z%${BOUND}$ < 0) then do k = 0, n do j = 0, m - if (x_boundary%beg <= x_cc(j) .and. x_boundary%end >= x_cc(j) .and. y_boundary%beg <= y_cc(k) & - & .and. y_boundary%end >= y_cc(k)) then + if (x_boundary%beg <= x%cc(j) .and. x_boundary%end >= x%cc(j) .and. y_boundary%beg <= y%cc(k) & + & .and. y_boundary%end >= y%cc(k)) then bc_type(3, ${IDX}$)%sf(j, k, 0) = patch_bc(patch_id)%type end if end do diff --git a/src/pre_process/m_data_output.fpp b/src/pre_process/m_data_output.fpp index e8583242ad..63b718fb25 100644 --- a/src/pre_process/m_data_output.fpp +++ b/src/pre_process/m_data_output.fpp @@ -94,19 +94,19 @@ contains file_loc = trim(t_step_dir) // '/x_cb.dat' open (1, FILE=trim(file_loc), form='unformatted', STATUS=status) - write (1) x_cb(-1:m) + write (1) x%cb(-1:m) close (1) if (n > 0) then file_loc = trim(t_step_dir) // '/y_cb.dat' open (1, FILE=trim(file_loc), form='unformatted', STATUS=status) - write (1) y_cb(-1:n) + write (1) y%cb(-1:n) close (1) if (p > 0) then file_loc = trim(t_step_dir) // '/z_cb.dat' open (1, FILE=trim(file_loc), form='unformatted', STATUS=status) - write (1) z_cb(-1:p) + write (1) z%cb(-1:p) close (1) end if end if @@ -179,15 +179,15 @@ contains lit_gamma = 1._wp/gamma + 1._wp if ((i >= eqn_idx%species%beg) .and. (i <= eqn_idx%species%end)) then - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0)/rho else if (((i >= eqn_idx%cont%beg) .and. (i <= eqn_idx%cont%end)) .or. ((i >= eqn_idx%adv%beg) & & .and. (i <= eqn_idx%adv%end)) .or. ((i >= eqn_idx%species%beg) .and. (i <= eqn_idx%species%end) & & )) then - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) else if (i == eqn_idx%mom%beg) then ! u - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%mom%beg)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%mom%beg)%sf(j, 0, 0)/rho else if (i == eqn_idx%stress%beg) then ! tau_e - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%stress%beg)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%stress%beg)%sf(j, 0, 0)/rho else if (i == eqn_idx%E) then ! p if (mhd) then pres_mag = 0.5_wp*(Bx0**2 + q_cons_vf(eqn_idx%B%beg)%sf(j, 0, & @@ -197,16 +197,16 @@ contains call s_compute_pressure(q_cons_vf(eqn_idx%E)%sf(j, 0, 0), q_cons_vf(eqn_idx%alf)%sf(j, 0, 0), & & 0.5_wp*(q_cons_vf(eqn_idx%mom%beg)%sf(j, 0, 0)**2._wp)/rho, pi_inf, gamma, & & rho, qv, rhoYks, pres, T, pres_mag=pres_mag) - write (2, FMT) x_cb(j), pres + write (2, FMT) x%cb(j), pres else if (mhd) then if (i == eqn_idx%mom%beg + 1) then ! v - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%mom%beg + 1)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%mom%beg + 1)%sf(j, 0, 0)/rho else if (i == eqn_idx%mom%beg + 2) then ! w - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%mom%beg + 2)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%mom%beg + 2)%sf(j, 0, 0)/rho else if (i == eqn_idx%B%beg) then ! By - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%B%beg)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%B%beg)%sf(j, 0, 0)/rho else if (i == eqn_idx%B%beg + 1) then ! Bz - write (2, FMT) x_cb(j), q_cons_vf(eqn_idx%B%beg + 1)%sf(j, 0, 0)/rho + write (2, FMT) x%cb(j), q_cons_vf(eqn_idx%B%beg + 1)%sf(j, 0, 0)/rho end if else if ((i >= eqn_idx%bub%beg) .and. (i <= eqn_idx%bub%end) .and. bubbles_euler) then if (qbmm) then @@ -222,11 +222,11 @@ contains call s_comp_n_from_cons(real(q_cons_vf(eqn_idx%alf)%sf(j, 0, 0), kind=wp), nRtmp, nbub, weight) end if end if - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0)/nbub + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0)/nbub else if (i == eqn_idx%n .and. adv_n .and. bubbles_euler) then - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) else if (i == eqn_idx%damage) then - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) end if end do close (2) @@ -238,7 +238,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) end do close (2) end do @@ -251,7 +251,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m - write (2, FMT) x_cb(j), pb%sf(j, 0, 0, r, i) + write (2, FMT) x%cb(j), pb%sf(j, 0, 0, r, i) end do close (2) end do @@ -263,7 +263,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m - write (2, FMT) x_cb(j), mv%sf(j, 0, 0, r, i) + write (2, FMT) x%cb(j), mv%sf(j, 0, 0, r, i) end do close (2) end do @@ -283,7 +283,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), q_cons_vf(i)%sf(j, k, 0) + write (2, FMT) x%cb(j), y%cb(k), q_cons_vf(i)%sf(j, k, 0) end do write (2, *) end do @@ -299,7 +299,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), pb%sf(j, k, 0, r, i) + write (2, FMT) x%cb(j), y%cb(k), pb%sf(j, k, 0, r, i) end do end do close (2) @@ -313,7 +313,7 @@ contains open (2, FILE=trim(file_loc)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), mv%sf(j, k, 0, r, i) + write (2, FMT) x%cb(j), y%cb(k), mv%sf(j, k, 0, r, i) end do end do close (2) @@ -335,7 +335,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), q_cons_vf(i)%sf(j, k, l) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), q_cons_vf(i)%sf(j, k, l) end do write (2, *) end do @@ -354,7 +354,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), pb%sf(j, k, l, r, i) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), pb%sf(j, k, l, r, i) end do end do end do @@ -370,7 +370,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), mv%sf(j, k, l, r, i) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), mv%sf(j, k, l, r, i) end do end do end do diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index e93d4c3122..d4ee7d690b 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -41,13 +41,11 @@ module m_global_parameters integer :: num_vels !< Number of velocity components (different from num_dims for mhd) logical :: cyl_coord integer :: grid_geometry !< Cylindrical coordinates (either axisymmetric or full 3D) - !> Locations of cell-centers (cc) in x-, y- and z-directions, respectively - real(wp), allocatable, dimension(:) :: x_cc, y_cc, z_cc - !> Locations of cell-boundaries (cb) in x-, y- and z-directions, respectively - real(wp), allocatable, dimension(:) :: x_cb, y_cb, z_cb - real(wp) :: dx, dy, dz !< Minimum cell-widths in the x-, y- and z-coordinate directions + !> Cell-boundary (cb) and cell-center (cc) arrays per direction + type(grid_axis) :: x, y, z + real(wp) :: dx, dy, dz !< Minimum cell-widths in the x-, y- and z-coordinate directions type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions - logical :: stretch_x, stretch_y, stretch_z !< Grid stretching flags for the x-, y- and z-coordinate directions + logical :: stretch_x, stretch_y, stretch_z !< Grid stretching flags for the x-, y- and z-coordinate directions ! Grid stretching: a_x/a_y/a_z = rate, x_a/y_a/z_a = location real(wp) :: a_x, a_y, a_z integer :: loops_x, loops_y, loops_z @@ -810,12 +808,12 @@ contains #endif ! Allocating grid variables for the x-direction - allocate (x_cc(0:m), x_cb(-1:m)) + allocate (x%cc(0:m), x%cb(-1:m)) ! Allocating grid variables for the y- and z-directions if (n > 0) then - allocate (y_cc(0:n), y_cb(-1:n)) + allocate (y%cc(0:n), y%cb(-1:n)) if (p > 0) then - allocate (z_cc(0:p), z_cb(-1:p)) + allocate (z%cc(0:p), z%cb(-1:p)) end if end if @@ -879,12 +877,12 @@ contains ! Deallocating grid variables for the x-direction - deallocate (x_cc, x_cb) + deallocate (x%cc, x%cb) ! Deallocating grid variables for the y- and z-directions if (n > 0) then - deallocate (y_cc, y_cb) + deallocate (y%cc, y%cb) if (p > 0) then - deallocate (z_cc, z_cb) + deallocate (z%cc, z%cb) end if end if diff --git a/src/pre_process/m_grid.f90 b/src/pre_process/m_grid.f90 index 77cb02cef2..ce8d9b279b 100644 --- a/src/pre_process/m_grid.f90 +++ b/src/pre_process/m_grid.f90 @@ -41,31 +41,31 @@ impure subroutine s_generate_serial_grid dx = (x_domain%end - x_domain%beg)/real(m + 1, wp) do i = 0, m - x_cc(i) = x_domain%beg + 5.e-1_wp*dx*real(2*i + 1, wp) - x_cb(i - 1) = x_domain%beg + dx*real(i, wp) + x%cc(i) = x_domain%beg + 5.e-1_wp*dx*real(2*i + 1, wp) + x%cb(i - 1) = x_domain%beg + dx*real(i, wp) end do - x_cb(m) = x_domain%end + x%cb(m) = x_domain%end ! Hyperbolic tangent grid stretching if (stretch_x) then - length = abs(x_cb(m) - x_cb(-1)) - x_cb = x_cb/length + length = abs(x%cb(m) - x%cb(-1)) + x%cb = x%cb/length x_a = x_a/length x_b = x_b/length do j = 1, loops_x do i = -1, m - x_cb(i) = x_cb(i)/a_x*(a_x + log(cosh(a_x*(x_cb(i) - x_a))) + log(cosh(a_x*(x_cb(i) - x_b))) & + x%cb(i) = x%cb(i)/a_x*(a_x + log(cosh(a_x*(x%cb(i) - x_a))) + log(cosh(a_x*(x%cb(i) - x_b))) & & - 2._wp*log(cosh(a_x*(x_b - x_a)/2._wp))) end do end do - x_cb = x_cb*length + x%cb = x%cb*length - x_cc(0:m) = (x_cb(0:m) + x_cb(-1:m - 1))/2._wp + x%cc(0:m) = (x%cb(0:m) + x%cb(-1:m - 1))/2._wp - dx = minval(x_cb(0:m) - x_cb(-1:m - 1)) - print *, 'Stretched grid: min/max x grid: ', minval(x_cc(:)), maxval(x_cc(:)) + dx = minval(x%cb(0:m) - x%cb(-1:m - 1)) + print *, 'Stretched grid: min/max x grid: ', minval(x%cc(:)), maxval(x%cc(:)) if (num_procs > 1) call s_mpi_reduce_min(dx) end if @@ -76,42 +76,42 @@ impure subroutine s_generate_serial_grid if (grid_geometry == 2 .and. f_approx_equal(y_domain%beg, 0.0_wp)) then dy = (y_domain%end - y_domain%beg)/real(2*n + 1, wp) - y_cc(0) = y_domain%beg + 5.e-1_wp*dy - y_cb(-1) = y_domain%beg + y%cc(0) = y_domain%beg + 5.e-1_wp*dy + y%cb(-1) = y_domain%beg do i = 1, n - y_cc(i) = y_domain%beg + 2._wp*dy*real(i, wp) - y_cb(i - 1) = y_domain%beg + dy*real(2*i - 1, wp) + y%cc(i) = y_domain%beg + 2._wp*dy*real(i, wp) + y%cb(i - 1) = y_domain%beg + dy*real(2*i - 1, wp) end do else dy = (y_domain%end - y_domain%beg)/real(n + 1, wp) do i = 0, n - y_cc(i) = y_domain%beg + 5.e-1_wp*dy*real(2*i + 1, wp) - y_cb(i - 1) = y_domain%beg + dy*real(i, wp) + y%cc(i) = y_domain%beg + 5.e-1_wp*dy*real(2*i + 1, wp) + y%cb(i - 1) = y_domain%beg + dy*real(i, wp) end do end if - y_cb(n) = y_domain%end + y%cb(n) = y_domain%end ! Hyperbolic tangent grid stretching in y-direction if (stretch_y) then - length = abs(y_cb(n) - y_cb(-1)) - y_cb = y_cb/length + length = abs(y%cb(n) - y%cb(-1)) + y%cb = y%cb/length y_a = y_a/length y_b = y_b/length do j = 1, loops_y do i = -1, n - y_cb(i) = y_cb(i)/a_y*(a_y + log(cosh(a_y*(y_cb(i) - y_a))) + log(cosh(a_y*(y_cb(i) - y_b))) & + y%cb(i) = y%cb(i)/a_y*(a_y + log(cosh(a_y*(y%cb(i) - y_a))) + log(cosh(a_y*(y%cb(i) - y_b))) & & - 2._wp*log(cosh(a_y*(y_b - y_a)/2._wp))) end do end do - y_cb = y_cb*length - y_cc(0:n) = (y_cb(0:n) + y_cb(-1:n - 1))/2._wp + y%cb = y%cb*length + y%cc(0:n) = (y%cb(0:n) + y%cb(-1:n - 1))/2._wp - dy = minval(y_cb(0:n) - y_cb(-1:n - 1)) + dy = minval(y%cb(0:n) - y%cb(-1:n - 1)) if (num_procs > 1) call s_mpi_reduce_min(dy) end if @@ -122,30 +122,30 @@ impure subroutine s_generate_serial_grid dz = (z_domain%end - z_domain%beg)/real(p + 1, wp) do i = 0, p - z_cc(i) = z_domain%beg + 5.e-1_wp*dz*real(2*i + 1, wp) - z_cb(i - 1) = z_domain%beg + dz*real(i, wp) + z%cc(i) = z_domain%beg + 5.e-1_wp*dz*real(2*i + 1, wp) + z%cb(i - 1) = z_domain%beg + dz*real(i, wp) end do - z_cb(p) = z_domain%end + z%cb(p) = z_domain%end ! Hyperbolic tangent grid stretching in z-direction if (stretch_z) then - length = abs(z_cb(p) - z_cb(-1)) - z_cb = z_cb/length + length = abs(z%cb(p) - z%cb(-1)) + z%cb = z%cb/length z_a = z_a/length z_b = z_b/length do j = 1, loops_z do i = -1, p - z_cb(i) = z_cb(i)/a_z*(a_z + log(cosh(a_z*(z_cb(i) - z_a))) + log(cosh(a_z*(z_cb(i) - z_b))) & + z%cb(i) = z%cb(i)/a_z*(a_z + log(cosh(a_z*(z%cb(i) - z_a))) + log(cosh(a_z*(z%cb(i) - z_b))) & & - 2._wp*log(cosh(a_z*(z_b - z_a)/2._wp))) end do end do - z_cb = z_cb*length - z_cc(0:p) = (z_cb(0:p) + z_cb(-1:p - 1))/2._wp + z%cb = z%cb*length + z%cc(0:p) = (z%cb(0:p) + z%cb(-1:p - 1))/2._wp - dz = minval(z_cb(0:p) - z_cb(-1:p - 1)) + dz = minval(z%cb(0:p) - z%cb(-1:p - 1)) if (num_procs > 1) call s_mpi_reduce_min(dz) end if diff --git a/src/pre_process/m_icpp_patches.fpp b/src/pre_process/m_icpp_patches.fpp index 42e9332c53..2e6c12b8f7 100644 --- a/src/pre_process/m_icpp_patches.fpp +++ b/src/pre_process/m_icpp_patches.fpp @@ -193,7 +193,7 @@ contains ! Assign patch vars if cell is covered and patch has write permission do i = 0, m - if (x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, & + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, & & 0, 0))) then call s_assign_patch_primitive_variables(patch_id, i, 0, 0, eta, q_prim_vf, patch_id_fp) @@ -250,7 +250,7 @@ contains spiral_y_max = maxval((/f_r(th, 0.0_wp, mya)*sin(th), f_r(th, thickness, mya)*sin(th)/)) do j = 0, n; do i = 0, m - if ((x_cc(i) > spiral_x_min) .and. (x_cc(i) < spiral_x_max) .and. (y_cc(j) > spiral_y_min) .and. (y_cc(j) & + if ((x%cc(i) > spiral_x_min) .and. (x%cc(i) < spiral_x_max) .and. (y%cc(j) > spiral_y_min) .and. (y%cc(j) & & < spiral_y_max)) then logic_grid(i, j, 0) = 1 end if @@ -313,12 +313,11 @@ contains if (patch_icpp(patch_id)%smoothen) then ! Smooth Heaviside via hyperbolic tangent; smooth_coeff controls interface sharpness eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt((x_cc(i) - x_centroid)**2 + (y_cc(j) - y_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp + & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp end if - if (((x_cc(i) - x_centroid)**2 + (y_cc(j) - y_centroid)**2 <= radius**2 & - & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, & - & 0) == smooth_patch_id) then + if (((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2 <= radius**2 .and. patch_icpp(patch_id) & + & %alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, 0) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -366,10 +365,10 @@ contains ! Assign patch vars if cell is covered and patch has write permission do j = 0, n do i = 0, m - myr = sqrt((x_cc(i) - x_centroid)**2 + (y_cc(j) - y_centroid)**2) + myr = sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp & - & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then + if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp .and. patch_icpp(patch_id) & + & %alter_patch(patch_id_fp(i, j, 0))) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -428,10 +427,10 @@ contains do k = 0, p do j = 0, n do i = 0, m - myr = sqrt((x_cc(i) - x_centroid)**2 + (y_cc(j) - y_centroid)**2) + myr = sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp & - & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) then + if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp .and. patch_icpp(patch_id) & + & %alter_patch(patch_id_fp(i, j, k))) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -486,13 +485,12 @@ contains do i = 0, m if (patch_icpp(patch_id)%smoothen) then eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt(((x_cc(i) - x_centroid)/a)**2 + ((y_cc(j) - y_centroid)/b)**2) - 1._wp))*(-0.5_wp) & + & dy)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2) - 1._wp))*(-0.5_wp) & & + 0.5_wp end if - if ((((x_cc(i) - x_centroid)/a)**2 + ((y_cc(j) - y_centroid)/b)**2 <= 1._wp & - & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, & - & 0) == smooth_patch_id) then + if ((((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2 <= 1._wp .and. patch_icpp(patch_id) & + & %alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, 0) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -548,20 +546,20 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) else - cart_y = y_cc(j) - cart_z = z_cc(k) + cart_y = y%cc(j) + cart_z = z%cc(k) end if if (patch_icpp(patch_id)%smoothen) then eta = tanh(smooth_coeff/min(dx, dy, & - & dz)*(sqrt(((x_cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z & + & dz)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z & & - z_centroid)/c)**2) - 1._wp))*(-0.5_wp) + 0.5_wp end if - if ((((x_cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z - z_centroid)/c)**2 <= 1._wp & - & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & + if ((((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z - z_centroid)/c) & + & **2 <= 1._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -622,8 +620,8 @@ contains ! Assign patch vars if cell is covered and patch has write permission do j = 0, n do i = 0, m - if (x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i) .and. y_boundary%beg <= y_cc(j) & - & .and. y_boundary%end >= y_cc(j)) then + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) .and. y_boundary%beg <= y%cc(j) & + & .and. y_boundary%end >= y%cc(j)) then if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @@ -636,8 +634,8 @@ contains if ((q_prim_vf(1)%sf(i, j, 0) < 1.e-10) .and. (model_eqns == 4)) then ! zero density, reassign according to Tait EOS q_prim_vf(1)%sf(i, j, 0) = (((q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))*rhoref*(1._wp & - & - q_prim_vf(eqn_idx%alf)%sf(i, j, 0)) + & 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))*rhoref*(1._wp - q_prim_vf(eqn_idx%alf) & + & %sf(i, j, 0)) end if ! Updating the patch identities bookkeeping variable @@ -688,10 +686,10 @@ contains do j = 0, n do i = 0, m if (patch_icpp(patch_id)%smoothen) then - eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(dx, dy)*(a*x_cc(i) + b*y_cc(j) + c)/sqrt(a**2 + b**2)) + eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(dx, dy)*(a*x%cc(i) + b*y%cc(j) + c)/sqrt(a**2 + b**2)) end if - if ((a*x_cc(i) + b*y_cc(j) + c >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & + if ((a*x%cc(i) + b*y%cc(j) + c >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & & 0))) .or. patch_id_fp(i, j, 0) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @@ -753,8 +751,8 @@ contains ! Assign patch vars if cell is covered and patch has write permission do j = 0, n do i = 0, m - if (x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i) .and. y_boundary%beg <= y_cc(j) & - & .and. y_boundary%end >= y_cc(j) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) .and. y_boundary%beg <= y%cc(j) & + & .and. y_boundary%end >= y%cc(j) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -766,10 +764,10 @@ contains if (1._wp - eta < sgm_eps) patch_id_fp(i, j, 0) = patch_id ! Assign Parameters - q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = U0*sin(x_cc(i)/L0)*cos(y_cc(j)/L0) - q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = -U0*cos(x_cc(i)/L0)*sin(y_cc(j)/L0) + q_prim_vf(eqn_idx%mom%beg)%sf(i, j, 0) = U0*sin(x%cc(i)/L0)*cos(y%cc(j)/L0) + q_prim_vf(eqn_idx%mom%end)%sf(i, j, 0) = -U0*cos(x%cc(i)/L0)*sin(y%cc(j)/L0) q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) = patch_icpp(patch_id)%pres + (cos(2*x_cc(i))/L0 + cos(2*y_cc(j))/L0)*(q_prim_vf(1)%sf(i, j, & + & 0) = patch_icpp(patch_id)%pres + (cos(2*x%cc(i))/L0 + cos(2*y%cc(j))/L0)*(q_prim_vf(1)%sf(i, j, & & 0)*U0*U0)/16 end if end do @@ -818,7 +816,7 @@ contains ! Assign patch vars if cell is covered and patch has write permission do i = 0, m - if (x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, & + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, & & 0, 0))) then call s_assign_patch_primitive_variables(patch_id, i, 0, 0, eta, q_prim_vf, patch_id_fp) @@ -857,11 +855,11 @@ contains do j = 0, n do i = 0, m - r = sqrt((x_cc(i) - x_centroid)**2 + (y_cc(j) - y_centroid)**2) + r = sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) if (r < small_radius) then theta = 0._wp else - theta = atan2(y_cc(j) - y_centroid, x_cc(i) - x_centroid) + theta = atan2(y%cc(j) - y_centroid, x%cc(i) - x_centroid) end if sum_series = 0._wp do nn = 1, max_2d_fourier_modes @@ -915,14 +913,14 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) - dx_loc = x_cc(i) - x_centroid + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) + dx_loc = x%cc(i) - x_centroid dy_loc = cart_y - y_centroid dz_loc = cart_z - z_centroid else - dx_loc = x_cc(i) - x_centroid - dy_loc = y_cc(j) - y_centroid - dz_loc = z_cc(k) - z_centroid + dx_loc = x%cc(i) - x_centroid + dy_loc = y%cc(j) - y_centroid + dz_loc = z%cc(k) - z_centroid end if r = sqrt(dx_loc**2 + dy_loc**2 + dz_loc**2) if (r < small_radius) then @@ -991,19 +989,19 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) else - cart_y = y_cc(j) - cart_z = z_cc(k) + cart_y = y%cc(j) + cart_z = z%cc(k) end if if (patch_icpp(patch_id)%smoothen) then eta = tanh(smooth_coeff/min(dx, dy, & - & dz)*(sqrt((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) & + & dz)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) & & - radius))*(-0.5_wp) + 0.5_wp end if - if ((((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2) & + if ((((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2) & & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -1063,14 +1061,14 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) else - cart_y = y_cc(j) - cart_z = z_cc(k) + cart_y = y%cc(j) + cart_z = z%cc(k) end if - if (x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i) .and. y_boundary%beg <= cart_y & - & .and. y_boundary%end >= cart_y .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) then + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) & + & .and. y_boundary%beg <= cart_y .and. y_boundary%end >= cart_y .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) then if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -1138,10 +1136,10 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) else - cart_y = y_cc(j) - cart_z = z_cc(k) + cart_y = y%cc(j) + cart_z = z%cc(k) end if if (patch_icpp(patch_id)%smoothen) then @@ -1151,20 +1149,21 @@ contains & + 0.5_wp else if (.not. f_is_default(length_y)) then eta = tanh(smooth_coeff/min(dx, & - & dz)*(sqrt((x_cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2) - radius))*(-0.5_wp) & + & dz)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2) - radius))*(-0.5_wp) & & + 0.5_wp else eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt((x_cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2) - radius))*(-0.5_wp) & + & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2) - radius))*(-0.5_wp) & & + 0.5_wp end if end if - if (((.not. f_is_default(length_x) .and. (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2 & - & .and. x_boundary%beg <= x_cc(i) .and. x_boundary%end >= x_cc(i)) .or. (.not. f_is_default(length_y) & - & .and. (x_cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2 .and. y_boundary%beg <= cart_y & - & .and. y_boundary%end >= cart_y) .or. (.not. f_is_default(length_z) .and. (x_cc(i) - x_centroid)**2 & - & + (cart_y - y_centroid)**2 <= radius**2 .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) & + if (((.not. f_is_default(length_x) .and. (cart_y - y_centroid)**2 + (cart_z - z_centroid) & + & **2 <= radius**2 .and. x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i)) & + & .or. (.not. f_is_default(length_y) .and. (x%cc(i) - x_centroid)**2 + (cart_z - z_centroid) & + & **2 <= radius**2 .and. y_boundary%beg <= cart_y .and. y_boundary%end >= cart_y) & + & .or. (.not. f_is_default(length_z) .and. (x%cc(i) - x_centroid)**2 + (cart_y - y_centroid) & + & **2 <= radius**2 .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) & & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -1225,18 +1224,18 @@ contains do j = 0, n do i = 0, m if (grid_geometry == 3) then - call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k)) + call s_convert_cylindrical_to_cartesian_coord(y%cc(j), z%cc(k)) else - cart_y = y_cc(j) - cart_z = z_cc(k) + cart_y = y%cc(j) + cart_z = z%cc(k) end if if (patch_icpp(patch_id)%smoothen) then eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(dx, dy, & - & dz)*(a*x_cc(i) + b*cart_y + c*cart_z + d)/sqrt(a**2 + b**2 + c**2)) + & dz)*(a*x%cc(i) + b*cart_y + c*cart_z + d)/sqrt(a**2 + b**2 + c**2)) end if - if ((a*x_cc(i) + b*cart_y + c*cart_z + d >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & + if ((a*x%cc(i) + b*cart_y + c*cart_z + d >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & & k))) .or. patch_id_fp(i, j, k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -1326,11 +1325,11 @@ contains write (*, "(A, 3(2X, F20.10))") " > Cen:", (bbox%min(1:3) + bbox%max(1:3))/2._wp write (*, "(A, 3(2X, F20.10))") " > Max:", bbox%max(1:3) - grid_mm(1,:) = (/minval(x_cc) - 0.e5_wp*dx, maxval(x_cc) + 0.e5_wp*dx/) - grid_mm(2,:) = (/minval(y_cc) - 0.e5_wp*dy, maxval(y_cc) + 0.e5_wp*dy/) + grid_mm(1,:) = (/minval(x%cc) - 0.e5_wp*dx, maxval(x%cc) + 0.e5_wp*dx/) + grid_mm(2,:) = (/minval(y%cc) - 0.e5_wp*dy, maxval(y%cc) + 0.e5_wp*dy/) if (p > 0) then - grid_mm(3,:) = (/minval(z_cc) - 0.e5_wp*dz, maxval(z_cc) + 0.e5_wp*dz/) + grid_mm(3,:) = (/minval(z%cc) - 0.e5_wp*dz, maxval(z%cc) + 0.e5_wp*dz/) else grid_mm(3,:) = (/0._wp, 0._wp/) end if @@ -1347,9 +1346,9 @@ contains write (*, "(A, I3, A)", advance="no") char(13) // " * Generating grid: ", nint(100*real(cell_num)/ncells), "%" end if - point = (/x_cc(i), y_cc(j), 0._wp/) + point = (/x%cc(i), y%cc(j), 0._wp/) if (p > 0) then - point(3) = z_cc(k) + point(3) = z%cc(k) end if if (grid_geometry == 3) then diff --git a/src/pre_process/m_perturbation.fpp b/src/pre_process/m_perturbation.fpp index 8472b47430..b1d473ce05 100644 --- a/src/pre_process/m_perturbation.fpp +++ b/src/pre_process/m_perturbation.fpp @@ -172,12 +172,12 @@ contains do l = 0, p do k = 0, n do j = 0, m - xl = freq*(x_cc(j) + ofs(i, 1)) - yl = freq*(y_cc(k) + ofs(i, 2)) + xl = freq*(x%cc(j) + ofs(i, 1)) + yl = freq*(y%cc(k) + ofs(i, 2)) if (num_dims == 2) then mag = f_simplex2d(xl, yl) else if (num_dims == 3) then - zl = freq*(z_cc(l) + ofs(i, 3)) + zl = freq*(z%cc(l) + ofs(i, 3)) mag = f_simplex3d(xl, yl, zl) end if @@ -210,12 +210,12 @@ contains do l = 0, p do k = 0, n do j = 0, m - xl = freq*(x_cc(j) + ofs(i, 1)) - yl = freq*(y_cc(k) + ofs(i, 2)) + xl = freq*(x%cc(j) + ofs(i, 1)) + yl = freq*(y%cc(k) + ofs(i, 2)) if (num_dims == 2) then mag = f_simplex2d(xl, yl) else if (num_dims == 3) then - zl = freq*(z_cc(l) + ofs(i, 3)) + zl = freq*(z%cc(l) + ofs(i, 3)) mag = f_simplex3d(xl, yl, zl) end if q_prim_vf(eqn_idx%cont%beg + i - 1)%sf(j, k, l) = q_prim_vf(eqn_idx%cont%beg + i - 1)%sf(j, k, & @@ -255,7 +255,7 @@ contains do r = 0, n ! Compute prescribed Reynolds stress tensor with about half magnitude of its self-similar value Rij(:,:) = 0._wp - uu0 = patch_icpp(1)%vel(1)**2._wp*(1._wp - tanh(y_cc(r)*mixlayer_vel_coef)**2._wp) + uu0 = patch_icpp(1)%vel(1)**2._wp*(1._wp - tanh(y%cc(r)*mixlayer_vel_coef)**2._wp) Rij(1, 1) = 0.05_wp*uu0 Rij(2, 2) = 0.03_wp*uu0 Rij(3, 3) = 0.03_wp*uu0 @@ -277,7 +277,7 @@ contains do i = 1, mixlayer_perturb_nk ! Generate random numbers for unit wavevector khat, random unit vector xi, and random mode phase phi if (proc_rank == 0) then - call s_generate_random_perturbation(khat, xi, phi, i, y_cc(r)) + call s_generate_random_perturbation(khat, xi, phi, i, y%cc(r)) end if #ifdef MFC_MPI @@ -295,7 +295,7 @@ contains do l = 0, p do j = 0, m q = sqrt(Ek(i)/Eksum) - alpha = k(i)*(khat(1)*x_cc(j) + khat(2)*y_cc(r) + khat(3)*z_cc(l)) + 2._wp*pi*phi + alpha = k(i)*(khat(1)*x%cc(j) + khat(2)*y%cc(r) + khat(3)*z%cc(l)) + 2._wp*pi*phi velfluc = 2._wp*q*sig*cos(alpha) velfluc = matmul(Lmat, velfluc) q_prim_vf(eqn_idx%mom%beg)%sf(j, r, l) = q_prim_vf(eqn_idx%mom%beg)%sf(j, r, l) + velfluc(1) diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index 25597baad7..593e71d60a 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -173,19 +173,19 @@ contains if (file_check) then open (1, FILE=trim(file_loc), form='unformatted', STATUS='old', ACTION='read') - read (1) x_cb(-1:m) + read (1) x%cb(-1:m) close (1) else call s_mpi_abort('File x_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.') end if - x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp + x%cc(0:m) = (x%cb(0:m) + x%cb(-1:(m - 1)))/2._wp - dx = minval(x_cb(0:m) - x_cb(-1:m - 1)) + dx = minval(x%cb(0:m) - x%cb(-1:m - 1)) if (num_procs > 1) call s_mpi_reduce_min(dx) - x_domain%beg = x_cb(-1) - x_domain%end = x_cb(m) + x_domain%beg = x%cb(-1) + x_domain%end = x%cb(m) if (n > 0) then file_loc = trim(t_step_dir) // '/y_cb.dat' @@ -193,19 +193,19 @@ contains if (file_check) then open (1, FILE=trim(file_loc), form='unformatted', STATUS='old', ACTION='read') - read (1) y_cb(-1:n) + read (1) y%cb(-1:n) close (1) else call s_mpi_abort('File y_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.') end if - y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp + y%cc(0:n) = (y%cb(0:n) + y%cb(-1:(n - 1)))/2._wp - dy = minval(y_cb(0:n) - y_cb(-1:n - 1)) + dy = minval(y%cb(0:n) - y%cb(-1:n - 1)) if (num_procs > 1) call s_mpi_reduce_min(dy) - y_domain%beg = y_cb(-1) - y_domain%end = y_cb(n) + y_domain%beg = y%cb(-1) + y_domain%end = y%cb(n) if (p > 0) then file_loc = trim(t_step_dir) // '/z_cb.dat' @@ -213,19 +213,19 @@ contains if (file_check) then open (1, FILE=trim(file_loc), form='unformatted', STATUS='old', ACTION='read') - read (1) z_cb(-1:p) + read (1) z%cb(-1:p) close (1) else call s_mpi_abort('File z_cb.dat is missing in ' // trim(t_step_dir) // '. Exiting.') end if - z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp + z%cc(0:p) = (z%cb(0:p) + z%cb(-1:(p - 1)))/2._wp - dz = minval(z_cb(0:p) - z_cb(-1:p - 1)) + dz = minval(z%cb(0:p) - z%cb(-1:p - 1)) if (num_procs > 1) call s_mpi_reduce_min(dz) - z_domain%beg = z_cb(-1) - z_domain%end = z_cb(p) + z_domain%beg = z%cb(-1) + z_domain%end = z%cb(p) end if end if @@ -241,17 +241,17 @@ contains !! coordinate directions and making sure that all of the cell-widths are positively valued impure subroutine s_check_grid_data_files - if (any(x_cb(0:m) - x_cb(-1:m - 1) <= 0._wp)) then + if (any(x%cb(0:m) - x%cb(-1:m - 1) <= 0._wp)) then call s_mpi_abort('x_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings. Exiting.') end if if (n > 0) then - if (any(y_cb(0:n) - y_cb(-1:n - 1) <= 0._wp)) then + if (any(y%cb(0:n) - y%cb(-1:n - 1) <= 0._wp)) then call s_mpi_abort('y_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings. ' // 'Exiting.') end if if (p > 0) then - if (any(z_cb(0:p) - z_cb(-1:p - 1) <= 0._wp)) then + if (any(z%cb(0:p) - z%cb(-1:p - 1) <= 0._wp)) then call s_mpi_abort('z_cb.dat in ' // trim(t_step_dir) // ' contains non-positive cell-spacings' // ' .Exiting.') end if end if @@ -352,12 +352,12 @@ contains call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ') end if - x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) - x_cc(0:m) = (x_cb(0:m) + x_cb(-1:(m - 1)))/2._wp - dx = minval(x_cb(0:m) - x_cb(-1:(m - 1))) + x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) + x%cc(0:m) = (x%cb(0:m) + x%cb(-1:(m - 1)))/2._wp + dx = minval(x%cb(0:m) - x%cb(-1:(m - 1))) if (num_procs > 1) call s_mpi_reduce_min(dx) - x_domain%beg = x_cb(-1) - x_domain%end = x_cb(m) + x_domain%beg = x%cb(-1) + x_domain%end = x%cb(m) if (n > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat' @@ -372,12 +372,12 @@ contains call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ') end if - y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) - y_cc(0:n) = (y_cb(0:n) + y_cb(-1:(n - 1)))/2._wp - dy = minval(y_cb(0:n) - y_cb(-1:(n - 1))) + y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) + y%cc(0:n) = (y%cb(0:n) + y%cb(-1:(n - 1)))/2._wp + dy = minval(y%cb(0:n) - y%cb(-1:(n - 1))) if (num_procs > 1) call s_mpi_reduce_min(dy) - y_domain%beg = y_cb(-1) - y_domain%end = y_cb(n) + y_domain%beg = y%cb(-1) + y_domain%end = y%cb(n) if (p > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat' @@ -392,12 +392,12 @@ contains call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting. ') end if - z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) - z_cc(0:p) = (z_cb(0:p) + z_cb(-1:(p - 1)))/2._wp - dz = minval(z_cb(0:p) - z_cb(-1:(p - 1))) + z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) + z%cc(0:p) = (z%cb(0:p) + z%cb(-1:(p - 1)))/2._wp + dz = minval(z%cb(0:p) - z%cb(-1:(p - 1))) if (num_procs > 1) call s_mpi_reduce_min(dz) - z_domain%beg = z_cb(-1) - z_domain%end = z_cb(p) + z_domain%beg = z%cb(-1) + z_domain%end = z%cb(p) end if end if @@ -551,9 +551,9 @@ contains do l = 0, p do k = 0, n do j = 0, m - r2 = x_cc(j)**2 - if (n > 0) r2 = r2 + y_cc(k)**2 - if (p > 0) r2 = r2 + z_cc(l)**2 + r2 = x%cc(j)**2 + if (n > 0) r2 = r2 + y%cc(k)**2 + if (p > 0) r2 = r2 + z%cc(l)**2 q_cons_vf(eqn_idx%psi)%sf(j, k, l) = 1.0e-2_wp*exp(-r2/(2.0_wp*0.05_wp**2)) q_prim_vf(eqn_idx%psi)%sf(j, k, l) = q_cons_vf(eqn_idx%psi)%sf(j, k, l) end do diff --git a/src/simulation/m_acoustic_src.fpp b/src/simulation/m_acoustic_src.fpp index f5bc800e54..528095f4b9 100644 --- a/src/simulation/m_acoustic_src.fpp +++ b/src/simulation/m_acoustic_src.fpp @@ -69,7 +69,8 @@ contains & gauss_sigma_dist(1:num_source), gauss_sigma_time(1:num_source), foc_length(1:num_source), & & aperture(1:num_source), npulse(1:num_source), pulse(1:num_source), dir(1:num_source), delay(1:num_source), & & element_polygon_ratio(1:num_source), rotate_angle(1:num_source), element_spacing_angle(1:num_source), & - & num_elements(1:num_source), element_on(1:num_source), bb_num_freq(1:num_source), bb_bandwidth(1:num_source), bb_lowest_freq(1:num_source)) + & num_elements(1:num_source), element_on(1:num_source), bb_num_freq(1:num_source), bb_bandwidth(1:num_source), & + & bb_lowest_freq(1:num_source)) do i = 1, num_source do j = 1, 3 @@ -486,18 +487,18 @@ contains ! Calculate sig spatial support width if (n == 0) then - sig = dx(j) + sig = x%spacing(j) else if (p == 0) then - sig = maxval((/dx(j), dy(k)/)) + sig = maxval((/x%spacing(j), y%spacing(k)/)) else - sig = maxval((/dx(j), dy(k), dz(l)/)) + sig = maxval((/x%spacing(j), y%spacing(k), z%spacing(l)/)) end if sig = sig*acoustic_spatial_support_width ! Calculate displacement from acoustic source location - r(1) = x_cc(j) - loc(1) - if (n /= 0) r(2) = y_cc(k) - loc(2) - if (p /= 0) r(3) = z_cc(l) - loc(3) + r(1) = x%cc(j) - loc(1) + if (n /= 0) r(2) = y%cc(k) - loc(2) + if (p /= 0) r(3) = z%cc(l) - loc(3) if (any(support(ai) == (/1, 2, 3, 4/))) then call s_source_spatial_planar(ai, sig, r, source) diff --git a/src/simulation/m_bubbles_EE.fpp b/src/simulation/m_bubbles_EE.fpp index a15156405b..b0461fd976 100644 --- a/src/simulation/m_bubbles_EE.fpp +++ b/src/simulation/m_bubbles_EE.fpp @@ -104,7 +104,7 @@ contains do k = 0, n do j = 0, m divu_in%sf(j, k, l) = 0._wp - divu_in%sf(j, k, l) = 5.e-1_wp/dx(j)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j + 1, k, & + divu_in%sf(j, k, l) = 5.e-1_wp/x%spacing(j)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j + 1, k, & & l) - q_prim_vf(eqn_idx%cont%end + idir)%sf(j - 1, k, l)) end do end do @@ -116,8 +116,9 @@ contains do l = 0, p do k = 0, n do j = 0, m - divu_in%sf(j, k, l) = divu_in%sf(j, k, l) + 5.e-1_wp/dy(k)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j, & - & k + 1, l) - q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k - 1, l)) + divu_in%sf(j, k, l) = divu_in%sf(j, k, & + & l) + 5.e-1_wp/y%spacing(k)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k + 1, & + & l) - q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k - 1, l)) end do end do end do @@ -127,7 +128,8 @@ contains do l = 0, p do k = 0, n do j = 0, m - divu_in%sf(j, k, l) = divu_in%sf(j, k, l) + 5.e-1_wp/dz(l)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k, & + divu_in%sf(j, k, l) = divu_in%sf(j, k, & + & l) + 5.e-1_wp/z%spacing(l)*(q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k, & & l + 1) - q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k, l - 1)) end do end do diff --git a/src/simulation/m_bubbles_EL.fpp b/src/simulation/m_bubbles_EL.fpp index b44eb617b1..e2d44a1e72 100644 --- a/src/simulation/m_bubbles_EL.fpp +++ b/src/simulation/m_bubbles_EL.fpp @@ -202,7 +202,7 @@ contains Rmin_glb = max(dflt_real, -dflt_real) $:GPU_UPDATE(device='[Rmax_glb, Rmin_glb]') - $:GPU_UPDATE(device='[dx, dy, dz, x_cb, x_cc, y_cb, y_cc, z_cb, z_cc]') + $:GPU_UPDATE(device='[x%spacing, y%spacing, z%spacing, x%cb, x%cc, y%cb, y%cc, z%cb, z%cc]') ! Populate temporal variables call s_transfer_data_to_tmp() @@ -793,48 +793,48 @@ contains !> Getting p_cell in terms of only the current cell by interpolation !> Getting the cell volulme as Omega if (p > 0) then - vol = dx(cell(1))*dy(cell(2))*dz(cell(3)) + vol = x%spacing(cell(1))*y%spacing(cell(2))*z%spacing(cell(3)) else if (cyl_coord) then - vol = dx(cell(1))*dy(cell(2))*y_cc(cell(2))*2._wp*pi + vol = x%spacing(cell(1))*y%spacing(cell(2))*y%cc(cell(2))*2._wp*pi else - vol = dx(cell(1))*dy(cell(2))*lag_params%charwidth + vol = x%spacing(cell(1))*y%spacing(cell(2))*lag_params%charwidth end if end if !> Obtain bilinear interpolation coefficients, based on the current location of the bubble. - psi(1) = (scoord(1) - real(cell(1)))*dx(cell(1)) + x_cb(cell(1) - 1) + psi(1) = (scoord(1) - real(cell(1)))*x%spacing(cell(1)) + x%cb(cell(1) - 1) if (cell(1) == (m + buff_size)) then cell(1) = cell(1) - 1 psi(1) = 1._wp else if (cell(1) == (-buff_size)) then psi(1) = 0._wp else - if (psi(1) < x_cc(cell(1))) cell(1) = cell(1) - 1 - psi(1) = abs((psi(1) - x_cc(cell(1)))/(x_cc(cell(1) + 1) - x_cc(cell(1)))) + if (psi(1) < x%cc(cell(1))) cell(1) = cell(1) - 1 + psi(1) = abs((psi(1) - x%cc(cell(1)))/(x%cc(cell(1) + 1) - x%cc(cell(1)))) end if - psi(2) = (scoord(2) - real(cell(2)))*dy(cell(2)) + y_cb(cell(2) - 1) + psi(2) = (scoord(2) - real(cell(2)))*y%spacing(cell(2)) + y%cb(cell(2) - 1) if (cell(2) == (n + buff_size)) then cell(2) = cell(2) - 1 psi(2) = 1._wp else if (cell(2) == (-buff_size)) then psi(2) = 0._wp else - if (psi(2) < y_cc(cell(2))) cell(2) = cell(2) - 1 - psi(2) = abs((psi(2) - y_cc(cell(2)))/(y_cc(cell(2) + 1) - y_cc(cell(2)))) + if (psi(2) < y%cc(cell(2))) cell(2) = cell(2) - 1 + psi(2) = abs((psi(2) - y%cc(cell(2)))/(y%cc(cell(2) + 1) - y%cc(cell(2)))) end if if (p > 0) then - psi(3) = (scoord(3) - real(cell(3)))*dz(cell(3)) + z_cb(cell(3) - 1) + psi(3) = (scoord(3) - real(cell(3)))*z%spacing(cell(3)) + z%cb(cell(3) - 1) if (cell(3) == (p + buff_size)) then cell(3) = cell(3) - 1 psi(3) = 1._wp else if (cell(3) == (-buff_size)) then psi(3) = 0._wp else - if (psi(3) < z_cc(cell(3))) cell(3) = cell(3) - 1 - psi(3) = abs((psi(3) - z_cc(cell(3)))/(z_cc(cell(3) + 1) - z_cc(cell(3)))) + if (psi(3) < z%cc(cell(3))) cell(3) = cell(3) - 1 + psi(3) = abs((psi(3) - z%cc(cell(3)))/(z%cc(cell(3) + 1) - z%cc(cell(3)))) end if else psi(3) = 0._wp @@ -890,7 +890,7 @@ contains if ((cellaux(1) < -buff_size) .or. (cellaux(2) < -buff_size)) then celloutside = .true. end if - if (cyl_coord .and. y_cc(cellaux(2)) < 0._wp) then + if (cyl_coord .and. y%cc(cellaux(2)) < 0._wp) then celloutside = .true. end if if ((cellaux(2) > n + buff_size) .or. (cellaux(1) > m + buff_size)) then @@ -907,7 +907,7 @@ contains end if end if if (.not. celloutside) then - if (cyl_coord .and. (p == 0) .and. (y_cc(cellaux(2)) < 0._wp)) then + if (cyl_coord .and. (p == 0) .and. (y%cc(cellaux(2)) < 0._wp)) then celloutside = .true. end if end if @@ -915,12 +915,12 @@ contains if (.not. celloutside) then !> Obtaining the cell volulme if (p > 0) then - vol = dx(cellaux(1))*dy(cellaux(2))*dz(cellaux(3)) + vol = x%spacing(cellaux(1))*y%spacing(cellaux(2))*z%spacing(cellaux(3)) else if (cyl_coord) then - vol = dx(cellaux(1))*dy(cellaux(2))*y_cc(cellaux(2))*2._wp*pi + vol = x%spacing(cellaux(1))*y%spacing(cellaux(2))*y%cc(cellaux(2))*2._wp*pi else - vol = dx(cellaux(1))*dy(cellaux(2))*lag_params%charwidth + vol = x%spacing(cellaux(1))*y%spacing(cellaux(2))*lag_params%charwidth end if end if !> Update values @@ -1088,40 +1088,40 @@ contains integer, dimension(3), intent(inout) :: cell integer :: i - do while (pos(1) < x_cb(cell(1) - 1)) + do while (pos(1) < x%cb(cell(1) - 1)) cell(1) = cell(1) - 1 end do - do while (pos(1) > x_cb(cell(1))) + do while (pos(1) > x%cb(cell(1))) cell(1) = cell(1) + 1 end do - do while (pos(2) < y_cb(cell(2) - 1)) + do while (pos(2) < y%cb(cell(2) - 1)) cell(2) = cell(2) - 1 end do - do while (pos(2) > y_cb(cell(2))) + do while (pos(2) > y%cb(cell(2))) cell(2) = cell(2) + 1 end do if (p > 0) then - do while (pos(3) < z_cb(cell(3) - 1)) + do while (pos(3) < z%cb(cell(3) - 1)) cell(3) = cell(3) - 1 end do - do while (pos(3) > z_cb(cell(3))) + do while (pos(3) > z%cb(cell(3))) cell(3) = cell(3) + 1 end do end if ! The numbering of the cell of which left boundary is the domain boundary is 0. if comp.coord of the pos is s, the real ! coordinate of s is (the coordinate of the left boundary of the Floor(s)-th cell) + (s-(int(s))*(cell-width). In other - ! words, the coordinate of the center of the cell is x_cc(cell). + ! words, the coordinate of the center of the cell is x%cc(cell). ! coordinates in computational space - scoord(1) = cell(1) + (pos(1) - x_cb(cell(1) - 1))/dx(cell(1)) - scoord(2) = cell(2) + (pos(2) - y_cb(cell(2) - 1))/dy(cell(2)) + scoord(1) = cell(1) + (pos(1) - x%cb(cell(1) - 1))/x%spacing(cell(1)) + scoord(2) = cell(2) + (pos(2) - y%cb(cell(2) - 1))/y%spacing(cell(2)) scoord(3) = 0._wp - if (p > 0) scoord(3) = cell(3) + (pos(3) - z_cb(cell(3) - 1))/dz(cell(3)) + if (p > 0) scoord(3) = cell(3) + (pos(3) - z%cb(cell(3) - 1))/z%spacing(cell(3)) cell(:) = int(scoord(:)) do i = 1, num_dims if (scoord(i) < 0._wp) cell(i) = cell(i) - 1 @@ -1159,43 +1159,43 @@ contains if (p == 0 .and. cyl_coord .neqv. .true.) then ! Defining a virtual z-axis that has the same dimensions as y-axis defined in the input file - particle_in_domain = ((pos_part(1) < x_cb(m + buff_size)) .and. (pos_part(1) >= x_cb(-buff_size - 1)) & - & .and. (pos_part(2) < y_cb(n + buff_size)) .and. (pos_part(2) >= y_cb(-buff_size - 1)) & + particle_in_domain = ((pos_part(1) < x%cb(m + buff_size)) .and. (pos_part(1) >= x%cb(-buff_size - 1)) & + & .and. (pos_part(2) < y%cb(n + buff_size)) .and. (pos_part(2) >= y%cb(-buff_size - 1)) & & .and. (pos_part(3) < lag_params%charwidth/2._wp) .and. (pos_part(3) >= & & -lag_params%charwidth/2._wp)) else ! cyl_coord - particle_in_domain = ((pos_part(1) < x_cb(m + buff_size)) .and. (pos_part(1) >= x_cb(-buff_size - 1)) & - & .and. (abs(pos_part(2)) < y_cb(n + buff_size)) .and. (abs(pos_part(2)) >= max(y_cb(-buff_size & + particle_in_domain = ((pos_part(1) < x%cb(m + buff_size)) .and. (pos_part(1) >= x%cb(-buff_size - 1)) & + & .and. (abs(pos_part(2)) < y%cb(n + buff_size)) .and. (abs(pos_part(2)) >= max(y%cb(-buff_size & & - 1), 0._wp))) end if ! 3D if (p > 0) then - particle_in_domain = ((pos_part(1) < x_cb(m + buff_size)) .and. (pos_part(1) >= x_cb(-buff_size - 1)) & - & .and. (pos_part(2) < y_cb(n + buff_size)) .and. (pos_part(2) >= y_cb(-buff_size - 1)) & - & .and. (pos_part(3) < z_cb(p + buff_size)) .and. (pos_part(3) >= z_cb(-buff_size - 1))) + particle_in_domain = ((pos_part(1) < x%cb(m + buff_size)) .and. (pos_part(1) >= x%cb(-buff_size - 1)) & + & .and. (pos_part(2) < y%cb(n + buff_size)) .and. (pos_part(2) >= y%cb(-buff_size - 1)) & + & .and. (pos_part(3) < z%cb(p + buff_size)) .and. (pos_part(3) >= z%cb(-buff_size - 1))) end if ! For symmetric and wall boundary condition if (any(bc_x%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then - particle_in_domain = (particle_in_domain .and. (pos_part(1) >= x_cb(-1))) + particle_in_domain = (particle_in_domain .and. (pos_part(1) >= x%cb(-1))) end if if (any(bc_x%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then - particle_in_domain = (particle_in_domain .and. (pos_part(1) < x_cb(m))) + particle_in_domain = (particle_in_domain .and. (pos_part(1) < x%cb(m))) end if if (any(bc_y%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then - particle_in_domain = (particle_in_domain .and. (pos_part(2) >= y_cb(-1))) + particle_in_domain = (particle_in_domain .and. (pos_part(2) >= y%cb(-1))) end if if (any(bc_y%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then - particle_in_domain = (particle_in_domain .and. (pos_part(2) < y_cb(n))) + particle_in_domain = (particle_in_domain .and. (pos_part(2) < y%cb(n))) end if if (p > 0) then if (any(bc_z%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then - particle_in_domain = (particle_in_domain .and. (pos_part(3) >= z_cb(-1))) + particle_in_domain = (particle_in_domain .and. (pos_part(3) >= z%cb(-1))) end if if (any(bc_z%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then - particle_in_domain = (particle_in_domain .and. (pos_part(3) < z_cb(p))) + particle_in_domain = (particle_in_domain .and. (pos_part(3) < z%cb(p))) end if end if @@ -1207,12 +1207,12 @@ contains logical :: particle_in_domain_physical real(wp), dimension(3), intent(in) :: pos_part - particle_in_domain_physical = ((pos_part(1) < x_cb(m)) .and. (pos_part(1) >= x_cb(-1)) .and. (pos_part(2) < y_cb(n)) & - & .and. (pos_part(2) >= y_cb(-1))) + particle_in_domain_physical = ((pos_part(1) < x%cb(m)) .and. (pos_part(1) >= x%cb(-1)) .and. (pos_part(2) < y%cb(n)) & + & .and. (pos_part(2) >= y%cb(-1))) if (p > 0) then - particle_in_domain_physical = (particle_in_domain_physical .and. (pos_part(3) < z_cb(p)) .and. (pos_part(3) & - & >= z_cb(-1))) + particle_in_domain_physical = (particle_in_domain_physical .and. (pos_part(3) < z%cb(p)) .and. (pos_part(3) & + & >= z%cb(-1))) end if end function particle_in_domain_physical @@ -1230,9 +1230,9 @@ contains do k = 0, p do j = 0, n do i = 0, m - dq(i, j, k) = q(i, j, k)*(dx(i + 1) - dx(i - 1)) + q(i + 1, j, k)*(dx(i) + dx(i - 1)) - q(i - 1, j, & - & k)*(dx(i) + dx(i + 1)) - dq(i, j, k) = dq(i, j, k)/((dx(i) + dx(i - 1))*(dx(i) + dx(i + 1))) + dq(i, j, k) = q(i, j, k)*(x%spacing(i + 1) - x%spacing(i - 1)) + q(i + 1, j, & + & k)*(x%spacing(i) + x%spacing(i - 1)) - q(i - 1, j, k)*(x%spacing(i) + x%spacing(i + 1)) + dq(i, j, k) = dq(i, j, k)/((x%spacing(i) + x%spacing(i - 1))*(x%spacing(i) + x%spacing(i + 1))) end do end do end do @@ -1243,9 +1243,9 @@ contains do k = 0, p do j = 0, n do i = 0, m - dq(i, j, k) = q(i, j, k)*(dy(j + 1) - dy(j - 1)) + q(i, j + 1, k)*(dy(j) + dy(j - 1)) - q(i, j - 1, & - & k)*(dy(j) + dy(j + 1)) - dq(i, j, k) = dq(i, j, k)/((dy(j) + dy(j - 1))*(dy(j) + dy(j + 1))) + dq(i, j, k) = q(i, j, k)*(y%spacing(j + 1) - y%spacing(j - 1)) + q(i, j + 1, & + & k)*(y%spacing(j) + y%spacing(j - 1)) - q(i, j - 1, k)*(y%spacing(j) + y%spacing(j + 1)) + dq(i, j, k) = dq(i, j, k)/((y%spacing(j) + y%spacing(j - 1))*(y%spacing(j) + y%spacing(j + 1))) end do end do end do @@ -1256,9 +1256,9 @@ contains do k = 0, p do j = 0, n do i = 0, m - dq(i, j, k) = q(i, j, k)*(dz(k + 1) - dz(k - 1)) + q(i, j, k + 1)*(dz(k) + dz(k - 1)) - q(i, j, & - & k - 1)*(dz(k) + dz(k + 1)) - dq(i, j, k) = dq(i, j, k)/((dz(k) + dz(k - 1))*(dz(k) + dz(k + 1))) + dq(i, j, k) = q(i, j, k)*(z%spacing(k + 1) - z%spacing(k - 1)) + q(i, j, & + & k + 1)*(z%spacing(k) + z%spacing(k - 1)) - q(i, j, k - 1)*(z%spacing(k) + z%spacing(k + 1)) + dq(i, j, k) = dq(i, j, k)/((z%spacing(k) + z%spacing(k - 1))*(z%spacing(k) + z%spacing(k + 1))) end do end do end do diff --git a/src/simulation/m_bubbles_EL_kernels.fpp b/src/simulation/m_bubbles_EL_kernels.fpp index f1f80980b0..1f754e990f 100644 --- a/src/simulation/m_bubbles_EL_kernels.fpp +++ b/src/simulation/m_bubbles_EL_kernels.fpp @@ -54,10 +54,10 @@ contains strength_vel = 4._wp*pi*lbk_rad(l, 2)**2._wp*lbk_vel(l, 2) if (num_dims == 2) then - Vol = dx(cell(1))*dy(cell(2))*lag_params%charwidth - if (cyl_coord) Vol = dx(cell(1))*dy(cell(2))*y_cc(cell(2))*2._wp*pi + Vol = x%spacing(cell(1))*y%spacing(cell(2))*lag_params%charwidth + if (cyl_coord) Vol = x%spacing(cell(1))*y%spacing(cell(2))*y%cc(cell(2))*2._wp*pi else - Vol = dx(cell(1))*dy(cell(2))*dz(cell(3)) + Vol = x%spacing(cell(1))*y%spacing(cell(2))*z%spacing(cell(3)) end if ! Update void fraction field @@ -133,9 +133,9 @@ contains call s_check_celloutside(cellaux, celloutside) if (.not. celloutside) then - nodecoord(1) = x_cc(cellaux(1)) - nodecoord(2) = y_cc(cellaux(2)) - if (p > 0) nodecoord(3) = z_cc(cellaux(3)) + nodecoord(1) = x%cc(cellaux(1)) + nodecoord(2) = y%cc(cellaux(2)) + if (p > 0) nodecoord(3) = z%cc(cellaux(3)) call s_applygaussian(center, cellaux, nodecoord, stddsv, 0._wp, func) if (lag_params%cluster_type >= 4) call s_applygaussian(center, cellaux, nodecoord, stddsv, 1._wp, func2) @@ -204,7 +204,7 @@ contains !> 2D cylindrical function: ! We smear particles in the azimuthal direction for given r theta = 0._wp - Nr = ceiling(2._wp*pi*nodecoord(2)/(y_cb(cellaux(2)) - y_cb(cellaux(2) - 1))) + Nr = ceiling(2._wp*pi*nodecoord(2)/(y%cb(cellaux(2)) - y%cb(cellaux(2) - 1))) dtheta = 2._wp*pi/Nr L2 = center(2)**2._wp + nodecoord(2)**2._wp - 2._wp*center(2)*nodecoord(2)*cos(theta) distance = sqrt((center(1) - nodecoord(1))**2._wp + L2) @@ -225,9 +225,9 @@ contains !> 2D cartesian function: ! We smear particles considering a virtual depth (lag_params%charwidth) theta = 0._wp - Nr = ceiling(lag_params%charwidth/(y_cb(cellaux(2)) - y_cb(cellaux(2) - 1))) + Nr = ceiling(lag_params%charwidth/(y%cb(cellaux(2)) - y%cb(cellaux(2) - 1))) Nr_count = 1._wp - mapCells*1._wp - dzp = y_cb(cellaux(2) + 1) - y_cb(cellaux(2)) + dzp = y%cb(cellaux(2) + 1) - y%cb(cellaux(2)) Lz2 = (center(3) - (dzp*(0.5_wp + Nr_count) - lag_params%charwidth/2._wp))**2._wp distance = sqrt((center(1) - nodecoord(1))**2._wp + (center(2) - nodecoord(2))**2._wp + Lz2) func = dzp/lag_params%charwidth*exp(-0.5_wp*(distance/stddsv)**2._wp)/(sqrt(2._wp*pi)*stddsv)**3._wp @@ -257,7 +257,7 @@ contains if ((cellaux(1) < -buff_size) .or. (cellaux(2) < -buff_size)) then celloutside = .true. end if - if (cyl_coord .and. y_cc(cellaux(2)) < 0._wp) then + if (cyl_coord .and. y%cc(cellaux(2)) < 0._wp) then celloutside = .true. end if if ((cellaux(2) > n + buff_size) .or. (cellaux(1) > m + buff_size)) then @@ -323,17 +323,17 @@ contains real(wp) :: rad !> Compute characteristic distance - chardist = sqrt(dx(cell(1))*dy(cell(2))) - if (p > 0) chardist = (dx(cell(1))*dy(cell(2))*dz(cell(3)))**(1._wp/3._wp) + chardist = sqrt(x%spacing(cell(1))*y%spacing(cell(2))) + if (p > 0) chardist = (x%spacing(cell(1))*y%spacing(cell(2))*z%spacing(cell(3)))**(1._wp/3._wp) !> Compute characteristic volume if (p > 0) then - charvol = dx(cell(1))*dy(cell(2))*dz(cell(3)) + charvol = x%spacing(cell(1))*y%spacing(cell(2))*z%spacing(cell(3)) else if (cyl_coord) then - charvol = dx(cell(1))*dy(cell(2))*y_cc(cell(2))*2._wp*pi + charvol = x%spacing(cell(1))*y%spacing(cell(2))*y%cc(cell(2))*2._wp*pi else - charvol = dx(cell(1))*dy(cell(2))*lag_params%charwidth + charvol = x%spacing(cell(1))*y%spacing(cell(2))*lag_params%charwidth end if end if @@ -356,12 +356,12 @@ contains real(wp), intent(out) :: Charvol if (p > 0) then - Charvol = dx(cellx)*dy(celly)*dz(cellz) + Charvol = x%spacing(cellx)*y%spacing(celly)*z%spacing(cellz) else if (cyl_coord) then - Charvol = dx(cellx)*dy(celly)*y_cc(celly)*2._wp*pi + Charvol = x%spacing(cellx)*y%spacing(celly)*y%cc(celly)*2._wp*pi else - Charvol = dx(cellx)*dy(celly)*lag_params%charwidth + Charvol = x%spacing(cellx)*y%spacing(celly)*lag_params%charwidth end if end if diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index e6e14aeb5d..86a56be813 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -312,8 +312,8 @@ contains vel_out(${CBC_DIR}$, 3) = bc_${XYZ}$%vel_out(3) end if end if - Del_in(${CBC_DIR}$) = maxval(d${XYZ}$) - Del_out(${CBC_DIR}$) = maxval(d${XYZ}$) + Del_in(${CBC_DIR}$) = maxval(${XYZ}$%spacing) + Del_out(${CBC_DIR}$) = maxval(${XYZ}$%spacing) pres_in(${CBC_DIR}$) = bc_${XYZ}$%pres_in pres_out(${CBC_DIR}$) = bc_${XYZ}$%pres_out do i = 1, num_fluids @@ -422,11 +422,11 @@ contains if (cbc_loc_in == -1) then do i = 0, buff_size - ds(i) = dx(i) + ds(i) = x%spacing(i) end do else do i = 0, buff_size - ds(i) = dx(m - i) + ds(i) = x%spacing(m - i) end do end if @@ -436,11 +436,11 @@ contains if (cbc_loc_in == -1) then do i = 0, buff_size - ds(i) = dy(i) + ds(i) = y%spacing(i) end do else do i = 0, buff_size - ds(i) = dy(n - i) + ds(i) = y%spacing(n - i) end do end if @@ -450,11 +450,11 @@ contains if (cbc_loc_in == -1) then do i = 0, buff_size - ds(i) = dz(i) + ds(i) = z%spacing(i) end do else do i = 0, buff_size - ds(i) = dz(p - i) + ds(i) = z%spacing(p - i) end do end if end if @@ -725,15 +725,15 @@ contains Ma = vel(dir_idx(1))/c - if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SLIP_WALL) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SLIP_WALL)) then + if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SLIP_WALL) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SLIP_WALL)) then call s_compute_slip_wall_L(lambda, L, rho, c, dpres_ds, dvel_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, dpres_ds, dvel_ds) ! Add GRCBC for Subsonic Inflow if (bc_${XYZ}$%grcbc_in) then @@ -759,8 +759,8 @@ contains & dir_idx(1))*sign(1, & & cbc_loc))/Del_in(${CBC_DIR}$) + c*(1._wp + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) ! Add GRCBC for Subsonic Outflow (Pressure) @@ -773,26 +773,26 @@ contains & + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) end if end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then call s_compute_force_free_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, & & dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then call s_compute_constant_pressure_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_INFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_INFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then call s_compute_supersonic_inflow_L(L) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) & + & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then call s_compute_supersonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, & & dYs_ds) end if ! Be careful about the cylindrical coordinate! if (cyl_coord .and. cbc_dir == 2 .and. cbc_loc == 1) then - dpres_dt = -5.e-1_wp*(L(eqn_idx%adv%end) + L(1)) + rho*c*c*vel(dir_idx(1))/y_cc(n) + dpres_dt = -5.e-1_wp*(L(eqn_idx%adv%end) + L(1)) + rho*c*c*vel(dir_idx(1))/y%cc(n) else dpres_dt = -5.e-1_wp*(L(eqn_idx%adv%end) + L(1)) end if @@ -825,7 +825,7 @@ contains if (cyl_coord .and. cbc_dir == 2 .and. cbc_loc == 1) then $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%adv%end - eqn_idx%E - dadv_dt(i) = -L(eqn_idx%mom%end + i) ! + adv_local(i) * vel(dir_idx(1))/y_cc(n) + dadv_dt(i) = -L(eqn_idx%mom%end + i) ! + adv_local(i) * vel(dir_idx(1))/y%cc(n) end do else $:GPU_LOOP(parallelism='[seq]') diff --git a/src/simulation/m_collisions.fpp b/src/simulation/m_collisions.fpp index fe860cb055..cb23dd67e4 100644 --- a/src/simulation/m_collisions.fpp +++ b/src/simulation/m_collisions.fpp @@ -426,10 +426,10 @@ contains #:endfor ! the object that contains the collision location owns the collisions - owns_collision = x_cb(-1) <= projected_location(1) .and. projected_location(1) < x_cb(m) - owns_collision = owns_collision .and. y_cb(-1) <= projected_location(2) .and. projected_location(2) < y_cb(n) - if (num_dims == 3) owns_collision = owns_collision .and. z_cb(-1) <= projected_location(3) & - & .and. projected_location(3) < z_cb(p) + owns_collision = x%cb(-1) <= projected_location(1) .and. projected_location(1) < x%cb(m) + owns_collision = owns_collision .and. y%cb(-1) <= projected_location(2) .and. projected_location(2) < y%cb(n) + if (num_dims == 3) owns_collision = owns_collision .and. z%cb(-1) <= projected_location(3) & + & .and. projected_location(3) < z%cb(p) end if #:else owns_collision = .true. diff --git a/src/simulation/m_compute_levelset.fpp b/src/simulation/m_compute_levelset.fpp index 9e7519790c..d5bc11447b 100644 --- a/src/simulation/m_compute_levelset.fpp +++ b/src/simulation/m_compute_levelset.fpp @@ -88,8 +88,8 @@ contains radius = patch_ib(ib_patch_id)%radius - dist_vec(1) = x_cc(i) - patch_ib(ib_patch_id)%x_centroid - real(gp%x_periodicity, wp)*(x_domain%end - x_domain%beg) - dist_vec(2) = y_cc(j) - patch_ib(ib_patch_id)%y_centroid - real(gp%y_periodicity, wp)*(y_domain%end - y_domain%beg) + dist_vec(1) = x%cc(i) - patch_ib(ib_patch_id)%x_centroid - real(gp%x_periodicity, wp)*(x_domain%end - x_domain%beg) + dist_vec(2) = y%cc(j) - patch_ib(ib_patch_id)%y_centroid - real(gp%y_periodicity, wp)*(y_domain%end - y_domain%beg) dist_vec(3) = 0._wp dist = sqrt(sum(dist_vec**2)) @@ -125,7 +125,7 @@ contains rotation(:,:) = patch_ib(ib_patch_id)%rotation_matrix(:,:) offset(:) = patch_ib(ib_patch_id)%centroid_offset(:) - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB xy_local = matmul(inverse_rotation, xy_local) ! rotate the frame into the IB's coordinate xy_local = xy_local - offset ! airfoils are a patch that require a centroid offset @@ -210,7 +210,7 @@ contains z_max = lz/2 z_min = -lz/2 - xyz_local = [x_cc(i), y_cc(j), z_cc(l)] - center + xyz_local = [x%cc(i), y%cc(j), z%cc(l)] - center xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates xyz_local = xyz_local - offset ! airfoils are a patch that require a centroid offset @@ -311,7 +311,7 @@ contains bottom_left(2) = -length_y/2 ! convert grid to local coordinates - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] xy_local = matmul(inverse_rotation, xy_local) side_dists(1) = bottom_left(1) - xy_local(1) @@ -374,7 +374,7 @@ contains ellipse_coeffs(1) = 0.5_wp*length_x ellipse_coeffs(2) = 0.5_wp*length_y - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] xy_local = matmul(inverse_rotation, xy_local) normal_vector = xy_local @@ -433,7 +433,7 @@ contains Front = length_z/2 Back = -length_z/2 - xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB + xyz_local = [x%cc(i), y%cc(j), z%cc(k)] - center ! get coordinate frame centered on IB xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinate dist_left = Left - xyz_local(1) @@ -505,9 +505,9 @@ contains center(3) = patch_ib(ib_patch_id)%z_centroid center = center + periodicity - dist_vec(1) = x_cc(i) - center(1) - dist_vec(2) = y_cc(j) - center(2) - dist_vec(3) = z_cc(k) - center(3) + dist_vec(1) = x%cc(i) - center(1) + dist_vec(2) = y%cc(j) - center(2) + dist_vec(3) = z%cc(k) - center(3) dist = sqrt(sum(dist_vec**2)) gp%levelset = dist - radius if (f_approx_equal(dist, 0._wp)) then @@ -566,7 +566,7 @@ contains dist_surface_vec = (/1, 1, 0/) end if - xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB + xyz_local = [x%cc(i), y%cc(j), z%cc(k)] - center ! get coordinate frame centered on IB xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates ! get distance to flat edge of cylinder @@ -626,9 +626,9 @@ contains rotation(:,:) = patch_ib(patch_id)%rotation_matrix(:,:) ! determine where we are located in space - xyz_local = (/x_cc(i) - center(1), y_cc(j) - center(2), 0._wp/) + xyz_local = (/x%cc(i) - center(1), y%cc(j) - center(2), 0._wp/) if (p > 0) then - xyz_local(3) = z_cc(k) - center(3) + xyz_local(3) = z%cc(k) - center(3) end if xyz_local = matmul(inverse_rotation, xyz_local) diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index a5fdb3ef81..02235fac99 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -301,19 +301,19 @@ contains file_path = trim(t_step_dir) // '/x_cb.dat' open (2, FILE=trim(file_path), form='unformatted', STATUS='new') - write (2) x_cb(-1:m); close (2) + write (2) x%cb(-1:m); close (2) if (n > 0) then file_path = trim(t_step_dir) // '/y_cb.dat' open (2, FILE=trim(file_path), form='unformatted', STATUS='new') - write (2) y_cb(-1:n); close (2) + write (2) y%cb(-1:n); close (2) if (p > 0) then file_path = trim(t_step_dir) // '/z_cb.dat' open (2, FILE=trim(file_path), form='unformatted', STATUS='new') - write (2) z_cb(-1:p); close (2) + write (2) z%cb(-1:p); close (2) end if end if @@ -401,9 +401,9 @@ contains do j = 0, m ! todo: revisit change here if (((i >= eqn_idx%adv%beg) .and. (i <= eqn_idx%adv%end))) then - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) else - write (2, FMT) x_cb(j), q_prim_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_prim_vf(i)%sf(j, 0, 0) end if end do close (2) @@ -415,7 +415,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m - write (2, FMT) x_cb(j), q_cons_vf(i)%sf(j, 0, 0) + write (2, FMT) x%cb(j), q_cons_vf(i)%sf(j, 0, 0) end do close (2) end do @@ -428,7 +428,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m - write (2, FMT) x_cb(j), pb_ts(1)%sf(j, 0, 0, r, i) + write (2, FMT) x%cb(j), pb_ts(1)%sf(j, 0, 0, r, i) end do close (2) end do @@ -440,7 +440,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m - write (2, FMT) x_cb(j), mv_ts(1)%sf(j, 0, 0, r, i) + write (2, FMT) x%cb(j), mv_ts(1)%sf(j, 0, 0, r, i) end do close (2) end do @@ -460,7 +460,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), q_cons_vf(i)%sf(j, k, 0) + write (2, FMT) x%cb(j), y%cb(k), q_cons_vf(i)%sf(j, k, 0) end do write (2, *) end do @@ -472,7 +472,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), beta%sf(j, k, 0) + write (2, FMT) x%cb(j), y%cb(k), beta%sf(j, k, 0) end do write (2, *) end do @@ -488,7 +488,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), pb_ts(1)%sf(j, k, 0, r, i) + write (2, FMT) x%cb(j), y%cb(k), pb_ts(1)%sf(j, k, 0, r, i) end do end do close (2) @@ -502,7 +502,7 @@ contains open (2, FILE=trim(file_path)) do j = 0, m do k = 0, n - write (2, FMT) x_cb(j), y_cb(k), mv_ts(1)%sf(j, k, 0, r, i) + write (2, FMT) x%cb(j), y%cb(k), mv_ts(1)%sf(j, k, 0, r, i) end do end do close (2) @@ -520,9 +520,9 @@ contains do k = 0, n if (((i >= eqn_idx%cont%beg) .and. (i <= eqn_idx%cont%end)) .or. ((i >= eqn_idx%adv%beg) & & .and. (i <= eqn_idx%adv%end))) then - write (2, FMT) x_cb(j), y_cb(k), q_cons_vf(i)%sf(j, k, 0) + write (2, FMT) x%cb(j), y%cb(k), q_cons_vf(i)%sf(j, k, 0) else - write (2, FMT) x_cb(j), y_cb(k), q_prim_vf(i)%sf(j, k, 0) + write (2, FMT) x%cb(j), y%cb(k), q_prim_vf(i)%sf(j, k, 0) end if end do write (2, *) @@ -545,7 +545,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), q_cons_vf(i)%sf(j, k, l) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), q_cons_vf(i)%sf(j, k, l) end do write (2, *) end do @@ -560,7 +560,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), beta%sf(j, k, l) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), beta%sf(j, k, l) end do write (2, *) end do @@ -579,7 +579,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), pb_ts(1)%sf(j, k, l, r, i) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), pb_ts(1)%sf(j, k, l, r, i) end do end do end do @@ -595,7 +595,7 @@ contains do j = 0, m do k = 0, n do l = 0, p - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), mv_ts(1)%sf(j, k, l, r, i) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), mv_ts(1)%sf(j, k, l, r, i) end do end do end do @@ -616,9 +616,9 @@ contains if (((i >= eqn_idx%cont%beg) .and. (i <= eqn_idx%cont%end)) .or. ((i >= eqn_idx%adv%beg) & & .and. (i <= eqn_idx%adv%end)) .or. ((i >= eqn_idx%species%beg) & & .and. (i <= eqn_idx%species%end))) then - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), q_cons_vf(i)%sf(j, k, l) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), q_cons_vf(i)%sf(j, k, l) else - write (2, FMT) x_cb(j), y_cb(k), z_cb(l), q_prim_vf(i)%sf(j, k, l) + write (2, FMT) x%cb(j), y%cb(k), z%cb(l), q_prim_vf(i)%sf(j, k, l) end if end do write (2, *) @@ -1136,9 +1136,9 @@ contains damage_state = 0._wp if (n == 0) then - if ((probe(i)%x >= x_cb(-1)) .and. (probe(i)%x <= x_cb(m))) then + if ((probe(i)%x >= x%cb(-1)) .and. (probe(i)%x <= x%cb(m))) then do s = -1, m - distx(s) = x_cb(s) - probe(i)%x + distx(s) = x%cb(s) - probe(i)%x if (distx(s) < 0._wp) distx(s) = 1000._wp end do j = minloc(distx, 1) @@ -1244,14 +1244,14 @@ contains end do end if - if ((probe(i)%x >= x_cb(-1)) .and. (probe(i)%x <= x_cb(m))) then - if ((probe(i)%y >= y_cb(-1)) .and. (probe(i)%y <= y_cb(n))) then + if ((probe(i)%x >= x%cb(-1)) .and. (probe(i)%x <= x%cb(m))) then + if ((probe(i)%y >= y%cb(-1)) .and. (probe(i)%y <= y%cb(n))) then do s = -1, m - distx(s) = x_cb(s) - probe(i)%x + distx(s) = x%cb(s) - probe(i)%x if (distx(s) < 0._wp) distx(s) = 1000._wp end do do s = -1, n - disty(s) = y_cb(s) - probe(i)%y + disty(s) = y%cb(s) - probe(i)%y if (disty(s) < 0._wp) disty(s) = 1000._wp end do j = minloc(distx, 1) @@ -1319,19 +1319,19 @@ contains end if end if else - if ((probe(i)%x >= x_cb(-1)) .and. (probe(i)%x <= x_cb(m))) then - if ((probe(i)%y >= y_cb(-1)) .and. (probe(i)%y <= y_cb(n))) then - if ((probe(i)%z >= z_cb(-1)) .and. (probe(i)%z <= z_cb(p))) then + if ((probe(i)%x >= x%cb(-1)) .and. (probe(i)%x <= x%cb(m))) then + if ((probe(i)%y >= y%cb(-1)) .and. (probe(i)%y <= y%cb(n))) then + if ((probe(i)%z >= z%cb(-1)) .and. (probe(i)%z <= z%cb(p))) then do s = -1, m - distx(s) = x_cb(s) - probe(i)%x + distx(s) = x%cb(s) - probe(i)%x if (distx(s) < 0._wp) distx(s) = 1000._wp end do do s = -1, n - disty(s) = y_cb(s) - probe(i)%y + disty(s) = y%cb(s) - probe(i)%y if (disty(s) < 0._wp) disty(s) = 1000._wp end do do s = -1, p - distz(s) = z_cb(s) - probe(i)%z + distz(s) = z%cb(s) - probe(i)%z if (distz(s) < 0._wp) distz(s) = 1000._wp end do j = minloc(distx, 1) @@ -1485,7 +1485,7 @@ contains pi_inf = 0._wp qv = 0._wp - if ((integral(i)%xmin <= x_cb(j)) .and. (integral(i)%xmax >= x_cb(j))) then + if ((integral(i)%xmin <= x%cb(j)) .and. (integral(i)%xmax >= x%cb(j))) then npts = npts + 1 call s_convert_to_mixture_variables(q_cons_vf, j, k, l, rho, gamma, pi_inf, qv, Re) do s = 1, num_vels @@ -1528,14 +1528,14 @@ contains trigger = .false. if (i == 1) then ! inner portion - if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) < (rad - 0.5_wp*thickness)) trigger = .true. + if (sqrt(x%cb(j)**2._wp + y%cb(k)**2._wp) < (rad - 0.5_wp*thickness)) trigger = .true. else if (i == 2) then ! net region - if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) > (rad - 0.5_wp*thickness) .and. sqrt(x_cb(j)**2._wp & - & + y_cb(k)**2._wp) < (rad + 0.5_wp*thickness)) trigger = .true. + if (sqrt(x%cb(j)**2._wp + y%cb(k)**2._wp) > (rad - 0.5_wp*thickness) .and. sqrt(x%cb(j)**2._wp & + & + y%cb(k)**2._wp) < (rad + 0.5_wp*thickness)) trigger = .true. else if (i == 3) then ! everything else - if (sqrt(x_cb(j)**2._wp + y_cb(k)**2._wp) > (rad + 0.5_wp*thickness)) trigger = .true. + if (sqrt(x%cb(j)**2._wp + y%cb(k)**2._wp) > (rad + 0.5_wp*thickness)) trigger = .true. end if pres = 0._wp diff --git a/src/simulation/m_derived_variables.fpp b/src/simulation/m_derived_variables.fpp index 22c0477065..287d046489 100644 --- a/src/simulation/m_derived_variables.fpp +++ b/src/simulation/m_derived_variables.fpp @@ -81,15 +81,15 @@ contains call s_open_com_files() end if ! Computing centered finite difference coefficients - call s_compute_finite_difference_coefficients(m, x_cc, fd_coeff_x, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(m, x%cc, fd_coeff_x, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_x]') if (n > 0) then - call s_compute_finite_difference_coefficients(n, y_cc, fd_coeff_y, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(n, y%cc, fd_coeff_y, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_y]') end if if (p > 0) then - call s_compute_finite_difference_coefficients(p, z_cc, fd_coeff_z, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(p, z%cc, fd_coeff_z, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_z]') end if end if @@ -205,7 +205,7 @@ contains & j)*q_prim_vf0(eqn_idx%mom%beg)%sf(r + j, k, l) + q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, & & k, l)*fd_coeff_y(r, k)*q_prim_vf0(eqn_idx%mom%beg)%sf(j, r + k, & & l) + q_prim_vf0(eqn_idx%mom%end)%sf(j, k, l)*fd_coeff_z(r, & - & l)*q_prim_vf0(eqn_idx%mom%beg)%sf(j, k, r + l)/y_cc(k) + & l)*q_prim_vf0(eqn_idx%mom%beg)%sf(j, k, r + l)/y%cc(k) end do end do end do @@ -270,7 +270,7 @@ contains & l) + q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, k, l)*fd_coeff_y(r, & & k)*q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, r + k, l) + q_prim_vf0(eqn_idx%mom%end)%sf(j, & & k, l)*fd_coeff_z(r, l)*q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, k, & - & r + l)/y_cc(k) - (q_prim_vf0(eqn_idx%mom%end)%sf(j, k, l)**2._wp)/y_cc(k) + & r + l)/y%cc(k) - (q_prim_vf0(eqn_idx%mom%end)%sf(j, k, l)**2._wp)/y%cc(k) end do end do end do @@ -319,8 +319,8 @@ contains & l)*fd_coeff_y(r, k)*q_prim_vf0(eqn_idx%mom%end)%sf(j, r + k, & & l) + q_prim_vf0(eqn_idx%mom%end)%sf(j, k, l)*fd_coeff_z(r, & & l)*q_prim_vf0(eqn_idx%mom%end)%sf(j, k, & - & r + l)/y_cc(k) + (q_prim_vf0(eqn_idx%mom%end)%sf(j, k, & - & l)*q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, k, l))/y_cc(k) + & r + l)/y%cc(k) + (q_prim_vf0(eqn_idx%mom%end)%sf(j, k, & + & l)*q_prim_vf0(eqn_idx%mom%beg + 1)%sf(j, k, l))/y%cc(k) end do end do end do @@ -367,13 +367,13 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids ! Loop over individual fluids - dV = dx(j) + dV = x%spacing(j) ! Mass $:GPU_ATOMIC(atomic='update') c_m(i, 1) = c_m(i, 1) + q_vf(i)%sf(j, k, l)*dV ! x-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x_cc(j) + c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x%cc(j) ! Volume fraction $:GPU_ATOMIC(atomic='update') c_m(i, 5) = c_m(i, 5) + q_vf(i + eqn_idx%adv%beg - 1)%sf(j, k, l)*dV @@ -389,16 +389,16 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids ! Loop over individual fluids - dV = dx(j)*dy(k) + dV = x%spacing(j)*y%spacing(k) ! Mass $:GPU_ATOMIC(atomic='update') c_m(i, 1) = c_m(i, 1) + q_vf(i)%sf(j, k, l)*dV ! x-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x_cc(j) + c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x%cc(j) ! y-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 3) = c_m(i, 3) + q_vf(i)%sf(j, k, l)*dV*y_cc(k) + c_m(i, 3) = c_m(i, 3) + q_vf(i)%sf(j, k, l)*dV*y%cc(k) ! Volume fraction $:GPU_ATOMIC(atomic='update') c_m(i, 5) = c_m(i, 5) + q_vf(i + eqn_idx%adv%beg - 1)%sf(j, k, l)*dV @@ -414,19 +414,19 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids ! Loop over individual fluids - dV = dx(j)*dy(k)*dz(l) + dV = x%spacing(j)*y%spacing(k)*z%spacing(l) ! Mass $:GPU_ATOMIC(atomic='update') c_m(i, 1) = c_m(i, 1) + q_vf(i)%sf(j, k, l)*dV ! x-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x_cc(j) + c_m(i, 2) = c_m(i, 2) + q_vf(i)%sf(j, k, l)*dV*x%cc(j) ! y-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 3) = c_m(i, 3) + q_vf(i)%sf(j, k, l)*dV*y_cc(k) + c_m(i, 3) = c_m(i, 3) + q_vf(i)%sf(j, k, l)*dV*y%cc(k) ! z-location weighted $:GPU_ATOMIC(atomic='update') - c_m(i, 4) = c_m(i, 4) + q_vf(i)%sf(j, k, l)*dV*z_cc(l) + c_m(i, 4) = c_m(i, 4) + q_vf(i)%sf(j, k, l)*dV*z%cc(l) ! Volume fraction $:GPU_ATOMIC(atomic='update') c_m(i, 5) = c_m(i, 5) + q_vf(i + eqn_idx%adv%beg - 1)%sf(j, k, l)*dV diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 8842759cbe..b8a756640f 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -48,23 +48,17 @@ module m_global_parameters !> @} $:GPU_DECLARE(create='[cyl_coord, grid_geometry]') - !> @name Cell-boundary (CB) locations in the x-, y- and z-directions, respectively + !> @name Cell-boundary (cb), cell-center (cc), and spacing arrays per direction !> @{ - real(wp), target, allocatable, dimension(:) :: x_cb, y_cb, z_cb - !> @} - - !> @name Cell-center (CC) locations in the x-, y- and z-directions, respectively - !> @{ - real(wp), target, allocatable, dimension(:) :: x_cc, y_cc, z_cc - !> @} - ! type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions - !> @name Cell-width distributions in the x-, y- and z-directions, respectively - !> @{ - real(wp), target, allocatable, dimension(:) :: dx, dy, dz + type(grid_axis), target :: x, y, z !> @} real(wp) :: dt !< Size of the time-step - $:GPU_DECLARE(create='[x_cb, y_cb, z_cb, x_cc, y_cc, z_cc, dx, dy, dz, dt, m, n, p]') +#if defined(MFC_OpenACC) + $:GPU_DECLARE(create='[x%cb, y%cb, z%cb, x%cc, y%cc, z%cc, x%spacing, y%spacing, z%spacing, dt, m, n, p]') +#elif defined(MFC_OpenMP) + $:GPU_DECLARE(create='[x, y, z, dt, m, n, p]') +#endif !> @name Starting time-step iteration, stopping time-step iteration and the number of time-step iterations between successive !! solution backups, respectively @@ -1239,28 +1233,28 @@ contains $:GPU_UPDATE(device='[relax, relax_model, palpha_eps, ptgalpha_eps]') ! Allocating grid variables for the x-, y- and z-directions - @:ALLOCATE(x_cb(-1 - buff_size:m + buff_size)) - @:ALLOCATE(x_cc(-buff_size:m + buff_size)) - @:ALLOCATE(dx(-buff_size:m + buff_size)) - @:PREFER_GPU(x_cb) - @:PREFER_GPU(x_cc) - @:PREFER_GPU(dx) + @:ALLOCATE(x%cb(-1 - buff_size:m + buff_size)) + @:ALLOCATE(x%cc(-buff_size:m + buff_size)) + @:ALLOCATE(x%spacing(-buff_size:m + buff_size)) + @:PREFER_GPU(x%cb) + @:PREFER_GPU(x%cc) + @:PREFER_GPU(x%spacing) if (n == 0) return - @:ALLOCATE(y_cb(-1 - buff_size:n + buff_size)) - @:ALLOCATE(y_cc(-buff_size:n + buff_size)) - @:ALLOCATE(dy(-buff_size:n + buff_size)) - @:PREFER_GPU(y_cb) - @:PREFER_GPU(y_cc) - @:PREFER_GPU(dy) + @:ALLOCATE(y%cb(-1 - buff_size:n + buff_size)) + @:ALLOCATE(y%cc(-buff_size:n + buff_size)) + @:ALLOCATE(y%spacing(-buff_size:n + buff_size)) + @:PREFER_GPU(y%cb) + @:PREFER_GPU(y%cc) + @:PREFER_GPU(y%spacing) if (p == 0) return - @:ALLOCATE(z_cb(-1 - buff_size:p + buff_size)) - @:ALLOCATE(z_cc(-buff_size:p + buff_size)) - @:ALLOCATE(dz(-buff_size:p + buff_size)) - @:PREFER_GPU(z_cb) - @:PREFER_GPU(z_cc) - @:PREFER_GPU(dz) + @:ALLOCATE(z%cb(-1 - buff_size:p + buff_size)) + @:ALLOCATE(z%cc(-buff_size:p + buff_size)) + @:ALLOCATE(z%spacing(-buff_size:p + buff_size)) + @:PREFER_GPU(z%cb) + @:PREFER_GPU(z%cc) + @:PREFER_GPU(z%spacing) end subroutine s_initialize_global_parameters_module @@ -1341,13 +1335,13 @@ contains if (ib) MPI_IO_IB_DATA%var%sf => null() ! Deallocating grid variables for the x-, y- and z-directions - @:DEALLOCATE(x_cb, x_cc, dx) + @:DEALLOCATE(x%cb, x%cc, x%spacing) if (n == 0) return - @:DEALLOCATE(y_cb, y_cc, dy) + @:DEALLOCATE(y%cb, y%cc, y%spacing) if (p == 0) return - @:DEALLOCATE(z_cb, z_cc, dz) + @:DEALLOCATE(z%cb, z%cc, z%spacing) end subroutine s_finalize_global_parameters_module diff --git a/src/simulation/m_hyperelastic.fpp b/src/simulation/m_hyperelastic.fpp index 90e78d04df..5fa888981e 100644 --- a/src/simulation/m_hyperelastic.fpp +++ b/src/simulation/m_hyperelastic.fpp @@ -58,14 +58,14 @@ contains end if ! Computing centered finite difference coefficients - call s_compute_finite_difference_coefficients(m, x_cc, fd_coeff_x_hyper, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(m, x%cc, fd_coeff_x_hyper, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_x_hyper]') if (n > 0) then - call s_compute_finite_difference_coefficients(n, y_cc, fd_coeff_y_hyper, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(n, y%cc, fd_coeff_y_hyper, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_y_hyper]') end if if (p > 0) then - call s_compute_finite_difference_coefficients(p, z_cc, fd_coeff_z_hyper, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(p, z%cc, fd_coeff_z_hyper, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_z_hyper]') end if diff --git a/src/simulation/m_hypoelastic.fpp b/src/simulation/m_hypoelastic.fpp index 390a873377..8165e8f5bc 100644 --- a/src/simulation/m_hypoelastic.fpp +++ b/src/simulation/m_hypoelastic.fpp @@ -65,14 +65,14 @@ contains end if ! Computing centered finite difference coefficients - call s_compute_finite_difference_coefficients(m, x_cc, fd_coeff_x_hypo, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(m, x%cc, fd_coeff_x_hypo, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_x_hypo]') if (n > 0) then - call s_compute_finite_difference_coefficients(n, y_cc, fd_coeff_y_hypo, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(n, y%cc, fd_coeff_y_hypo, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_y_hypo]') end if if (p > 0) then - call s_compute_finite_difference_coefficients(p, z_cc, fd_coeff_z_hypo, buff_size, fd_number, fd_order) + call s_compute_finite_difference_coefficients(p, z%cc, fd_coeff_z_hypo, buff_size, fd_number, fd_order) $:GPU_UPDATE(device='[fd_coeff_z_hypo]') end if @@ -301,25 +301,27 @@ contains do k = 0, m ! S_xx -= rho * v/r * (tau_xx + 2/3*G) rhs_vf(eqn_idx%stress%beg)%sf(k, l, q) = rhs_vf(eqn_idx%stress%beg)%sf(k, l, q) - rho_K_field(k, l, & - & q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y_cc(l)*(q_prim_vf(eqn_idx%stress%beg)%sf(k, l, & + & q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y%cc(l)*(q_prim_vf(eqn_idx%stress%beg)%sf(k, l, & & q) + (2._wp/3._wp)*G_K_field(k, l, q)) ! tau_xx + 2/3*G ! S_xr -= rho * v/r * tau_xr rhs_vf(eqn_idx%stress%beg + 1)%sf(k, l, q) = rhs_vf(eqn_idx%stress%beg + 1)%sf(k, l, q) - rho_K_field(k, & - & l, q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y_cc(l)*q_prim_vf(eqn_idx%stress%beg + 1)%sf(k, & + & l, q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y%cc(l)*q_prim_vf(eqn_idx%stress%beg + 1)%sf(k, & & l, q) ! tau_xx ! S_rr -= rho * v/r * (tau_rr + 2/3*G) rhs_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) = rhs_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) - rho_K_field(k, & & l, q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, & - & q)/y_cc(l)*(q_prim_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) + (2._wp/3._wp)*G_K_field(k, l, q)) ! tau_rr + 2/3*G + & q)/y%cc(l)*(q_prim_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) + (2._wp/3._wp)*G_K_field(k, l, & + & q)) ! tau_rr + 2/3*G - ! S_thetatheta += rho * ( -(tau_thetatheta + 2/3*G)*(du/dx + dv/dr + v/r) + 2*(tau_thetatheta + G)*v/r ) + ! S_thetatheta += rho * ( -(tau_thetatheta + 2/3*G)*(du/x%spacing + dv/dr + v/r) + 2*(tau_thetatheta + + ! G)*v/r ) rhs_vf(eqn_idx%stress%beg + 3)%sf(k, l, q) = rhs_vf(eqn_idx%stress%beg + 3)%sf(k, l, q) + rho_K_field(k, & & l, q)*(-(q_prim_vf(eqn_idx%stress%beg + 3)%sf(k, l, q) + (2._wp/3._wp)*G_K_field(k, l, & & q))*(du_dx_hypo(k, l, q) + dv_dy_hypo(k, l, q) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, & - & q)/y_cc(l)) + 2._wp*(q_prim_vf(eqn_idx%stress%beg + 3)%sf(k, l, q) + G_K_field(k, l, & - & q))*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y_cc(l)) + & q)/y%cc(l)) + 2._wp*(q_prim_vf(eqn_idx%stress%beg + 3)%sf(k, l, q) + G_K_field(k, l, & + & q))*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, q)/y%cc(l)) end do end do end do diff --git a/src/simulation/m_ib_patches.fpp b/src/simulation/m_ib_patches.fpp index b21483e097..b988340d83 100644 --- a/src/simulation/m_ib_patches.fpp +++ b/src/simulation/m_ib_patches.fpp @@ -111,15 +111,15 @@ contains jl = -gp_layers - 1 ir = m + gp_layers + 1 jr = n + gp_layers + 1 - call get_bounding_indices(center(1) - radius, center(1) + radius, x_cc, il, ir) - call get_bounding_indices(center(2) - radius, center(2) + radius, y_cc, jl, jr) + call get_bounding_indices(center(1) - radius, center(1) + radius, x%cc, il, ir) + call get_bounding_indices(center(2) - radius, center(2) + radius, y%cc, jl, jr) ! Assign primitive variables if circle covers cell and patch has write permission $:GPU_PARALLEL_LOOP(private='[i, j]', copyin='[encoded_patch_id, center, radius]', collapse=2) do j = jl, jr do i = il, ir - if ((x_cc(i) - center(1))**2 + (y_cc(j) - center(2))**2 <= radius**2) then + if ((x%cc(i) - center(1))**2 + (y%cc(j) - center(2))**2 <= radius**2) then ib_markers%sf(i, j, 0) = encoded_patch_id end if end do @@ -152,8 +152,8 @@ contains inverse_rotation(:,:) = patch_ib(patch_id)%rotation_matrix_inverse(:,:) offset(:) = patch_ib(patch_id)%centroid_offset(:) - Np1 = int((pa*ca_in/dx(0))*20) - Np2 = int(((ca_in - pa*ca_in)/dx(0))*20) + Np1 = int((pa*ca_in/x%spacing(0))*20) + Np2 = int(((ca_in - pa*ca_in)/x%spacing(0))*20) Np = Np1 + Np2 + 1 $:GPU_UPDATE(device='[Np]') @@ -224,14 +224,14 @@ contains ir = m + gp_layers + 1 jr = n + gp_layers + 1 ! maximum distance any marker can be from the center is the length of the airfoil - call get_bounding_indices(center(1) - ca_in, center(1) + ca_in, x_cc, il, ir) - call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y_cc, jl, jr) + call get_bounding_indices(center(1) - ca_in, center(1) + ca_in, x%cc, il, ir) + call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y%cc, jl, jr) $:GPU_PARALLEL_LOOP(private='[i, j, xy_local, k, f]', copyin='[encoded_patch_id, center, inverse_rotation, offset, ma, & & ca_in, airfoil_grid_u, airfoil_grid_l]', collapse=2) do j = jl, jr do i = il, ir - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB xy_local = matmul(inverse_rotation, xy_local) ! rotate the frame into the IB's coordinates xy_local = xy_local - offset ! airfoils are a patch that require a centroid offset @@ -310,8 +310,8 @@ contains z_max = lz/2 z_min = -lz/2 - Np1 = int((pa*ca_in/dx(0))*20) - Np2 = int(((ca_in - pa*ca_in)/dx(0))*20) + Np1 = int((pa*ca_in/x%spacing(0))*20) + Np2 = int(((ca_in - pa*ca_in)/x%spacing(0))*20) Np = Np1 + Np2 + 1 $:GPU_UPDATE(device='[Np]') @@ -381,9 +381,9 @@ contains jr = n + gp_layers + 1 lr = p + gp_layers + 1 ! maximum distance any marker can be from the center is the length of the airfoil - call get_bounding_indices(center(1) - ca_in, center(1) + ca_in, x_cc, il, ir) - call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y_cc, jl, jr) - call get_bounding_indices(center(3) - ca_in, center(3) + ca_in, z_cc, ll, lr) + call get_bounding_indices(center(1) - ca_in, center(1) + ca_in, x%cc, il, ir) + call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y%cc, jl, jr) + call get_bounding_indices(center(3) - ca_in, center(3) + ca_in, z%cc, ll, lr) $:GPU_PARALLEL_LOOP(private='[i, j, l, xyz_local, k, f]', copyin='[encoded_patch_id, center, inverse_rotation, offset, & & ma, ca_in, airfoil_grid_u, airfoil_grid_l, z_min, z_max]', collapse=3) @@ -391,7 +391,7 @@ contains do j = jl, jr do i = il, ir ! get coordinate frame centered on IB - xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(l) - center(3)] + xyz_local = [x%cc(i) - center(1), y%cc(j) - center(2), z%cc(l) - center(3)] xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates xyz_local = xyz_local - offset ! airfoils are a patch that require a centroid offset @@ -469,16 +469,16 @@ contains ir = m + gp_layers + 1 jr = n + gp_layers + 1 corner_distance = sqrt(dot_product(length, length))/2._wp ! maximum distance any marker can be from the center - call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x_cc, il, ir) - call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y_cc, jl, jr) + call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x%cc, il, ir) + call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y%cc, jl, jr) ! Assign primitive variables if rectangle covers cell and patch has write permission - $:GPU_PARALLEL_LOOP(private='[i, j, xy_local]', copyin='[encoded_patch_id, center, length, inverse_rotation, x_cc, & - & y_cc]', collapse=2) + $:GPU_PARALLEL_LOOP(private='[i, j, xy_local]', copyin='[encoded_patch_id, center, length, inverse_rotation, x%cc, & + & y%cc]', collapse=2) do j = jl, jr do i = il, ir ! get the x and y coordinates in the local IB frame - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] xy_local = matmul(inverse_rotation, xy_local) if (-0.5_wp*length(1) <= xy_local(1) .and. 0.5_wp*length(1) >= xy_local(1) .and. -0.5_wp*length(2) <= xy_local(2) & @@ -515,9 +515,9 @@ contains radius = patch_ib(patch_id)%radius ! completely skip particles no in the domain - if (center(1) - radius > x_cc(m + gp_layers + 1) .or. center(1) + radius < x_cc(-gp_layers - 1) .or. center(2) & - & - radius > y_cc(n + gp_layers + 1) .or. center(2) + radius < y_cc(-gp_layers - 1) .or. center(3) - radius > z_cc(p & - & + gp_layers + 1) .or. center(3) + radius < z_cc(-gp_layers - 1)) then + if (center(1) - radius > x%cc(m + gp_layers + 1) .or. center(1) + radius < x%cc(-gp_layers - 1) .or. center(2) & + & - radius > y%cc(n + gp_layers + 1) .or. center(2) + radius < y%cc(-gp_layers - 1) .or. center(3) - radius > z%cc(p & + & + gp_layers + 1) .or. center(3) + radius < z%cc(-gp_layers - 1)) then return end if @@ -531,9 +531,9 @@ contains ir = m + gp_layers + 1 jr = n + gp_layers + 1 kr = p + gp_layers + 1 - call get_bounding_indices(center(1) - radius, center(1) + radius, x_cc, il, ir) - call get_bounding_indices(center(2) - radius, center(2) + radius, y_cc, jl, jr) - call get_bounding_indices(center(3) - radius, center(3) + radius, z_cc, kl, kr) + call get_bounding_indices(center(1) - radius, center(1) + radius, x%cc, il, ir) + call get_bounding_indices(center(2) - radius, center(2) + radius, y%cc, jl, jr) + call get_bounding_indices(center(3) - radius, center(3) + radius, z%cc, kl, kr) ! Checking whether the sphere covers a particular cell in the domain and verifying whether the current patch has permission ! to write to that cell. If both queries check out, the primitive variables of the current patch are assigned to this cell. @@ -542,7 +542,7 @@ contains do j = jl, jr do i = il, ir ! Updating the patch identities bookkeeping variable - if (((x_cc(i) - center(1))**2 + (y_cc(j) - center(2))**2 + (z_cc(k) - center(3))**2 <= radius**2)) then + if (((x%cc(i) - center(1))**2 + (y%cc(j) - center(2))**2 + (z%cc(k) - center(3))**2 <= radius**2)) then ib_markers%sf(i, j, k) = encoded_patch_id end if end do @@ -585,9 +585,9 @@ contains jr = n + gp_layers + 1 kr = p + gp_layers + 1 corner_distance = sqrt(dot_product(length, length))/2._wp ! maximum distance any marker can be from the center - call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x_cc, il, ir) - call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y_cc, jl, jr) - call get_bounding_indices(center(3) - corner_distance, center(3) + corner_distance, z_cc, kl, kr) + call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x%cc, il, ir) + call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y%cc, jl, jr) + call get_bounding_indices(center(3) - corner_distance, center(3) + corner_distance, z%cc, kl, kr) ! Checking whether the cuboid covers a particular cell in the domain and verifying whether the current patch has permission ! to write to to that cell. If both queries check out, the primitive variables of the current patch are assigned to this @@ -597,7 +597,7 @@ contains do k = kl, kr do j = jl, jr do i = il, ir - xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB + xyz_local = [x%cc(i), y%cc(j), z%cc(k)] - center ! get coordinate frame centered on IB xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates if (-0.5*length(1) <= xyz_local(1) .and. 0.5*length(1) >= xyz_local(1) .and. -0.5*length(2) <= xyz_local(2) & @@ -647,9 +647,9 @@ contains jr = n + gp_layers + 1 kr = p + gp_layers + 1 corner_distance = sqrt(radius**2 + maxval(length)**2) ! distance to rim of cylinder - call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x_cc, il, ir) - call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y_cc, jl, jr) - call get_bounding_indices(center(3) - corner_distance, center(3) + corner_distance, z_cc, kl, kr) + call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x%cc, il, ir) + call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y%cc, jl, jr) + call get_bounding_indices(center(3) - corner_distance, center(3) + corner_distance, z%cc, kl, kr) ! Checking whether the cylinder covers a particular cell in the domain and verifying whether the current patch has the ! permission to write to that cell. If both queries check out, the primitive variables of the current patch are assigned to @@ -659,7 +659,7 @@ contains do k = kl, kr do j = jl, jr do i = il, ir - xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB + xyz_local = [x%cc(i), y%cc(j), z%cc(k)] - center ! get coordinate frame centered on IB xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates if (((.not. f_is_default(length(1)) .and. xyz_local(2)**2 + xyz_local(3)**2 <= radius**2 .and. & @@ -707,16 +707,16 @@ contains jl = -gp_layers - 1 ir = m + gp_layers + 1 jr = n + gp_layers + 1 - call get_bounding_indices(center(1) - maxval(ellipse_coeffs)*2._wp, center(1) + maxval(ellipse_coeffs)*2._wp, x_cc, il, ir) - call get_bounding_indices(center(2) - maxval(ellipse_coeffs)*2._wp, center(2) + maxval(ellipse_coeffs)*2._wp, y_cc, jl, jr) + call get_bounding_indices(center(1) - maxval(ellipse_coeffs)*2._wp, center(1) + maxval(ellipse_coeffs)*2._wp, x%cc, il, ir) + call get_bounding_indices(center(2) - maxval(ellipse_coeffs)*2._wp, center(2) + maxval(ellipse_coeffs)*2._wp, y%cc, jl, jr) ! Checking whether the ellipse covers a particular cell in the domain $:GPU_PARALLEL_LOOP(private='[i, j, xy_local]', copyin='[encoded_patch_id, center, ellipse_coeffs, inverse_rotation, & - & x_cc, y_cc]', collapse=2) + & x%cc, y%cc]', collapse=2) do j = jl, jr do i = il, ir ! get the x and y coordinates in the local IB frame - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] xy_local = matmul(inverse_rotation, xy_local) ! Ellipse condition (x/a)^2 + (y/b)^2 <= 1 @@ -784,14 +784,14 @@ contains end do end do - call get_bounding_indices(bbox_min(1), bbox_max(1), x_cc, il, ir) - call get_bounding_indices(bbox_min(2), bbox_max(2), y_cc, jl, jr) + call get_bounding_indices(bbox_min(1), bbox_max(1), x%cc, il, ir) + call get_bounding_indices(bbox_min(2), bbox_max(2), y%cc, jl, jr) $:GPU_PARALLEL_LOOP(private='[i, j, xy_local, eta]', copyin='[patch_id, encoded_patch_id, center, inverse_rotation, & & offset, spc, threshold]', collapse=2) do i = il, ir do j = jl, jr - xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] + xy_local = [x%cc(i) - center(1), y%cc(j) - center(2), 0._wp] xy_local = matmul(inverse_rotation, xy_local) xy_local = xy_local - offset @@ -869,16 +869,16 @@ contains end do end do - call get_bounding_indices(bbox_min(1), bbox_max(1), x_cc, il, ir) - call get_bounding_indices(bbox_min(2), bbox_max(2), y_cc, jl, jr) - call get_bounding_indices(bbox_min(3), bbox_max(3), z_cc, kl, kr) + call get_bounding_indices(bbox_min(1), bbox_max(1), x%cc, il, ir) + call get_bounding_indices(bbox_min(2), bbox_max(2), y%cc, jl, jr) + call get_bounding_indices(bbox_min(3), bbox_max(3), z%cc, kl, kr) $:GPU_PARALLEL_LOOP(private='[i, j, k, xyz_local, eta]', copyin='[patch_id, encoded_patch_id, center, inverse_rotation, & & offset, spc, threshold]', collapse=3) do i = il, ir do j = jl, jr do k = kl, kr - xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(k) - center(3)] + xyz_local = [x%cc(i) - center(1), y%cc(j) - center(2), z%cc(k) - center(3)] xyz_local = matmul(inverse_rotation, xyz_local) xyz_local = xyz_local - offset diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 39ec6b1470..8103f28d72 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -82,9 +82,9 @@ contains $:GPU_UPDATE(device='[patch_ib(1:num_ibs)]') ! GPU routines require updated cell centers - $:GPU_UPDATE(device='[num_ibs, x_cc, y_cc, dx, dy, x_domain, y_domain, ib_bc_x%beg, ib_bc_y%beg]') + $:GPU_UPDATE(device='[num_ibs, x%cc, y%cc, x%spacing, y%spacing, x_domain, y_domain, ib_bc_x%beg, ib_bc_y%beg]') if (p /= 0) then - $:GPU_UPDATE(device='[z_cc, dz, z_domain, ib_bc_z%beg]') + $:GPU_UPDATE(device='[z%cc, z%spacing, z_domain, ib_bc_z%beg]') end if ! allocate STL models @@ -204,9 +204,9 @@ contains ! Calculate physical location of GP if (p > 0) then - physical_loc = [x_cc(j), y_cc(k), z_cc(l)] + physical_loc = [x%cc(j), y%cc(k), z%cc(l)] else - physical_loc = [x_cc(j), y_cc(k), 0._wp] + physical_loc = [x%cc(j), y%cc(k), 0._wp] end if ! Interpolate primitive variables at image point associated w/ GP @@ -404,9 +404,9 @@ contains ! Calculate physical location of ghost point if (p > 0) then - physical_loc = [x_cc(i), y_cc(j), z_cc(k)] + physical_loc = [x%cc(i), y%cc(j), z%cc(k)] else - physical_loc = [x_cc(i), y_cc(j), 0._wp] + physical_loc = [x%cc(i), y%cc(j), 0._wp] end if ! Calculate and store the precise location of the image point @@ -419,13 +419,13 @@ contains do dim = 1, num_dims ! s_cc points to the dim array we need if (dim == 1) then - s_cc => x_cc + s_cc => x%cc bound = m + buff_size - 1 else if (dim == 2) then - s_cc => y_cc + s_cc => y%cc bound = n + buff_size - 1 else - s_cc => z_cc + s_cc => z%cc bound = p + buff_size - 1 end if @@ -448,15 +448,15 @@ contains print *, "A required image point is not located in this computational domain." print *, "Ghost Point is located at :" if (p == 0) then - print *, [x_cc(i), y_cc(j)] + print *, [x%cc(i), y%cc(j)] else - print *, [x_cc(i), y_cc(j), z_cc(k)] + print *, [x%cc(i), y%cc(j), z%cc(k)] end if print *, "We are searching in dimension ", dim, " for image point at ", ghost_points_in(q)%ip_loc(:) - print *, "Domain size: ", [x_cc(-buff_size), y_cc(-buff_size), z_cc(-buff_size)] - print *, "x: ", x_cc(-buff_size), " to: ", x_cc(m + buff_size - 1) - print *, "y: ", y_cc(-buff_size), " to: ", y_cc(n + buff_size - 1) - if (p /= 0) print *, "z: ", z_cc(-buff_size), " to: ", z_cc(p + buff_size - 1) + print *, "Domain size: ", [x%cc(-buff_size), y%cc(-buff_size), z%cc(-buff_size)] + print *, "x: ", x%cc(-buff_size), " to: ", x%cc(m + buff_size - 1) + print *, "y: ", y%cc(-buff_size), " to: ", y%cc(n + buff_size - 1) + if (p /= 0) print *, "z: ", z%cc(-buff_size), " to: ", z%cc(p + buff_size - 1) print *, "Image point is located approximately ", & & (ghost_points_in(q)%loc(dim) - ghost_points_in(q) %ip_loc(dim))/(s_cc(1) - s_cc(0)), & & " grid cells away" @@ -544,7 +544,8 @@ contains if (p == 0) gp_layers_z = 0 $:GPU_PARALLEL_LOOP(private='[i, j, k, ii, jj, kk, is_gp, local_idx, patch_id, encoded_patch_id, xp, yp, zp]', & - & copyin='[count, count_i, x_domain, y_domain, z_domain]', firstprivate='[gp_layers, gp_layers_z]', collapse=3) + & copyin='[count, count_i, x_domain, y_domain, z_domain]', firstprivate='[gp_layers, gp_layers_z]', & + & collapse=3) do i = 0, m do j = 0, n do k = 0, p @@ -577,26 +578,26 @@ contains ghost_points_in(local_idx)%z_periodicity = zp ghost_points_in(local_idx)%slip = patch_ib(patch_id)%slip - if ((x_cc(i) - dx(i)) < x_domain%beg) then + if ((x%cc(i) - x%spacing(i)) < x_domain%beg) then ghost_points_in(local_idx)%DB(1) = -1 - else if ((x_cc(i) + dx(i)) > x_domain%end) then + else if ((x%cc(i) + x%spacing(i)) > x_domain%end) then ghost_points_in(local_idx)%DB(1) = 1 else ghost_points_in(local_idx)%DB(1) = 0 end if - if ((y_cc(j) - dy(j)) < y_domain%beg) then + if ((y%cc(j) - y%spacing(j)) < y_domain%beg) then ghost_points_in(local_idx)%DB(2) = -1 - else if ((y_cc(j) + dy(j)) > y_domain%end) then + else if ((y%cc(j) + y%spacing(j)) > y_domain%end) then ghost_points_in(local_idx)%DB(2) = 1 else ghost_points_in(local_idx)%DB(2) = 0 end if if (p /= 0) then - if ((z_cc(k) - dz(k)) < z_domain%beg) then + if ((z%cc(k) - z%spacing(k)) < z_domain%beg) then ghost_points_in(local_idx)%DB(3) = -1 - else if ((z_cc(k) + dz(k)) > z_domain%end) then + else if ((z%cc(k) + z%spacing(k)) > z_domain%end) then ghost_points_in(local_idx)%DB(3) = 1 else ghost_points_in(local_idx)%DB(3) = 0 @@ -643,11 +644,11 @@ contains do ii = 0, 1 do jj = 0, 1 if (p == 0) then - dist(1 + ii, 1 + jj, 1) = sqrt((x_cc(i + ii) - gp%ip_loc(1))**2 + (y_cc(j + jj) - gp%ip_loc(2))**2) + dist(1 + ii, 1 + jj, 1) = sqrt((x%cc(i + ii) - gp%ip_loc(1))**2 + (y%cc(j + jj) - gp%ip_loc(2))**2) else do kk = 0, 1 dist(1 + ii, 1 + jj, & - & 1 + kk) = sqrt((x_cc(i + ii) - gp%ip_loc(1))**2 + (y_cc(j + jj) - gp%ip_loc(2))**2 + (z_cc(k & + & 1 + kk) = sqrt((x%cc(i + ii) - gp%ip_loc(1))**2 + (y%cc(j + jj) - gp%ip_loc(2))**2 + (z%cc(k & & + kk) - gp%ip_loc(3))**2) end do end if @@ -890,7 +891,7 @@ contains ! viscous stress tensor with temp vectors to hold divergence calculations real(wp), dimension(1:3,1:3) :: viscous_stress_div, viscous_stress_div_1, viscous_stress_div_2 real(wp), dimension(1:3) :: local_force_contribution, radial_vector, local_torque_contribution - real(wp) :: cell_volume, dx, dy, dz, dynamic_viscosity + real(wp) :: cell_volume, dx_loc, dy_loc, dz_loc, dynamic_viscosity #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: dynamic_viscosities @@ -915,7 +916,7 @@ contains $:GPU_PARALLEL_LOOP(private='[ib_idx, encoded_ib_idx, fluid_idx, radial_vector, local_force_contribution, cell_volume, & & local_torque_contribution, dynamic_viscosity, viscous_stress_div, viscous_stress_div_1, & - & viscous_stress_div_2, dx, dy, dz]', copy='[forces, torques]', copyin='[patch_ib, & + & viscous_stress_div_2, dx_loc, dy_loc, dz_loc]', copy='[forces, torques]', copyin='[patch_ib, & & dynamic_viscosities]', collapse=3) do i = 0, m do j = 0, n @@ -926,31 +927,32 @@ contains ! get the vector pointing to the grid cell from the IB centroid if (num_dims == 3) then - radial_vector = [x_cc(i), y_cc(j), z_cc(k)] - [patch_ib(ib_idx)%x_centroid, & + radial_vector = [x%cc(i), y%cc(j), z%cc(k)] - [patch_ib(ib_idx)%x_centroid, & & patch_ib(ib_idx)%y_centroid, patch_ib(ib_idx)%z_centroid] else - radial_vector = [x_cc(i), y_cc(j), 0._wp] - [patch_ib(ib_idx)%x_centroid, & + radial_vector = [x%cc(i), y%cc(j), 0._wp] - [patch_ib(ib_idx)%x_centroid, & & patch_ib(ib_idx)%y_centroid, 0._wp] end if - dx = x_cc(i + 1) - x_cc(i) - dy = y_cc(j + 1) - y_cc(j) + dx_loc = x%cc(i + 1) - x%cc(i) + dy_loc = y%cc(j + 1) - y%cc(j) local_force_contribution(:) = 0._wp do fluid_idx = 0, num_fluids - 1 ! Get the pressure contribution to force via a finite difference to compute the 2D components of the ! gradient of the pressure and cell volume local_force_contribution(1) = local_force_contribution(1) - (q_prim_vf(eqn_idx%E + fluid_idx)%sf(i & - & + 1, j, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i - 1, j, k))/(2._wp*dx) ! force is the negative pressure gradient + & + 1, j, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i - 1, j, & + & k))/(2._wp*dx_loc) ! force is the negative pressure gradient local_force_contribution(2) = local_force_contribution(2) - (q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, & - & j + 1, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, j - 1, k))/(2._wp*dy) - cell_volume = abs(dx*dy) + & j + 1, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, j - 1, k))/(2._wp*dy_loc) + cell_volume = abs(dx_loc*dy_loc) ! add the 3D component of the pressure gradient, if we are working in 3 dimensions if (num_dims == 3) then - dz = z_cc(k + 1) - z_cc(k) - local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(eqn_idx%E & - & + fluid_idx)%sf(i, j, k + 1) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, & - & j, k - 1))/(2._wp*dz) - cell_volume = abs(cell_volume*dz) + dz_loc = z%cc(k + 1) - z%cc(k) + local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(eqn_idx%E + fluid_idx) & + & %sf(i, j, k + 1) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, j, & + & k - 1))/(2._wp*dz_loc) + cell_volume = abs(cell_volume*dz_loc) end if end do @@ -968,14 +970,14 @@ contains call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i - 1, j, k) call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i + 1, j, k) ! get x derivative of the first-row of viscous stress tensor - viscous_stress_div(1,1:3) = (viscous_stress_div_2(1,1:3) - viscous_stress_div_1(1,1:3))/(2._wp*dx) + viscous_stress_div(1,1:3) = (viscous_stress_div_2(1,1:3) - viscous_stress_div_1(1,1:3))/(2._wp*dx_loc) ! add the x components of the divergence to the force local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(1,1:3) call s_compute_viscous_stress_tensor(viscous_stress_div_1, q_prim_vf, dynamic_viscosity, i, j - 1, k) call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i, j + 1, k) ! get y derivative of the second-row of viscous stress tensor - viscous_stress_div(2,1:3) = (viscous_stress_div_2(2,1:3) - viscous_stress_div_1(2,1:3))/(2._wp*dy) + viscous_stress_div(2,1:3) = (viscous_stress_div_2(2,1:3) - viscous_stress_div_1(2,1:3))/(2._wp*dy_loc) ! add the y components of the divergence to the force local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(2,1:3) @@ -985,7 +987,8 @@ contains call s_compute_viscous_stress_tensor(viscous_stress_div_2, q_prim_vf, dynamic_viscosity, i, j, & & k + 1) ! get z derivative of the third-row of viscous stress tensor - viscous_stress_div(3,1:3) = (viscous_stress_div_2(3,1:3) - viscous_stress_div_1(3,1:3))/(2._wp*dz) + viscous_stress_div(3,1:3) = (viscous_stress_div_2(3,1:3) - viscous_stress_div_1(3, & + & 1:3))/(2._wp*dz_loc) ! add the z components of the divergence to the force local_force_contribution(1:3) = local_force_contribution(1:3) + viscous_stress_div(3,1:3) end if @@ -1058,8 +1061,8 @@ contains ! Offset only needs to be computes for specific geometries - if (patch_ib(ib_marker)%geometry == 4 .or. patch_ib(ib_marker)%geometry == 5 .or. patch_ib(ib_marker)%geometry == 11 & - & .or. patch_ib(ib_marker)%geometry == 12) then + if (patch_ib(ib_marker)%geometry == 4 .or. patch_ib(ib_marker)%geometry == 5 .or. patch_ib(ib_marker) & + & %geometry == 11 .or. patch_ib(ib_marker)%geometry == 12) then center_of_mass_local = [0._wp, 0._wp, 0._wp] num_cells_local = 0 @@ -1069,8 +1072,8 @@ contains do k = 0, p if (ib_markers%sf(i, j, k) == ib_marker) then num_cells_local = num_cells_local + 1 - center_of_mass_local = center_of_mass_local + [x_cc(i), y_cc(j), 0._wp] - if (num_dims == 3) center_of_mass_local(3) = center_of_mass_local(3) + z_cc(k) + center_of_mass_local = center_of_mass_local + [x%cc(i), y%cc(j), 0._wp] + if (num_dims == 3) center_of_mass_local(3) = center_of_mass_local(3) + z%cc(k) end if end do end do @@ -1128,20 +1131,20 @@ contains if (patch_ib(ib_marker)%geometry == 2) then ! circle patch_ib(ib_marker)%moment = 0.5_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2 else if (patch_ib(ib_marker)%geometry == 3) then ! rectangle - patch_ib(ib_marker)%moment = patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 & - & + patch_ib(ib_marker)%length_y**2)/6._wp + patch_ib(ib_marker)%moment = patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker) & + & %length_y**2)/6._wp else if (patch_ib(ib_marker)%geometry == 6) then ! ellipse - patch_ib(ib_marker)%moment = 0.0625_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 & - & + patch_ib(ib_marker)%length_y**2) + patch_ib(ib_marker)%moment = 0.0625_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker) & + & %length_y**2) else if (patch_ib(ib_marker)%geometry == 8) then ! sphere patch_ib(ib_marker)%moment = 0.4*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2 else ! we do not have an analytic moment of inertia calculation and need to approximate it directly via a sum count = 0 moment = 0._wp - cell_volume = (x_cc(1) - x_cc(0))*(y_cc(1) - y_cc(0)) + cell_volume = (x%cc(1) - x%cc(0))*(y%cc(1) - y%cc(0)) ! computed without grid stretching. Update in the loop to perform with stretching if (p /= 0) then - cell_volume = cell_volume*(z_cc(1) - z_cc(0)) + cell_volume = cell_volume*(z%cc(1) - z%cc(0)) end if $:GPU_PARALLEL_LOOP(private='[position, closest_point_along_axis, vector_to_axis, distance_to_axis]', copy='[moment, & @@ -1155,10 +1158,10 @@ contains ! get the position in local coordinates so that the axis passes through 0, 0, 0 if (p == 0) then - position = [x_cc(i), y_cc(j), 0._wp] - [patch_ib(ib_marker)%x_centroid, & + position = [x%cc(i), y%cc(j), 0._wp] - [patch_ib(ib_marker)%x_centroid, & & patch_ib(ib_marker)%y_centroid, 0._wp] else - position = [x_cc(i), y_cc(j), z_cc(k)] - [patch_ib(ib_marker)%x_centroid, & + position = [x%cc(i), y%cc(j), z%cc(k)] - [patch_ib(ib_marker)%x_centroid, & & patch_ib(ib_marker)%y_centroid, patch_ib(ib_marker)%z_centroid] end if diff --git a/src/simulation/m_igr.fpp b/src/simulation/m_igr.fpp index 9b9cf64133..f0788fcf79 100644 --- a/src/simulation/m_igr.fpp +++ b/src/simulation/m_igr.fpp @@ -158,9 +158,9 @@ contains $:END_GPU_PARALLEL_LOOP() if (p == 0) then - alf_igr = alf_factor*max(dx(1), dy(1))**2._wp + alf_igr = alf_factor*max(x%spacing(1), y%spacing(1))**2._wp else - alf_igr = alf_factor*max(dx(1), dy(1), dz(1))**2._wp + alf_igr = alf_factor*max(x%spacing(1), y%spacing(1), z%spacing(1))**2._wp end if $:GPU_UPDATE(device='[alf_igr]') @@ -261,37 +261,37 @@ contains fd_coeff = fd_coeff + q_cons_vf(i)%sf(j, k, l) end do - fd_coeff = 1._wp/fd_coeff + alf_igr*((1._wp/dx(j)**2._wp)*(1._wp/rho_lx + 1._wp/rho_rx) + (1._wp/dy(k) & - & **2._wp)*(1._wp/rho_ly + 1._wp/rho_ry)) + fd_coeff = 1._wp/fd_coeff + alf_igr*((1._wp/x%spacing(j)**2._wp)*(1._wp/rho_lx + 1._wp/rho_rx) & + & + (1._wp/y%spacing(k)**2._wp)*(1._wp/rho_ly + 1._wp/rho_ry)) if (num_dims == 3) then - fd_coeff = fd_coeff + alf_igr*(1._wp/dz(l)**2._wp)*(1._wp/rho_lz + 1._wp/rho_rz) + fd_coeff = fd_coeff + alf_igr*(1._wp/z%spacing(l)**2._wp)*(1._wp/rho_lz + 1._wp/rho_rz) end if if (igr_iter_solver == 1) then ! Jacobi iteration if (num_dims == 3) then - jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/dx(j)**2._wp)*(jac_old(j - 1, k, & - & l)/rho_lx + jac_old(j + 1, k, l)/rho_rx) + (1._wp/dy(k)**2._wp)*(jac_old(j, k - 1, & - & l)/rho_ly + jac_old(j, k + 1, l)/rho_ry) + (1._wp/dz(l)**2._wp)*(jac_old(j, k, & + jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/x%spacing(j)**2._wp)*(jac_old(j - 1, k, & + & l)/rho_lx + jac_old(j + 1, k, l)/rho_rx) + (1._wp/y%spacing(k)**2._wp)*(jac_old(j, k - 1, & + & l)/rho_ly + jac_old(j, k + 1, l)/rho_ry) + (1._wp/z%spacing(l)**2._wp)*(jac_old(j, k, & & l - 1)/rho_lz + jac_old(j, k, l + 1)/rho_rz)) + real(jac_rhs(j, k, l), kind=wp)/fd_coeff, & & kind=stp) else - jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/dx(j)**2._wp)*(real(jac_old(j - 1, k, l), & + jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/x%spacing(j)**2._wp)*(real(jac_old(j - 1, k, l), & & kind=wp)/rho_lx + real(jac_old(j + 1, k, l), & - & kind=wp)/rho_rx) + (1._wp/dy(k)**2._wp)*(real(jac_old(j, k - 1, l), & + & kind=wp)/rho_rx) + (1._wp/y%spacing(k)**2._wp)*(real(jac_old(j, k - 1, l), & & kind=wp)/rho_ly + real(jac_old(j, k + 1, l), kind=wp)/rho_ry)) + real(jac_rhs(j, k, l), & & kind=wp)/fd_coeff, kind=stp) end if else ! Gauss Seidel iteration if (num_dims == 3) then - jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/dx(j)**2._wp)*(jac(j - 1, k, & - & l)/rho_lx + jac(j + 1, k, l)/rho_rx) + (1._wp/dy(k)**2._wp)*(jac(j, k - 1, & - & l)/rho_ly + jac(j, k + 1, l)/rho_ry) + (1._wp/dz(l)**2._wp)*(jac(j, k, & + jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/x%spacing(j)**2._wp)*(jac(j - 1, k, & + & l)/rho_lx + jac(j + 1, k, l)/rho_rx) + (1._wp/y%spacing(k)**2._wp)*(jac(j, k - 1, & + & l)/rho_ly + jac(j, k + 1, l)/rho_ry) + (1._wp/z%spacing(l)**2._wp)*(jac(j, k, & & l - 1)/rho_lz + jac(j, k, l + 1)/rho_rz)) + real(jac_rhs(j, k, l), kind=wp)/fd_coeff, & & kind=stp) else - jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/dx(j)**2._wp)*(jac(j - 1, k, & - & l)/rho_lx + jac(j + 1, k, l)/rho_rx) + (1._wp/dy(k)**2._wp)*(jac(j, k - 1, & + jac(j, k, l) = real((alf_igr/fd_coeff)*((1._wp/x%spacing(j)**2._wp)*(jac(j - 1, k, & + & l)/rho_lx + jac(j + 1, k, l)/rho_rx) + (1._wp/y%spacing(k)**2._wp)*(jac(j, k - 1, & & l)/rho_ly + jac(j, k + 1, l)/rho_ry)) + real(jac_rhs(j, k, l), kind=wp)/fd_coeff, kind=stp) end if end if @@ -380,16 +380,16 @@ contains #:for LR in ['L', 'R'] $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) + real(0.5_wp*dt*F_${LR}$*(1._wp/dx(j + 1)), kind=stp) + & l) + real(0.5_wp*dt*F_${LR}$*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) + real(0.5_wp*dt*vel_${LR}$*F_${LR}$*(1._wp/dx(j + 1)), kind=stp) + & l) + real(0.5_wp*dt*vel_${LR}$*F_${LR}$*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') - rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, l) - real(0.5_wp*dt*F_${LR}$*(1._wp/dx(j)), & - & kind=stp) + rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & + & l) - real(0.5_wp*dt*F_${LR}$*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*vel_${LR}$*F_${LR}$*(1._wp/dx(j)), kind=stp) + & l) - real(0.5_wp*dt*vel_${LR}$*F_${LR}$*(1._wp/x%spacing(j)), kind=stp) #:endfor end do end do @@ -456,10 +456,10 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dx(j)))*(1._wp*q_cons_vf(igr_momxb)%sf(j + 1 + q, k, & + dvel_small(1) = (1/(2._wp*x%spacing(j)))*(1._wp*q_cons_vf(igr_momxb)%sf(j + 1 + q, k, & & l)/rho_sf_small(1) - 1._wp*q_cons_vf(igr_momxb)%sf(j - 1 + q, k, & & l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1 + q, k, & + dvel_small(2) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1 + q, k, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j - 1 + q, k, l)/rho_sf_small(-1)) if (q == 0) then @@ -489,9 +489,9 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb)%sf(j + q, k + 1, & + dvel_small(1) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb)%sf(j + q, k + 1, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j + q, k - 1, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k + 1, & + dvel_small(2) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k + 1, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j + q, k - 1, l)/rho_sf_small(-1)) if (q == 0) then @@ -615,59 +615,59 @@ contains $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/x%spacing(j)), kind=stp) end if E_L = 0._wp; E_R = 0._wp @@ -688,13 +688,13 @@ contains do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j + 1, k, l) = rhs_vf(i)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/x%spacing(j))), kind=stp) end do if (num_fluids > 1) then @@ -702,67 +702,67 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & & l) - real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l)*vel_L(1)*(1._wp/dx(j + 1))), kind=stp) + & l)*vel_L(1)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_L(1)*(1._wp/dx(j))), kind=stp) + & l)*vel_L(1)*(1._wp/x%spacing(j))), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/dx(j + 1)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/dx(j)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/x%spacing(j)) - 0.5_wp*dt*cfl*(E_L) & + & *(1._wp/x%spacing(j))), kind=stp) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j + 1, k, l) = rhs_vf(i)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/x%spacing(j))), kind=stp) end do if (num_fluids > 1) then @@ -770,55 +770,55 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & & l) - real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l)*vel_R(1)*(1._wp/dx(j + 1))), kind=stp) + & l)*vel_R(1)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_R(1)*(1._wp/dx(j))), kind=stp) + & l)*vel_R(1)*(1._wp/x%spacing(j))), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/dx(j + 1)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/dx(j)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/x%spacing(j)) + 0.5_wp*dt*cfl*(E_R) & + & *(1._wp/x%spacing(j))), kind=stp) end do end do end do @@ -855,11 +855,11 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb)%sf(j + 1 + q, k, & + dvel_small(1) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb)%sf(j + 1 + q, k, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j - 1 + q, k, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1 + q, k, & + dvel_small(2) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1 + q, k, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j - 1 + q, k, l)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 2)%sf(j + 1 + q, k, & + dvel_small(3) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 2)%sf(j + 1 + q, k, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j - 1 + q, k, l)/rho_sf_small(-1)) if (q == 0) then @@ -891,12 +891,12 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb)%sf(j + q, k + 1, & + dvel_small(1) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb)%sf(j + q, k + 1, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j + q, k - 1, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k + 1, & + dvel_small(2) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k + 1, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j + q, k - 1, l)/rho_sf_small(-1)) - if (q == 0) dvel_small(3) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 2)%sf(j + q, k + 1, & - & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j + q, k - 1, l)/rho_sf_small(-1)) + if (q == 0) dvel_small(3) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 2)%sf(j + q, & + & k + 1, l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j + q, k - 1, l)/rho_sf_small(-1)) if (q == 0) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims @@ -924,11 +924,11 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb)%sf(j + q, k, & + dvel_small(1) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb)%sf(j + q, k, & & l + 1)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j + q, k, l - 1)/rho_sf_small(-1)) - if (q == 0) dvel_small(2) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k, & + if (q == 0) dvel_small(2) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 1)%sf(j + q, k, & & l + 1)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j + q, k, l - 1)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 2)%sf(j + q, k, & + dvel_small(3) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 2)%sf(j + q, k, & & l + 1)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j + q, k, & & l - 1)/rho_sf_small(-1)) if (q == 0) then @@ -1054,87 +1054,87 @@ contains $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 2)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 2)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(1)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/dx(j + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/dx(j)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(1)*(1._wp/x%spacing(j)), kind=stp) end if E_L = 0._wp; E_R = 0._wp @@ -1156,13 +1156,13 @@ contains do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j + 1, k, l) = rhs_vf(i)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_rho_L(i)*vel_L(1))*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/x%spacing(j))), kind=stp) end do if (num_fluids > 1) then @@ -1170,77 +1170,77 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & & l) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l)*vel_L(1)*(1._wp/dx(j + 1)), kind=stp) + & l)*vel_L(1)*(1._wp/x%spacing(j + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dx(j)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(1))*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/x%spacing(j)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_L(1)*(1._wp/dx(j)), kind=stp) + & l)*vel_L(1)*(1._wp/x%spacing(j)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 2)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/dx(j + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/dx(j + 1)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/x%spacing(j + 1)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(rho_L*(vel_L(1))**2.0 + pres_L)*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/dx(j)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/x%spacing(j)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/dx(j)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(vel_L(1)*(E_L + pres_L))*(1._wp/x%spacing(j)) - 0.5_wp*dt*cfl*(E_L) & + & *(1._wp/x%spacing(j))), kind=stp) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j + 1, k, l) = rhs_vf(i)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_rho_R(i)*vel_R(1))*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/x%spacing(j))), kind=stp) end do if (num_fluids > 1) then @@ -1248,65 +1248,65 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j + 1, k, & & l) - real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j + 1, k, & - & l)*vel_R(1)*(1._wp/dx(j + 1))), kind=stp) + & l)*vel_R(1)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(alpha_R(i)*vel_R(1))*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real((0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_R(1)*(1._wp/dx(j))), kind=stp) + & l)*vel_R(1)*(1._wp/x%spacing(j))), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j + 1, k, l) = rhs_vf(igr_momxb)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 1)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j + 1, k, l) = rhs_vf(igr_momxb + 2)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/dx(j + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j + 1, k, l) = rhs_vf(igr_E_idx)%sf(j + 1, k, & - & l) + real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/dx(j + 1)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dx(j + 1))), kind=stp) + & l) + real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/x%spacing(j + 1)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/x%spacing(j + 1))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(rho_R*(vel_R(1))**2.0 + pres_R)*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(2)*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/dx(j)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/x%spacing(j)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/x%spacing(j))), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/dx(j)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dx(j))), kind=stp) + & l) - real((0.5_wp*dt*(vel_R(1)*(E_R + pres_R))*(1._wp/x%spacing(j)) + 0.5_wp*dt*cfl*(E_R) & + & *(1._wp/x%spacing(j))), kind=stp) end do end do end do @@ -1346,9 +1346,9 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k + q, & + dvel_small(1) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j - 1, k + q, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1, k + q, & + dvel_small(2) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1, k + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j - 1, k + q, & & l)/rho_sf_small(-1)) @@ -1372,9 +1372,9 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb)%sf(j, k + 1 + q, & + dvel_small(1) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb)%sf(j, k + 1 + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j, k - 1 + q, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1 + q, & + dvel_small(2) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1 + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j, k - 1 + q, & & l)/rho_sf_small(-1)) @@ -1489,59 +1489,59 @@ contains $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/y%spacing(k)), kind=stp) end if E_L = 0._wp; E_R = 0._wp @@ -1566,13 +1566,13 @@ contains do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k + 1, l) = rhs_vf(i)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/y%spacing(k)), kind=stp) end do if (num_fluids > 1) then @@ -1580,66 +1580,66 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & & l) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l)*vel_L(2)*(1._wp/dy(k + 1)), kind=stp) + & l)*vel_L(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_L(2)*(1._wp/dy(k)), kind=stp) + & l)*vel_L(2)*(1._wp/y%spacing(k)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(E_L)*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dy(k)) - 0.5_wp*dt*cfl*(rho_L*vel_L(1) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/dy(k)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/y%spacing(k)), kind=stp) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k + 1, l) = rhs_vf(i)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/y%spacing(k)), kind=stp) end do if (num_fluids > 1) then @@ -1647,49 +1647,49 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & & l) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l)*vel_R(2)*(1._wp/dy(k + 1)), kind=stp) + & l)*vel_R(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_R(2)*(1._wp/dy(k)), kind=stp) + & l)*vel_R(2)*(1._wp/y%spacing(k)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(E_R)*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/dy(k)) + 0.5_wp*dt*cfl*(rho_R*vel_R(1) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/dy(k)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/y%spacing(k)), kind=stp) end do end do end do @@ -1727,9 +1727,9 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k + q, & + dvel_small(1) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j - 1, k + q, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1, k + q, & + dvel_small(2) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 1)%sf(j + 1, k + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j - 1, k + q, & & l)/rho_sf_small(-1)) @@ -1753,12 +1753,12 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb)%sf(j, k + 1 + q, & + dvel_small(1) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb)%sf(j, k + 1 + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j, k - 1 + q, l)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1 + q, & + dvel_small(2) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1 + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j, k - 1 + q, & & l)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + 1 + q, & + dvel_small(3) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + 1 + q, & & l)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j, k - 1 + q, & & l)/rho_sf_small(-1)) @@ -1784,10 +1784,10 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(2) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + q, & + dvel_small(2) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + q, & & l + 1)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j, k + q, & & l - 1)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + q, & + dvel_small(3) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + q, & & l + 1)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j, k + q, & & l - 1)/rho_sf_small(-1)) if (q > vidxb) then @@ -1901,87 +1901,87 @@ contains $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 2)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 2)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(2)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/dy(k + 1)), kind=stp) + & l) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/dy(k)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(2)*(1._wp/y%spacing(k)), kind=stp) end if E_L = 0._wp; E_R = 0._wp @@ -2006,13 +2006,13 @@ contains do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k + 1, l) = rhs_vf(i)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(2))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/y%spacing(k)), kind=stp) end do if (num_fluids > 1) then @@ -2020,77 +2020,77 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & & l) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l)*vel_L(2)*(1._wp/dy(k + 1)), kind=stp) + & l)*vel_L(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(2))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_L(2)*(1._wp/dy(k)), kind=stp) + & l)*vel_L(2)*(1._wp/y%spacing(k)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 2)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_L*vel_L(3)*vel_L(2)*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_L*vel_L(3)*vel_L(2)*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/dy(k + 1)) & - & - 0.5_wp*dt*cfl*(E_L)*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/y%spacing(k + 1)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/dy(k)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(rho_L*(vel_L(2))**2.0 + pres_L + F_L)*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/dy(k)) - 0.5_wp*dt*cfl*(rho_L*vel_L(1) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(2)*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_L*vel_L(3)*vel_L(2)*(1._wp/dy(k)) - 0.5_wp*dt*cfl*(rho_L*vel_L(3) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_L*vel_L(3)*vel_L(2)*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/dy(k)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(vel_L(2)*(E_L + pres_L + F_L))*(1._wp/y%spacing(k)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/y%spacing(k)), kind=stp) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k + 1, l) = rhs_vf(i)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(2))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/y%spacing(k)), kind=stp) end do if (num_fluids > 1) then @@ -2098,65 +2098,65 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k + 1, & & l) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k + 1, & - & l)*vel_R(2)*(1._wp/dy(k + 1)), kind=stp) + & l)*vel_R(2)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(2))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l)*vel_R(2)*(1._wp/dy(k)), kind=stp) + & l)*vel_R(2)*(1._wp/y%spacing(k)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 1)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k + 1, l) = rhs_vf(igr_momxb)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k + 1, l) = rhs_vf(igr_momxb + 2)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k + 1, l) = rhs_vf(igr_E_idx)%sf(j, k + 1, & - & l) + real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/dy(k + 1)) & - & + 0.5_wp*dt*cfl*(E_R)*(1._wp/dy(k + 1)), kind=stp) + & l) + real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/y%spacing(k + 1)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/y%spacing(k + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/dy(k)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(rho_R*(vel_R(2))**2.0 + pres_R + F_R)*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/dy(k)) + 0.5_wp*dt*cfl*(rho_R*vel_R(1) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(1)*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/dy(k)) + 0.5_wp*dt*cfl*(rho_R*vel_R(3) & - & )*(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/y%spacing(k)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/dy(k)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dy(k)), kind=stp) + & l) - real(0.5_wp*dt*(vel_R(2)*(E_R + pres_R + F_R))*(1._wp/y%spacing(k)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/y%spacing(k)), kind=stp) end do end do end do @@ -2195,9 +2195,9 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k, & + dvel_small(1) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb)%sf(j + 1, k, & & l + q)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j - 1, k, l + q)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dx(j)))*(q_cons_vf(igr_momxb + 2)%sf(j + 1, k, & + dvel_small(3) = (1/(2._wp*x%spacing(j)))*(q_cons_vf(igr_momxb + 2)%sf(j + 1, k, & & l + q)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j - 1, k, & & l + q)/rho_sf_small(-1)) @@ -2221,10 +2221,10 @@ contains rho_sf_small(i) = rho_L end do - dvel_small(2) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1, & + dvel_small(2) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 1)%sf(j, k + 1, & & l + q)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j, k - 1, & & l + q)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dy(k)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + 1, & + dvel_small(3) = (1/(2._wp*y%spacing(k)))*(q_cons_vf(igr_momxb + 2)%sf(j, k + 1, & & l + q)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j, k - 1, & & l + q)/rho_sf_small(-1)) @@ -2247,13 +2247,13 @@ contains end do rho_sf_small(i) = rho_L end do - dvel_small(1) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb)%sf(j, k, & + dvel_small(1) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb)%sf(j, k, & & l + 1 + q)/rho_sf_small(1) - q_cons_vf(igr_momxb)%sf(j, k, & & l - 1 + q)/rho_sf_small(-1)) - dvel_small(2) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 1)%sf(j, k, & + dvel_small(2) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 1)%sf(j, k, & & l + 1 + q)/rho_sf_small(1) - q_cons_vf(igr_momxb + 1)%sf(j, k, & & l - 1 + q)/rho_sf_small(-1)) - dvel_small(3) = (1/(2._wp*dz(l)))*(q_cons_vf(igr_momxb + 2)%sf(j, k, & + dvel_small(3) = (1/(2._wp*z%spacing(l)))*(q_cons_vf(igr_momxb + 2)%sf(j, k, & & l + 1 + q)/rho_sf_small(1) - q_cons_vf(igr_momxb + 2)%sf(j, k, & & l - 1 + q)/rho_sf_small(-1)) if (q > vidxb) then @@ -2370,87 +2370,87 @@ contains $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l + 1) = rhs_vf(igr_momxb)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(1)*vel_L(1)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l + 1) = rhs_vf(igr_momxb)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(1)*vel_R(1)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(2)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(2)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(2)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(2)*vel_L(2)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(2)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(2)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(2)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(2)*vel_R(2)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(3)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_L*vflux_L_arr(3)*vel_L(3)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) - real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(3)*(1._wp/dz(l)), kind=stp) + & l) + real(0.5_wp*dt*mu_R*vflux_R_arr(3)*vel_R(3)*(1._wp/z%spacing(l)), kind=stp) end if E_L = 0._wp; E_R = 0._wp @@ -2475,13 +2475,13 @@ contains do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l + 1) = rhs_vf(i)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(3))*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(3))*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(3))*(1._wp/dz(l)) & - & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_L(i)*vel_L(3))*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(alpha_rho_L(i))*(1._wp/z%spacing(l)), kind=stp) end do if (num_fluids > 1) then @@ -2489,77 +2489,77 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l + 1) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(alpha_L(i)*vel_L(3))*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(alpha_L(i)*vel_L(3))*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l + 1) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l + 1) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l + 1)*vel_L(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1)*vel_L(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(3))*(1._wp/dz(l)) - 0.5_wp*dt*cfl*(alpha_L(i)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_L(i)*vel_L(3))*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(alpha_L(i))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, l)*vel_L(3)*(1._wp/dz(l)), & - & kind=stp) + & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & + & l)*vel_L(3)*(1._wp/z%spacing(l)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(rho_L*(vel_L(3))**2.0 + pres_L + F_L)*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(rho_L*(vel_L(3))**2.0 + pres_L + F_L)*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l + 1) = rhs_vf(igr_momxb)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*rho_L*vel_L(2)*vel_L(3)*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*rho_L*vel_L(2)*vel_L(3)*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(vel_L(3)*(E_L + pres_L + F_L))*(1._wp/dz(l + 1)) & - & - 0.5_wp*dt*cfl*(E_L)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(vel_L(3)*(E_L + pres_L + F_L))*(1._wp/z%spacing(l + 1)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_L*(vel_L(3))**2.0 + pres_L + F_L)*(1._wp/dz(l)) & - & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(rho_L*(vel_L(3))**2.0 + pres_L + F_L)*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(3))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/dz(l)) - 0.5_wp*dt*cfl*(rho_L*vel_L(1)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*rho_L*vel_L(1)*vel_L(3)*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(1))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_L*vel_L(2)*vel_L(3)*(1._wp/dz(l)) - 0.5_wp*dt*cfl*(rho_L*vel_L(2)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*rho_L*vel_L(2)*vel_L(3)*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(rho_L*vel_L(2))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_L(3)*(E_L + pres_L + F_L))*(1._wp/dz(l)) - 0.5_wp*dt*cfl*(E_L) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(vel_L(3)*(E_L + pres_L + F_L))*(1._wp/z%spacing(l)) & + & - 0.5_wp*dt*cfl*(E_L)*(1._wp/z%spacing(l)), kind=stp) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l + 1) = rhs_vf(i)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(3))*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(3))*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(3))*(1._wp/dz(l)) & - & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_rho_R(i)*vel_R(3))*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(alpha_rho_R(i))*(1._wp/z%spacing(l)), kind=stp) end do if (num_fluids > 1) then @@ -2567,65 +2567,65 @@ contains do i = 1, num_fluids - 1 $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l + 1) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(alpha_R(i)*vel_R(3))*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(alpha_R(i)*vel_R(3))*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l + 1) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & & l + 1) - real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & - & l + 1)*vel_R(3)*(1._wp/dz(l + 1)), kind=stp) + & l + 1)*vel_R(3)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(3))*(1._wp/dz(l)) + 0.5_wp*dt*cfl*(alpha_R(i)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(alpha_R(i)*vel_R(3))*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(alpha_R(i))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_advxb + i - 1)%sf(j, k, l) = rhs_vf(igr_advxb + i - 1)%sf(j, k, & - & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, l)*vel_R(3)*(1._wp/dz(l)), & - & kind=stp) + & l) + real(0.5_wp*dt*q_cons_vf(igr_advxb + i - 1)%sf(j, k, & + & l)*vel_R(3)*(1._wp/z%spacing(l)), kind=stp) end do end if $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(rho_R*(vel_R(3))**2.0 + pres_R + F_R)*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(rho_R*(vel_R(3))**2.0 + pres_R + F_R)*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l + 1) = rhs_vf(igr_momxb)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l + 1) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l + 1) = rhs_vf(igr_E_idx)%sf(j, k, & - & l + 1) + real(0.5_wp*dt*(vel_R(3)*(E_R + pres_R + F_R))*(1._wp/dz(l + 1)) & - & + 0.5_wp*dt*cfl*(E_R)*(1._wp/dz(l + 1)), kind=stp) + & l + 1) + real(0.5_wp*dt*(vel_R(3)*(E_R + pres_R + F_R))*(1._wp/z%spacing(l + 1)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/z%spacing(l + 1)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 2)%sf(j, k, l) = rhs_vf(igr_momxb + 2)%sf(j, k, & - & l) - real(0.5_wp*dt*(rho_R*(vel_R(3))**2.0 + pres_R + F_R)*(1._wp/dz(l)) & - & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(rho_R*(vel_R(3))**2.0 + pres_R + F_R)*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(3))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb)%sf(j, k, l) = rhs_vf(igr_momxb)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/dz(l)) + 0.5_wp*dt*cfl*(rho_R*vel_R(1)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*rho_R*vel_R(1)*vel_R(3)*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(1))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_momxb + 1)%sf(j, k, l) = rhs_vf(igr_momxb + 1)%sf(j, k, & - & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/dz(l)) + 0.5_wp*dt*cfl*(rho_R*vel_R(2)) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*rho_R*vel_R(2)*vel_R(3)*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(rho_R*vel_R(2))*(1._wp/z%spacing(l)), kind=stp) $:GPU_ATOMIC(atomic='update') rhs_vf(igr_E_idx)%sf(j, k, l) = rhs_vf(igr_E_idx)%sf(j, k, & - & l) - real(0.5_wp*dt*(vel_R(3)*(E_R + pres_R + F_R))*(1._wp/dz(l)) + 0.5_wp*dt*cfl*(E_R) & - & *(1._wp/dz(l)), kind=stp) + & l) - real(0.5_wp*dt*(vel_R(3)*(E_R + pres_R + F_R))*(1._wp/z%spacing(l)) & + & + 0.5_wp*dt*cfl*(E_R)*(1._wp/z%spacing(l)), kind=stp) end do end do end do @@ -2691,7 +2691,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - rhs_vf(i)%sf(j, k, l) = 1._wp/dx(j)*(flux_vf(i)%sf(j - 1, k, l) - flux_vf(i)%sf(j, k, l)) + rhs_vf(i)%sf(j, k, l) = 1._wp/x%spacing(j)*(flux_vf(i)%sf(j - 1, k, l) - flux_vf(i)%sf(j, k, l)) end do end do end do @@ -2703,7 +2703,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)*(flux_vf(i)%sf(j, k - 1, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/y%spacing(k)*(flux_vf(i)%sf(j, k - 1, & & l) - flux_vf(i)%sf(j, k, l)) end do end do @@ -2716,7 +2716,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dz(l)*(flux_vf(i)%sf(j, k, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/z%spacing(l)*(flux_vf(i)%sf(j, k, & & l - 1) - flux_vf(i)%sf(j, k, l)) end do end do diff --git a/src/simulation/m_qbmm.fpp b/src/simulation/m_qbmm.fpp index 8465d4d349..4a1533b247 100644 --- a/src/simulation/m_qbmm.fpp +++ b/src/simulation/m_qbmm.fpp @@ -445,7 +445,7 @@ contains nR2_dot = flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j - 1, k, & & l) - flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, l) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dx(j)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(x%spacing(j)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) case (2) nb_dot = flux_n_vf(eqn_idx%bub%beg + (i - 1)*nmom)%sf(j, k - 1, & & l) - flux_n_vf(eqn_idx%bub%beg + (i - 1)*nmom)%sf(j, k, l) @@ -454,7 +454,7 @@ contains nR2_dot = flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k - 1, & & l) - flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, l) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dy(k)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(y%spacing(k)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) case (3) if (is_axisym) then nb_dot = q_prim_vf(eqn_idx%cont%end + idir)%sf(j, k, & @@ -467,8 +467,8 @@ contains & l)*(flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, & & l - 1) - flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, l)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, & - & q, i)) + & i) - 3._wp*gam/(z%spacing(l)*y%cc(k)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot) & + & *(pb(j, k, l, q, i)) else nb_dot = flux_n_vf(eqn_idx%bub%beg + (i - 1)*nmom)%sf(j, k, & & l - 1) - flux_n_vf(eqn_idx%bub%beg + (i - 1)*nmom)%sf(j, k, l) @@ -477,39 +477,40 @@ contains nR2_dot = flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, & & l - 1) - flux_n_vf(eqn_idx%bub%beg + 3 + (i - 1)*nmom)%sf(j, k, l) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(z%spacing(l)*AX*nb_q**2)*(nR_dot*nb_q - nR*nb_dot)*(pb(j, k, l, & + & q, i)) end if end select if (q <= 2) then select case (idir) case (1) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(x%spacing(j)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q)*(nR_dot*nb_q & - & - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(x%spacing(j)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) case (2) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(y%spacing(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q)*(nR_dot*nb_q & - & - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(y%spacing(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) case (3) if (is_axisym) then rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & - & - nR2*nb_dot)*(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(z%spacing(l)*y%cc(k)*AX*nb_q**2*sqrt(var)*2._wp) & + & *(nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & - & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(z%spacing(l)*y%cc(k)*AX*nb_q**2*sqrt(var)*2._wp) & + & *(-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) + 3._wp*gam/(z%spacing(l)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) + 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & i) + 3._wp*gam/(z%spacing(l)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end select @@ -517,32 +518,32 @@ contains select case (idir) case (1) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(x%spacing(j)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dx(j)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q)*(nR_dot*nb_q & - & - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(x%spacing(j)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) case (2) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(y%spacing(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dy(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q)*(nR_dot*nb_q & - & - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(y%spacing(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) case (3) if (is_axisym) then rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & - & - nR2*nb_dot)*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(z%spacing(l)*y%cc(k)*AX*nb_q**2*sqrt(var)*2._wp) & + & *(nR2_dot*nb_q - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*y_cc(k)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & - & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(z%spacing(l)*y%cc(k)*AX*nb_q**2*sqrt(var)*2._wp) & + & *(-2._wp*(nR/nb_q)*(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) else rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q - nR2*nb_dot) & - & *(pb(j, k, l, q, i)) + & i) - 3._wp*gam/(z%spacing(l)*AX*nb_q**2*sqrt(var)*2._wp)*(nR2_dot*nb_q & + & - nR2*nb_dot)*(pb(j, k, l, q, i)) rhs_pb(j, k, l, q, i) = rhs_pb(j, k, l, q, & - & i) - 3._wp*gam/(dz(l)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & + & i) - 3._wp*gam/(z%spacing(l)*AX*nb_q**2*sqrt(var)*2._wp)*(-2._wp*(nR/nb_q) & & *(nR_dot*nb_q - nR*nb_dot))*(pb(j, k, l, q, i)) end if end select @@ -840,8 +841,8 @@ contains & momrhs(:,i1, i2, j, q)) end if case (2) - if ((j >= 7 .and. j <= 9) .or. (j >= 22 .and. j <= 23) .or. (j >= 10 & - & .and. j <= 11) .or. (j == 26)) then + if ((j >= 7 .and. j <= 9) .or. (j >= 22 .and. j <= 23) & + & .or. (j >= 10 .and. j <= 11) .or. (j == 26)) then momsum = momsum + coeff(j, i1, i2)*(R0(q)**momrhs(3, i1, i2, j, & & q))*f_quad2D(abscX(:,q), abscY(:,q), wght_pb(:,q), & & momrhs(:,i1, i2, j, q)) diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index 4316c9278c..ff02d416cf 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -940,7 +940,7 @@ contains do q_loop = 0, p do l_loop = 0, n do k_loop = 0, m - inv_ds = 1._wp/dx(k_loop) + inv_ds = 1._wp/x%spacing(k_loop) flux_face1 = flux_n(1)%vf(j)%sf(k_loop - 1, l_loop, q_loop) flux_face2 = flux_n(1)%vf(j)%sf(k_loop, l_loop, q_loop) rhs_vf(j)%sf(k_loop, l_loop, q_loop) = inv_ds*(flux_face1 - flux_face2) @@ -957,7 +957,7 @@ contains do l_loop = 0, n do k_loop = 0, m do i_fluid_loop = 1, num_fluids - inv_ds = 1._wp/dx(k_loop) + inv_ds = 1._wp/x%spacing(k_loop) advected_qty_val = q_cons_vf%vf(i_fluid_loop + eqn_idx%adv%beg - 1)%sf(k_loop, l_loop, q_loop) pressure_val = q_prim_vf%vf(eqn_idx%E)%sf(k_loop, l_loop, q_loop) flux_face1 = flux_src_n_vf%vf(eqn_idx%adv%beg)%sf(k_loop, l_loop, q_loop) @@ -986,7 +986,7 @@ contains do l = 0, p do k = 0, n do q = 0, m - inv_ds = 1._wp/dy(k) + inv_ds = 1._wp/y%spacing(k) flux_face1 = flux_n(2)%vf(j)%sf(q, k - 1, l) flux_face2 = flux_n(2)%vf(j)%sf(q, k, l) rhs_vf(j)%sf(q, k, l) = rhs_vf(j)%sf(q, k, l) + inv_ds*(flux_face1 - flux_face2) @@ -1003,7 +1003,7 @@ contains do k = 0, n do q = 0, m do i_fluid_loop = 1, num_fluids - inv_ds = 1._wp/dy(k) + inv_ds = 1._wp/y%spacing(k) advected_qty_val = q_cons_vf%vf(i_fluid_loop + eqn_idx%adv%beg - 1)%sf(q, k, l) pressure_val = q_prim_vf%vf(eqn_idx%E)%sf(q, k, l) flux_face1 = flux_src_n_vf%vf(eqn_idx%adv%beg)%sf(q, k, l) @@ -1014,7 +1014,7 @@ contains if (cyl_coord) then rhs_vf(i_fluid_loop + eqn_idx%int_en%beg - 1)%sf(q, k, & & l) = rhs_vf(i_fluid_loop + eqn_idx%int_en%beg - 1)%sf(q, k, & - & l) - 5.e-1_wp/y_cc(k)*advected_qty_val*pressure_val*(flux_face1 + flux_face2) + & l) - 5.e-1_wp/y%cc(k)*advected_qty_val*pressure_val*(flux_face1 + flux_face2) end if end do end do @@ -1031,7 +1031,7 @@ contains do q = 0, m flux_face1 = flux_gsrc_n(2)%vf(j)%sf(q, k - 1, l) flux_face2 = flux_gsrc_n(2)%vf(j)%sf(q, k, l) - rhs_vf(j)%sf(q, k, l) = rhs_vf(j)%sf(q, k, l) - 5.e-1_wp/y_cc(k)*(flux_face1 + flux_face2) + rhs_vf(j)%sf(q, k, l) = rhs_vf(j)%sf(q, k, l) - 5.e-1_wp/y%cc(k)*(flux_face1 + flux_face2) end do end do end do @@ -1054,7 +1054,7 @@ contains do k = 0, p do q = 0, n do l = 0, m - inv_ds = 1._wp/(dz(k)*y_cc(q)) + inv_ds = 1._wp/(z%spacing(k)*y%cc(q)) velocity_val = q_prim_vf%vf(eqn_idx%cont%end + idir)%sf(l, q, k) flux_face1 = flux_n(3)%vf(j)%sf(l, q, k - 1) flux_face2 = flux_n(3)%vf(j)%sf(l, q, k) @@ -1071,7 +1071,7 @@ contains do l = 0, m flux_face1 = flux_gsrc_n(3)%vf(j)%sf(l, q, k - 1) flux_face2 = flux_gsrc_n(3)%vf(j)%sf(l, q, k) - rhs_vf(j)%sf(l, q, k) = rhs_vf(j)%sf(l, q, k) - 5.e-1_wp/y_cc(q)*(flux_face1 + flux_face2) + rhs_vf(j)%sf(l, q, k) = rhs_vf(j)%sf(l, q, k) - 5.e-1_wp/y%cc(q)*(flux_face1 + flux_face2) end do end do end do @@ -1083,7 +1083,7 @@ contains do k = 0, p do q = 0, n do l = 0, m - inv_ds = 1._wp/dz(k) + inv_ds = 1._wp/z%spacing(k) flux_face1 = flux_n(3)%vf(j)%sf(l, q, k - 1) flux_face2 = flux_n(3)%vf(j)%sf(l, q, k) rhs_vf(j)%sf(l, q, k) = rhs_vf(j)%sf(l, q, k) + inv_ds*(flux_face1 - flux_face2) @@ -1101,7 +1101,7 @@ contains do q = 0, n do l = 0, m do i_fluid_loop = 1, num_fluids - inv_ds = 1._wp/dz(k) + inv_ds = 1._wp/z%spacing(k) advected_qty_val = q_cons_vf%vf(i_fluid_loop + eqn_idx%adv%beg - 1)%sf(l, q, k) pressure_val = q_prim_vf%vf(eqn_idx%E)%sf(l, q, k) flux_face1 = flux_src_n_vf%vf(eqn_idx%adv%beg)%sf(l, q, k) @@ -1146,7 +1146,7 @@ contains do q_idx = 0, p ! z_extent do l_idx = 0, n ! y_extent do k_idx = 0, m ! x_extent - local_inv_ds = 1._wp/dx(k_idx) + local_inv_ds = 1._wp/x%spacing(k_idx) local_term_coeff = q_prim_vf_arg%vf(eqn_idx%cont%end + current_idir)%sf(k_idx, l_idx, q_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(k_idx - 1, l_idx, q_idx) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(k_idx, l_idx, q_idx) @@ -1163,7 +1163,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do q_idx = 0, p; do l_idx = 0, n; do k_idx = 0, m - local_inv_ds = 1._wp/dx(k_idx) + local_inv_ds = 1._wp/x%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%end)%sf(k_idx, l_idx, q_idx) local_k_term_val = Kterm_arg(k_idx, l_idx, q_idx) ! Access is safe due to outer alt_soundspeed check local_term_coeff = local_q_cons_val - local_k_term_val @@ -1177,7 +1177,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do q_idx = 0, p; do l_idx = 0, n; do k_idx = 0, m - local_inv_ds = 1._wp/dx(k_idx) + local_inv_ds = 1._wp/x%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%beg)%sf(k_idx, l_idx, q_idx) local_k_term_val = Kterm_arg(k_idx, l_idx, q_idx) ! Access is safe local_term_coeff = local_q_cons_val + local_k_term_val @@ -1193,7 +1193,7 @@ contains & local_flux1, local_flux2]') do j_adv = eqn_idx%adv%beg, eqn_idx%adv%end do q_idx = 0, p; do l_idx = 0, n; do k_idx = 0, m - local_inv_ds = 1._wp/dx(k_idx) + local_inv_ds = 1._wp/x%spacing(k_idx) local_term_coeff = q_cons_vf_arg%vf(j_adv)%sf(k_idx, l_idx, q_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(k_idx, l_idx, q_idx) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(k_idx - 1, l_idx, q_idx) @@ -1205,7 +1205,8 @@ contains end if end if case (2) - ! y-direction: loops q_idx (x), k_idx (y), l_idx (z); sf(q_idx, k_idx, l_idx); dy(k_idx); Kterm(q_idx,k_idx,l_idx) + ! y-direction: loops q_idx (x), k_idx (y), l_idx (z); sf(q_idx, k_idx, l_idx); y%spacing(k_idx); + ! Kterm(q_idx,k_idx,l_idx) use_standard_riemann = (riemann_solver == 1 .or. riemann_solver == 4) if (use_standard_riemann) then $:GPU_PARALLEL_LOOP(collapse=4,private='[j_adv, k_idx, l_idx, q_idx, local_inv_ds, local_term_coeff, & @@ -1214,7 +1215,7 @@ contains do l_idx = 0, p ! z_extent do k_idx = 0, n ! y_extent do q_idx = 0, m ! x_extent - local_inv_ds = 1._wp/dy(k_idx) + local_inv_ds = 1._wp/y%spacing(k_idx) local_term_coeff = q_prim_vf_arg%vf(eqn_idx%cont%end + current_idir)%sf(q_idx, k_idx, l_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(q_idx, k_idx - 1, l_idx) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(q_idx, k_idx, l_idx) @@ -1231,7 +1232,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do l_idx = 0, p; do k_idx = 0, n; do q_idx = 0, m - local_inv_ds = 1._wp/dy(k_idx) + local_inv_ds = 1._wp/y%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%end)%sf(q_idx, k_idx, l_idx) local_k_term_val = Kterm_arg(q_idx, k_idx, l_idx) ! Access is safe local_term_coeff = local_q_cons_val - local_k_term_val @@ -1241,7 +1242,7 @@ contains & k_idx, l_idx) + local_inv_ds*local_term_coeff*(local_flux1 - local_flux2) if (cyl_coord) then rhs_vf_arg(eqn_idx%adv%end)%sf(q_idx, k_idx, l_idx) = rhs_vf_arg(eqn_idx%adv%end)%sf(q_idx, & - & k_idx, l_idx) - (local_k_term_val/(2._wp*y_cc(k_idx)))*(local_flux1 + local_flux2) + & k_idx, l_idx) - (local_k_term_val/(2._wp*y%cc(k_idx)))*(local_flux1 + local_flux2) end if end do; end do; end do $:END_GPU_PARALLEL_LOOP() @@ -1249,7 +1250,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do l_idx = 0, p; do k_idx = 0, n; do q_idx = 0, m - local_inv_ds = 1._wp/dy(k_idx) + local_inv_ds = 1._wp/y%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%beg)%sf(q_idx, k_idx, l_idx) local_k_term_val = Kterm_arg(q_idx, k_idx, l_idx) ! Access is safe local_term_coeff = local_q_cons_val + local_k_term_val @@ -1259,7 +1260,7 @@ contains & k_idx, l_idx) + local_inv_ds*local_term_coeff*(local_flux1 - local_flux2) if (cyl_coord) then rhs_vf_arg(eqn_idx%adv%beg)%sf(q_idx, k_idx, l_idx) = rhs_vf_arg(eqn_idx%adv%beg)%sf(q_idx, & - & k_idx, l_idx) + (local_k_term_val/(2._wp*y_cc(k_idx)))*(local_flux1 + local_flux2) + & k_idx, l_idx) + (local_k_term_val/(2._wp*y%cc(k_idx)))*(local_flux1 + local_flux2) end if end do; end do; end do $:END_GPU_PARALLEL_LOOP() @@ -1269,7 +1270,7 @@ contains & local_flux1, local_flux2]') do j_adv = eqn_idx%adv%beg, eqn_idx%adv%end do l_idx = 0, p; do k_idx = 0, n; do q_idx = 0, m - local_inv_ds = 1._wp/dy(k_idx) + local_inv_ds = 1._wp/y%spacing(k_idx) local_term_coeff = q_cons_vf_arg%vf(j_adv)%sf(q_idx, k_idx, l_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(q_idx, k_idx, l_idx) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(q_idx, k_idx - 1, l_idx) @@ -1281,7 +1282,8 @@ contains end if end if case (3) - ! z-direction: loops l_idx (x), q_idx (y), k_idx (z); sf(l_idx, q_idx, k_idx); dz(k_idx); Kterm(l_idx,q_idx,k_idx) + ! z-direction: loops l_idx (x), q_idx (y), k_idx (z); sf(l_idx, q_idx, k_idx); z%spacing(k_idx); + ! Kterm(l_idx,q_idx,k_idx) if (grid_geometry == 3) then use_standard_riemann = (riemann_solver == 1) else @@ -1295,7 +1297,7 @@ contains do k_idx = 0, p ! z_extent do q_idx = 0, n ! y_extent do l_idx = 0, m ! x_extent - local_inv_ds = 1._wp/dz(k_idx) + local_inv_ds = 1._wp/z%spacing(k_idx) local_term_coeff = q_prim_vf_arg%vf(eqn_idx%cont%end + current_idir)%sf(l_idx, q_idx, k_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(l_idx, q_idx, k_idx - 1) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(l_idx, q_idx, k_idx) @@ -1312,7 +1314,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do k_idx = 0, p; do q_idx = 0, n; do l_idx = 0, m - local_inv_ds = 1._wp/dz(k_idx) + local_inv_ds = 1._wp/z%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%end)%sf(l_idx, q_idx, k_idx) local_k_term_val = Kterm_arg(l_idx, q_idx, k_idx) ! Access is safe local_term_coeff = local_q_cons_val - local_k_term_val @@ -1326,7 +1328,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[k_idx, l_idx, q_idx, local_inv_ds, local_q_cons_val, & & local_k_term_val, local_term_coeff, local_flux1, local_flux2]') do k_idx = 0, p; do q_idx = 0, n; do l_idx = 0, m - local_inv_ds = 1._wp/dz(k_idx) + local_inv_ds = 1._wp/z%spacing(k_idx) local_q_cons_val = q_cons_vf_arg%vf(eqn_idx%adv%beg)%sf(l_idx, q_idx, k_idx) local_k_term_val = Kterm_arg(l_idx, q_idx, k_idx) ! Access is safe local_term_coeff = local_q_cons_val + local_k_term_val @@ -1342,7 +1344,7 @@ contains & local_flux1, local_flux2]') do j_adv = eqn_idx%adv%beg, eqn_idx%adv%end do k_idx = 0, p; do q_idx = 0, n; do l_idx = 0, m - local_inv_ds = 1._wp/dz(k_idx) + local_inv_ds = 1._wp/z%spacing(k_idx) local_term_coeff = q_cons_vf_arg%vf(j_adv)%sf(l_idx, q_idx, k_idx) local_flux1 = flux_src_n_vf_arg%vf(j_adv)%sf(l_idx, q_idx, k_idx) local_flux2 = flux_src_n_vf_arg%vf(j_adv)%sf(l_idx, q_idx, k_idx - 1) @@ -1377,8 +1379,9 @@ contains do k = 0, n do j = 0, m rhs_vf(eqn_idx%c)%sf(j, k, l) = rhs_vf(eqn_idx%c)%sf(j, k, & - & l) + 1._wp/dx(j)*q_prim_vf(eqn_idx%c)%sf(j, k, l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, & - & l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j - 1, k, l)) + & l) + 1._wp/x%spacing(j)*q_prim_vf(eqn_idx%c)%sf(j, k, & + & l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j - 1, k, & + & l)) end do end do end do @@ -1393,21 +1396,23 @@ contains if (surface_tension .or. viscous) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dx(j)*(flux_src_n_in(i)%sf(j - 1, k, & - & l) - flux_src_n_in(i)%sf(j, k, l)) + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & + & l) + 1._wp/x%spacing(j)*(flux_src_n_in(i)%sf(j - 1, k, l) - flux_src_n_in(i)%sf(j, & + & k, l)) end do end if if (chem_params%diffusion) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dx(j)*(flux_src_n_in(i)%sf(j - 1, k, & - & l) - flux_src_n_in(i)%sf(j, k, l)) + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & + & l) + 1._wp/x%spacing(j)*(flux_src_n_in(i)%sf(j - 1, k, l) - flux_src_n_in(i)%sf(j, & + & k, l)) end do if (.not. viscous) then rhs_vf(eqn_idx%E)%sf(j, k, l) = rhs_vf(eqn_idx%E)%sf(j, k, & - & l) + 1._wp/dx(j)*(flux_src_n_in(eqn_idx%E)%sf(j - 1, k, & + & l) + 1._wp/x%spacing(j)*(flux_src_n_in(eqn_idx%E)%sf(j - 1, k, & & l) - flux_src_n_in(eqn_idx%E)%sf(j, k, l)) end if end if @@ -1423,8 +1428,9 @@ contains do k = 0, n do j = 0, m rhs_vf(eqn_idx%c)%sf(j, k, l) = rhs_vf(eqn_idx%c)%sf(j, k, & - & l) + 1._wp/dy(k)*q_prim_vf(eqn_idx%c)%sf(j, k, l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, & - & l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j, k - 1, l)) + & l) + 1._wp/y%spacing(k)*q_prim_vf(eqn_idx%c)%sf(j, k, & + & l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j, k - 1, & + & l)) end do end do end do @@ -1448,7 +1454,7 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, 0, l) = rhs_vf(i)%sf(j, 0, l) + 1._wp/(y_cc(1) - y_cc(-1))*(tau_Re_vf(i)%sf(j, & + rhs_vf(i)%sf(j, 0, l) = rhs_vf(i)%sf(j, 0, l) + 1._wp/(y%cc(1) - y%cc(-1))*(tau_Re_vf(i)%sf(j, & & -1, l) - tau_Re_vf(i)%sf(j, 1, l)) end do end do @@ -1462,7 +1468,7 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)*(flux_src_n_in(i)%sf(j, k - 1, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/y%spacing(k)*(flux_src_n_in(i)%sf(j, k - 1, & & l) - flux_src_n_in(i)%sf(j, k, l)) end do end do @@ -1478,20 +1484,22 @@ contains if (surface_tension .or. viscous) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)*(flux_src_n_in(i)%sf(j, & - & k - 1, l) - flux_src_n_in(i)%sf(j, k, l)) + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & + & l) + 1._wp/y%spacing(k)*(flux_src_n_in(i)%sf(j, k - 1, & + & l) - flux_src_n_in(i)%sf(j, k, l)) end do end if if (chem_params%diffusion) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dy(k)*(flux_src_n_in(i)%sf(j, & - & k - 1, l) - flux_src_n_in(i)%sf(j, k, l)) + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, & + & l) + 1._wp/y%spacing(k)*(flux_src_n_in(i)%sf(j, k - 1, & + & l) - flux_src_n_in(i)%sf(j, k, l)) end do if (.not. viscous) then rhs_vf(eqn_idx%E)%sf(j, k, l) = rhs_vf(eqn_idx%E)%sf(j, k, & - & l) + 1._wp/dy(k)*(flux_src_n_in(eqn_idx%E)%sf(j, k - 1, & + & l) + 1._wp/y%spacing(k)*(flux_src_n_in(eqn_idx%E)%sf(j, k - 1, & & l) - flux_src_n_in(eqn_idx%E)%sf(j, k, l)) end if end if @@ -1511,7 +1519,7 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) - 5.e-1_wp/y_cc(k)*(flux_src_n_in(i)%sf(j, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) - 5.e-1_wp/y%cc(k)*(flux_src_n_in(i)%sf(j, & & k - 1, l) + flux_src_n_in(i)%sf(j, k, l)) end do end do @@ -1525,7 +1533,7 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, 0, l) = rhs_vf(i)%sf(j, 0, l) - 1._wp/y_cc(0)*tau_Re_vf(i)%sf(j, 0, l) + rhs_vf(i)%sf(j, 0, l) = rhs_vf(i)%sf(j, 0, l) - 1._wp/y%cc(0)*tau_Re_vf(i)%sf(j, 0, l) end do end do end do @@ -1538,7 +1546,7 @@ contains do j = 0, m $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) - 5.e-1_wp/y_cc(k)*(flux_src_n_in(i)%sf(j, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) - 5.e-1_wp/y%cc(k)*(flux_src_n_in(i)%sf(j, & & k - 1, l) + flux_src_n_in(i)%sf(j, k, l)) end do end do @@ -1554,8 +1562,9 @@ contains do k = 0, n do j = 0, m rhs_vf(eqn_idx%c)%sf(j, k, l) = rhs_vf(eqn_idx%c)%sf(j, k, & - & l) + 1._wp/dz(l)*q_prim_vf(eqn_idx%c)%sf(j, k, l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, & - & l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, l - 1)) + & l) + 1._wp/z%spacing(l)*q_prim_vf(eqn_idx%c)%sf(j, k, & + & l)*(flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, l) - flux_src_n_in(eqn_idx%adv%beg)%sf(j, k, & + & l - 1)) end do end do end do @@ -1570,7 +1579,7 @@ contains if (surface_tension .or. viscous) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%mom%beg, eqn_idx%E - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dz(l)*(flux_src_n_in(i)%sf(j, k, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/z%spacing(l)*(flux_src_n_in(i)%sf(j, k, & & l - 1) - flux_src_n_in(i)%sf(j, k, l)) end do end if @@ -1578,12 +1587,12 @@ contains if (chem_params%diffusion) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/dz(l)*(flux_src_n_in(i)%sf(j, k, & + rhs_vf(i)%sf(j, k, l) = rhs_vf(i)%sf(j, k, l) + 1._wp/z%spacing(l)*(flux_src_n_in(i)%sf(j, k, & & l - 1) - flux_src_n_in(i)%sf(j, k, l)) end do if (.not. viscous) then rhs_vf(eqn_idx%E)%sf(j, k, l) = rhs_vf(eqn_idx%E)%sf(j, k, & - & l) + 1._wp/dz(l)*(flux_src_n_in(eqn_idx%E)%sf(j, k, & + & l) + 1._wp/z%spacing(l)*(flux_src_n_in(eqn_idx%E)%sf(j, k, & & l - 1) - flux_src_n_in(eqn_idx%E)%sf(j, k, l)) end if end if diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index 78a00759ad..546d3d5a19 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -32,8 +32,8 @@ module m_riemann_solvers & s_hlld_riemann_solver, s_lf_riemann_solver, s_finalize_riemann_solvers_module !> The cell-boundary values of the fluxes (src - source) that are computed through the chosen Riemann problem solver, and the - !! direct evaluation of source terms, by using the left and right states given in qK_prim_rs_vf, dqK_prim_ds_vf where ds = dx, - !! dy or dz. + !! direct evaluation of source terms, by using the left and right states given in qK_prim_rs_vf, dqK_prim_ds_vf where ds = + !! x%spacing, y%spacing or z%spacing. !> @{ real(wp), allocatable, dimension(:,:,:,:) :: flux_rsx_vf, flux_src_rsx_vf real(wp), allocatable, dimension(:,:,:,:) :: flux_rsy_vf, flux_src_rsy_vf @@ -720,7 +720,7 @@ contains ! MHD: magnetic flux and Maxwell stress contributions if (mhd) then - if (n == 0) then ! 1D: d/dx flux only & Bx = Bx0 = const. + if (n == 0) then ! 1D: d/x%spacing flux only & Bx = Bx0 = const. ! B_y flux = v_x * B_y - v_y * Bx0 B_z flux = v_x * B_z - v_z * Bx0 $:GPU_LOOP(parallelism='[seq]') do i = 0, 1 @@ -1346,7 +1346,7 @@ contains ! MHD: magnetic flux and Maxwell stress contributions if (mhd) then - if (n == 0) then ! 1D: d/dx flux only & Bx = Bx0 = const. + if (n == 0) then ! 1D: d/x%spacing flux only & Bx = Bx0 = const. ! B_y flux = v_x * B_y - v_y * Bx0 B_z flux = v_x * B_z - v_z * Bx0 $:GPU_LOOP(parallelism='[seq]') do i = 0, 1 @@ -4245,17 +4245,17 @@ contains Re_s = Re_avg_rsx_vf(j, k, l, 1) Re_b = Re_avg_rsx_vf(j, k, l, 2) vel_src_int = vel_src_rsx_vf(j, k, l,1:num_dims) - r_eff = y_cc(k) + r_eff = y%cc(k) case (2) ! y-face (radial face in r_cyl direction) Re_s = Re_avg_rsy_vf(k, j, l, 1) Re_b = Re_avg_rsy_vf(k, j, l, 2) vel_src_int = vel_src_rsy_vf(k, j, l,1:num_dims) - r_eff = y_cb(k) + r_eff = y%cb(k) case (3) ! z-face (azimuthal face in theta_cyl direction) Re_s = Re_avg_rsz_vf(l, k, j, 1) Re_b = Re_avg_rsz_vf(l, k, j, 2) vel_src_int = vel_src_rsz_vf(l, k, j,1:num_dims) - r_eff = y_cc(k) + r_eff = y%cc(k) end select ! Divergence in cylindrical coordinates (vx=vz_cyl, vy=vr_cyl, vz=vtheta_cyl) diff --git a/src/simulation/m_sim_helpers.fpp b/src/simulation/m_sim_helpers.fpp index 4a0978919e..edc173b862 100644 --- a/src/simulation/m_sim_helpers.fpp +++ b/src/simulation/m_sim_helpers.fpp @@ -28,12 +28,12 @@ contains if (grid_geometry == 3) then if (k == 0) then - fltr_dtheta = 2._wp*pi*y_cb(0)/3._wp + fltr_dtheta = 2._wp*pi*y%cb(0)/3._wp else if (k <= fourier_rings) then Nfq = min(floor(2._wp*real(k, wp)*pi), (p + 1)/2 + 1) - fltr_dtheta = 2._wp*pi*y_cb(k - 1)/real(Nfq, wp) + fltr_dtheta = 2._wp*pi*y%cb(k - 1)/real(Nfq, wp) else - fltr_dtheta = y_cb(k - 1)*dz(l) + fltr_dtheta = y%cb(k - 1)*z%spacing(l) end if else fltr_dtheta = 0._wp @@ -57,14 +57,14 @@ contains ! 3D #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (grid_geometry == 3) then - cfl_terms = min(dx(j)/(abs(vel(1)) + c), dy(k)/(abs(vel(2)) + c), fltr_dtheta/(abs(vel(3)) + c)) + cfl_terms = min(x%spacing(j)/(abs(vel(1)) + c), y%spacing(k)/(abs(vel(2)) + c), fltr_dtheta/(abs(vel(3)) + c)) else - cfl_terms = min(dx(j)/(abs(vel(1)) + c), dy(k)/(abs(vel(2)) + c), dz(l)/(abs(vel(3)) + c)) + cfl_terms = min(x%spacing(j)/(abs(vel(1)) + c), y%spacing(k)/(abs(vel(2)) + c), z%spacing(l)/(abs(vel(3)) + c)) end if #:endif else ! 2D - cfl_terms = min(dx(j)/(abs(vel(1)) + c), dy(k)/(abs(vel(2)) + c)) + cfl_terms = min(x%spacing(j)/(abs(vel(1)) + c), y%spacing(k)/(abs(vel(2)) + c)) end if end function f_compute_multidim_cfl_terms @@ -155,7 +155,7 @@ contains icfl_sf(j, k, l) = dt/f_compute_multidim_cfl_terms(vel, c, j, k, l) else ! 1D - icfl_sf(j, k, l) = (dt/dx(j))*(abs(vel(1)) + c) + icfl_sf(j, k, l) = (dt/x%spacing(j))*(abs(vel(1)) + c) end if ! Viscous calculations @@ -165,23 +165,23 @@ contains ! 3D if (grid_geometry == 3) then fltr_dtheta = f_compute_filtered_dtheta(k, l) - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(dx(j), dy(k), fltr_dtheta)**2._wp - Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), dy(k)*(abs(vel(2)) + c), & + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(x%spacing(j), y%spacing(k), fltr_dtheta)**2._wp + Rc_sf(j, k, l) = min(x%spacing(j)*(abs(vel(1)) + c), y%spacing(k)*(abs(vel(2)) + c), & & fltr_dtheta*(abs(vel(3)) + c))/maxval(1._wp/Re_l) else - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(dx(j), dy(k), dz(l))**2._wp - Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), dy(k)*(abs(vel(2)) + c), & - & dz(l)*(abs(vel(3)) + c))/maxval(1._wp/Re_l) + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(x%spacing(j), y%spacing(k), z%spacing(l))**2._wp + Rc_sf(j, k, l) = min(x%spacing(j)*(abs(vel(1)) + c), y%spacing(k)*(abs(vel(2)) + c), & + & z%spacing(l)*(abs(vel(3)) + c))/maxval(1._wp/Re_l) end if #:endif else if (n > 0) then ! 2D - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(dx(j), dy(k))**2._wp - Rc_sf(j, k, l) = min(dx(j)*(abs(vel(1)) + c), dy(k)*(abs(vel(2)) + c))/maxval(1._wp/Re_l) + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/min(x%spacing(j), y%spacing(k))**2._wp + Rc_sf(j, k, l) = min(x%spacing(j)*(abs(vel(1)) + c), y%spacing(k)*(abs(vel(2)) + c))/maxval(1._wp/Re_l) else ! 1D - vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/dx(j)**2._wp - Rc_sf(j, k, l) = dx(j)*(abs(vel(1)) + c)/maxval(1._wp/Re_l) + vcfl_sf(j, k, l) = maxval(dt/Re_l/rho)/x%spacing(j)**2._wp + Rc_sf(j, k, l) = x%spacing(j)*(abs(vel(1)) + c)/maxval(1._wp/Re_l) end if end if @@ -205,7 +205,7 @@ contains icfl_dt = cfl_target*f_compute_multidim_cfl_terms(vel, c, j, k, l) else ! 1D case - icfl_dt = cfl_target*(dx(j)/(abs(vel(1)) + c)) + icfl_dt = cfl_target*(x%spacing(j)/(abs(vel(1)) + c)) end if ! Viscous calculations @@ -214,16 +214,16 @@ contains ! 3D if (grid_geometry == 3) then fltr_dtheta = f_compute_filtered_dtheta(k, l) - vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp)/maxval(1/(rho*Re_l)) + vcfl_dt = cfl_target*(min(x%spacing(j), y%spacing(k), fltr_dtheta)**2._wp)/maxval(1/(rho*Re_l)) else - vcfl_dt = cfl_target*(min(dx(j), dy(k), dz(l))**2._wp)/maxval(1/(rho*Re_l)) + vcfl_dt = cfl_target*(min(x%spacing(j), y%spacing(k), z%spacing(l))**2._wp)/maxval(1/(rho*Re_l)) end if else if (n > 0) then ! 2D - vcfl_dt = cfl_target*(min(dx(j), dy(k))**2._wp)/maxval((1/Re_l)/rho) + vcfl_dt = cfl_target*(min(x%spacing(j), y%spacing(k))**2._wp)/maxval((1/Re_l)/rho) else ! 1D - vcfl_dt = cfl_target*(dx(j)**2._wp)/maxval(1/(rho*Re_l)) + vcfl_dt = cfl_target*(x%spacing(j)**2._wp)/maxval(1/(rho*Re_l)) end if end if diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 65cc825e40..bc2796e776 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -203,19 +203,19 @@ contains if (file_exist) then open (2, FILE=trim(file_path), form='unformatted', ACTION='read', STATUS='old') - read (2) x_cb(-1:m); close (2) + read (2) x%cb(-1:m); close (2) else call s_mpi_abort(trim(file_path) // ' is missing. Exiting.') end if - dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp + x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) + x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp if (ib) then do i = 1, num_ibs if (patch_ib(i)%c > 0) then - Np = int((patch_ib(i)%p*patch_ib(i)%c/dx(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c)/dx(0)) & - & *20) + 1 + Np = int((patch_ib(i)%p*patch_ib(i)%c/x%spacing(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c) & + & /x%spacing(0))*20) + 1 end if end do end if @@ -227,13 +227,13 @@ contains if (file_exist) then open (2, FILE=trim(file_path), form='unformatted', ACTION='read', STATUS='old') - read (2) y_cb(-1:n); close (2) + read (2) y%cb(-1:n); close (2) else call s_mpi_abort(trim(file_path) // ' is missing. Exiting.') end if - dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp + y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) + y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp end if if (p > 0) then @@ -243,13 +243,13 @@ contains if (file_exist) then open (2, FILE=trim(file_path), form='unformatted', ACTION='read', STATUS='old') - read (2) z_cb(-1:p); close (2) + read (2) z%cb(-1:p); close (2) else call s_mpi_abort(trim(file_path) // ' is missing. Exiting.') end if - dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp + z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) + z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp end if do i = 1, sys_size @@ -344,15 +344,15 @@ contains call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.') end if - x_cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) - dx(0:m) = x_cb(0:m) - x_cb(-1:m - 1) - x_cc(0:m) = x_cb(-1:m - 1) + dx(0:m)/2._wp + x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) + x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) + x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp if (ib) then do i = 1, num_ibs if (patch_ib(i)%c > 0) then - Np = int((patch_ib(i)%p*patch_ib(i)%c/dx(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c)/dx(0)) & - & *20) + 1 + Np = int((patch_ib(i)%p*patch_ib(i)%c/x%spacing(0))*20) + int(((patch_ib(i)%c - patch_ib(i)%p*patch_ib(i)%c) & + & /x%spacing(0))*20) + 1 allocate (MPI_IO_airfoil_IB_DATA%var(1:2*Np)) end if end do @@ -371,9 +371,9 @@ contains call s_mpi_abort('File ' // trim(file_loc) // ' is missing. Exiting.') end if - y_cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) - dy(0:n) = y_cb(0:n) - y_cb(-1:n - 1) - y_cc(0:n) = y_cb(-1:n - 1) + dy(0:n)/2._wp + y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) + y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) + y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp if (p > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat' @@ -388,9 +388,9 @@ contains call s_mpi_abort('File ' // trim(file_loc) // 'is missing. Exiting.') end if - z_cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) - dz(0:p) = z_cb(0:p) - z_cb(-1:p - 1) - z_cc(0:p) = z_cb(-1:p - 1) + dz(0:p)/2._wp + z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) + z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) + z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp end if end if @@ -1068,7 +1068,7 @@ contains $:GPU_UPDATE(device='[acoustic_source, num_source]') $:GPU_UPDATE(device='[sigma, surface_tension]') - $:GPU_UPDATE(device='[dx, dy, dz, x_cb, x_cc, y_cb, y_cc, z_cb, z_cc]') + $:GPU_UPDATE(device='[x%spacing, y%spacing, z%spacing, x%cb, x%cc, y%cb, y%cc, z%cb, z%cc]') $:GPU_UPDATE(device='[bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end]') $:GPU_UPDATE(device='[bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3]') $:GPU_UPDATE(device='[bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3]') diff --git a/src/simulation/m_surface_tension.fpp b/src/simulation/m_surface_tension.fpp index 9a4d0c6425..60822e3505 100644 --- a/src/simulation/m_surface_tension.fpp +++ b/src/simulation/m_surface_tension.fpp @@ -237,7 +237,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(1)%sf(j, k, l) = 1._wp/(x_cc(j + 1) - x_cc(j - 1))*(q_prim_vf(eqn_idx%c)%sf(j + 1, k, & + c_divs(1)%sf(j, k, l) = 1._wp/(x%cc(j + 1) - x%cc(j - 1))*(q_prim_vf(eqn_idx%c)%sf(j + 1, k, & & l) - q_prim_vf(eqn_idx%c)%sf(j - 1, k, l)) end do end do @@ -248,7 +248,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(2)%sf(j, k, l) = 1._wp/(y_cc(k + 1) - y_cc(k - 1))*(q_prim_vf(eqn_idx%c)%sf(j, k + 1, & + c_divs(2)%sf(j, k, l) = 1._wp/(y%cc(k + 1) - y%cc(k - 1))*(q_prim_vf(eqn_idx%c)%sf(j, k + 1, & & l) - q_prim_vf(eqn_idx%c)%sf(j, k - 1, l)) end do end do @@ -260,7 +260,7 @@ contains do l = 0, p do k = 0, n do j = 0, m - c_divs(3)%sf(j, k, l) = 1._wp/(z_cc(l + 1) - z_cc(l - 1))*(q_prim_vf(eqn_idx%c)%sf(j, k, & + c_divs(3)%sf(j, k, l) = 1._wp/(z%cc(l + 1) - z%cc(l - 1))*(q_prim_vf(eqn_idx%c)%sf(j, k, & & l + 1) - q_prim_vf(eqn_idx%c)%sf(j, k, l - 1)) end do end do diff --git a/src/simulation/m_thinc.fpp b/src/simulation/m_thinc.fpp index a52ec19d76..0ba9d89263 100644 --- a/src/simulation/m_thinc.fpp +++ b/src/simulation/m_thinc.fpp @@ -242,18 +242,18 @@ contains if (ac >= ic_eps .and. ac <= 1._wp - ic_eps) then nr_x = (v_vf(eqn_idx%adv%beg)%sf(j + 1, k, l) - v_vf(eqn_idx%adv%beg)%sf(j - 1, k, & - & l))*(x_cb(j) - x_cb(j - 1))/(x_cc(j + 1) - x_cc(j - 1)) + & l))*(x%cb(j) - x%cb(j - 1))/(x%cc(j + 1) - x%cc(j - 1)) nr_y = 0._wp if (n > 0) then nr_y = (v_vf(eqn_idx%adv%beg)%sf(j, k + 1, l) - v_vf(eqn_idx%adv%beg)%sf(j, k - 1, & - & l))*(y_cb(k) - y_cb(k - 1))/(y_cc(k + 1) - y_cc(k - 1)) + & l))*(y%cb(k) - y%cb(k - 1))/(y%cc(k + 1) - y%cc(k - 1)) end if nr_z = 0._wp if (p > 0) then nr_z = (v_vf(eqn_idx%adv%beg)%sf(j, k, l + 1) - v_vf(eqn_idx%adv%beg)%sf(j, k, & - & l - 1))*(z_cb(l) - z_cb(l - 1))/(z_cc(l + 1) - z_cc(l - 1)) + & l - 1))*(z%cb(l) - z%cb(l - 1))/(z%cc(l + 1) - z%cc(l - 1)) end if nmag = sqrt(nr_x*nr_x + nr_y*nr_y + nr_z*nr_z) @@ -305,7 +305,7 @@ contains real(wp) :: nh1, nh2, nh3, d_local, rho1, rho2 real(wp) :: rho_b, rho_e - #:for REC_DIR, XYZ, CC_PRI in [(1, 'x', 'x_cc'), (2, 'y', 'y_cc'), (3, 'z', 'z_cc')] + #:for REC_DIR, XYZ, CC_PRI in [(1, 'x', 'x%cc'), (2, 'y', 'y%cc'), (3, 'z', 'z%cc')] if (recon_dir == ${REC_DIR}$) then $:GPU_PARALLEL_LOOP(collapse=3,private='[j, k, l, ix, iy, iz, aCL, aC, aCR, aTHINC, moncon, sgn, qmin, qmax, A, & & B, C, beta_eff, nh1, nh2, nh3, d_local, rho1, rho2, rho_b, rho_e]') diff --git a/src/simulation/m_viscous.fpp b/src/simulation/m_viscous.fpp index dfa32e5c98..f6dc194579 100644 --- a/src/simulation/m_viscous.fpp +++ b/src/simulation/m_viscous.fpp @@ -43,7 +43,7 @@ contains end subroutine s_initialize_viscous_module - !> Compute viscous stress tensor near cylindrical axis, avoiding 1/r singularity at y_cb(-1)=0 + !> Compute viscous stress tensor near cylindrical axis, avoiding 1/r singularity at y%cb(-1)=0 subroutine s_compute_viscous_stress_cylindrical_boundary(q_prim_vf, grad_x_vf, grad_y_vf, grad_z_vf, tau_Re_vf, ix, iy, iz) type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf @@ -166,7 +166,7 @@ contains tau_Re(2, 1) = (grad_y_vf(1)%sf(j, k, l) + grad_x_vf(2)%sf(j, k, l))/Re_visc(1) tau_Re(2, 2) = (4._wp*grad_y_vf(2)%sf(j, k, l) - 2._wp*grad_x_vf(1)%sf(j, k, & - & l) - 2._wp*q_prim_vf(eqn_idx%mom%beg + 1)%sf(j, k, l)/y_cc(k))/(3._wp*Re_visc(1)) + & l) - 2._wp*q_prim_vf(eqn_idx%mom%beg + 1)%sf(j, k, l)/y%cc(k))/(3._wp*Re_visc(1)) ! Viscous flux contribution to momentum and energy equations $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 @@ -266,7 +266,7 @@ contains end if tau_Re(2, 2) = (grad_x_vf(1)%sf(j, k, l) + grad_y_vf(2)%sf(j, k, & - & l) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(j, k, l)/y_cc(k))/Re_visc(2) + & l) + q_prim_vf(eqn_idx%mom%beg + 1)%sf(j, k, l)/y%cc(k))/Re_visc(2) tau_Re_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = tau_Re_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) - tau_Re(2, 2) @@ -362,10 +362,10 @@ contains end if end if - tau_Re(2, 2) = -(2._wp/3._wp)*grad_z_vf(3)%sf(j, k, l)/y_cc(k)/Re_visc(1) + tau_Re(2, 2) = -(2._wp/3._wp)*grad_z_vf(3)%sf(j, k, l)/y%cc(k)/Re_visc(1) tau_Re(2, 3) = ((grad_z_vf(2)%sf(j, k, l) - q_prim_vf(eqn_idx%mom%end)%sf(j, k, & - & l))/y_cc(k) + grad_y_vf(3)%sf(j, k, l))/Re_visc(1) + & l))/y%cc(k) + grad_y_vf(3)%sf(j, k, l))/Re_visc(1) $:GPU_LOOP(parallelism='[seq]') do i = 2, 3 @@ -462,7 +462,7 @@ contains end if end if - tau_Re(2, 2) = grad_z_vf(3)%sf(j, k, l)/y_cc(k)/Re_visc(2) + tau_Re(2, 2) = grad_z_vf(3)%sf(j, k, l)/y%cc(k)/Re_visc(2) tau_Re_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = tau_Re_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) - tau_Re(2, 2) @@ -510,15 +510,15 @@ contains do i = 1, num_dims if (i == 1) then call s_apply_scalar_divergence_theorem(qL_prim(i)%vf(iv%beg:iv%end), qR_prim(i)%vf(iv%beg:iv%end), & - & dq_prim_dx_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, dx, m, & + & dq_prim_dx_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, x%spacing, m, & & buff_size) else if (i == 2) then call s_apply_scalar_divergence_theorem(qL_prim(i)%vf(iv%beg:iv%end), qR_prim(i)%vf(iv%beg:iv%end), & - & dq_prim_dy_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, dy, n, & + & dq_prim_dy_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, y%spacing, n, & & buff_size) else call s_apply_scalar_divergence_theorem(qL_prim(i)%vf(iv%beg:iv%end), qR_prim(i)%vf(iv%beg:iv%end), & - & dq_prim_dz_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, dz, p, & + & dq_prim_dz_qp(1)%vf(iv%beg:iv%end), i, ix, iy, iz, iv, z%spacing, p, & & buff_size) end if end do @@ -537,7 +537,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqL_prim_dx_n(1)%vf(i)%sf(j, k, l) = (q_prim_qp%vf(i)%sf(j, k, l) - q_prim_qp%vf(i)%sf(j - 1, k, & - & l))/(x_cc(j) - x_cc(j - 1)) + & l))/(x%cc(j) - x%cc(j - 1)) end do end do end do @@ -551,7 +551,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqR_prim_dx_n(1)%vf(i)%sf(j, k, l) = (q_prim_qp%vf(i)%sf(j + 1, k, l) - q_prim_qp%vf(i)%sf(j, k, & - & l))/(x_cc(j + 1) - x_cc(j)) + & l))/(x%cc(j + 1) - x%cc(j)) end do end do end do @@ -567,7 +567,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqL_prim_dy_n(2)%vf(i)%sf(k, j, l) = (q_prim_qp%vf(i)%sf(k, j, l) - q_prim_qp%vf(i)%sf(k, & - & j - 1, l))/(y_cc(j) - y_cc(j - 1)) + & j - 1, l))/(y%cc(j) - y%cc(j - 1)) end do end do end do @@ -581,7 +581,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqR_prim_dy_n(2)%vf(i)%sf(k, j, l) = (q_prim_qp%vf(i)%sf(k, j + 1, l) - q_prim_qp%vf(i)%sf(k, & - & j, l))/(y_cc(j + 1) - y_cc(j)) + & j, l))/(y%cc(j + 1) - y%cc(j)) end do end do end do @@ -666,7 +666,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqL_prim_dz_n(3)%vf(i)%sf(k, l, j) = (q_prim_qp%vf(i)%sf(k, l, j) - q_prim_qp%vf(i)%sf(k, & - & l, j - 1))/(z_cc(j) - z_cc(j - 1)) + & l, j - 1))/(z%cc(j) - z%cc(j - 1)) end do end do end do @@ -680,7 +680,7 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = iv%beg, iv%end dqR_prim_dz_n(3)%vf(i)%sf(k, l, j) = (q_prim_qp%vf(i)%sf(k, l, & - & j + 1) - q_prim_qp%vf(i)%sf(k, l, j))/(z_cc(j + 1) - z_cc(j)) + & j + 1) - q_prim_qp%vf(i)%sf(k, l, j))/(z%cc(j + 1) - z%cc(j)) end do end do end do @@ -1158,7 +1158,7 @@ contains do l = is3_viscous%beg, is3_viscous%end do k = is2_viscous%beg, is2_viscous%end do j = is1_viscous%beg, is1_viscous%end - grad_x%sf(j, k, l) = (var%sf(j + 1, k, l) - var%sf(j - 1, k, l))/(x_cc(j + 1) - x_cc(j - 1)) + grad_x%sf(j, k, l) = (var%sf(j + 1, k, l) - var%sf(j - 1, k, l))/(x%cc(j + 1) - x%cc(j - 1)) end do end do end do @@ -1169,7 +1169,7 @@ contains do l = is3_viscous%beg, is3_viscous%end do k = is2_viscous%beg, is2_viscous%end do j = is1_viscous%beg, is1_viscous%end - grad_y%sf(j, k, l) = (var%sf(j, k + 1, l) - var%sf(j, k - 1, l))/(y_cc(k + 1) - y_cc(k - 1)) + grad_y%sf(j, k, l) = (var%sf(j, k + 1, l) - var%sf(j, k - 1, l))/(y%cc(k + 1) - y%cc(k - 1)) end do end do end do @@ -1181,7 +1181,7 @@ contains do l = is3_viscous%beg, is3_viscous%end do k = is2_viscous%beg, is2_viscous%end do j = is1_viscous%beg, is1_viscous%end - grad_z%sf(j, k, l) = (var%sf(j, k, l + 1) - var%sf(j, k, l - 1))/(z_cc(l + 1) - z_cc(l - 1)) + grad_z%sf(j, k, l) = (var%sf(j, k, l + 1) - var%sf(j, k, l - 1))/(z%cc(l + 1) - z%cc(l - 1)) end do end do end do @@ -1192,9 +1192,9 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end grad_x%sf(idwbuff(1)%beg, k, l) = (-3._wp*var%sf(idwbuff(1)%beg, k, l) + 4._wp*var%sf(idwbuff(1)%beg + 1, k, & - & l) - var%sf(idwbuff(1)%beg + 2, k, l))/(x_cc(idwbuff(1)%beg + 2) - x_cc(idwbuff(1)%beg)) + & l) - var%sf(idwbuff(1)%beg + 2, k, l))/(x%cc(idwbuff(1)%beg + 2) - x%cc(idwbuff(1)%beg)) grad_x%sf(idwbuff(1)%end, k, l) = (+3._wp*var%sf(idwbuff(1)%end, k, l) - 4._wp*var%sf(idwbuff(1)%end - 1, k, & - & l) + var%sf(idwbuff(1)%end - 2, k, l))/(x_cc(idwbuff(1)%end) - x_cc(idwbuff(1)%end - 2)) + & l) + var%sf(idwbuff(1)%end - 2, k, l))/(x%cc(idwbuff(1)%end) - x%cc(idwbuff(1)%end - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1203,9 +1203,9 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_y%sf(j, idwbuff(2)%beg, l) = (-3._wp*var%sf(j, idwbuff(2)%beg, l) + 4._wp*var%sf(j, idwbuff(2)%beg + 1, & - & l) - var%sf(j, idwbuff(2)%beg + 2, l))/(y_cc(idwbuff(2)%beg + 2) - y_cc(idwbuff(2)%beg)) + & l) - var%sf(j, idwbuff(2)%beg + 2, l))/(y%cc(idwbuff(2)%beg + 2) - y%cc(idwbuff(2)%beg)) grad_y%sf(j, idwbuff(2)%end, l) = (+3._wp*var%sf(j, idwbuff(2)%end, l) - 4._wp*var%sf(j, idwbuff(2)%end - 1, & - & l) + var%sf(j, idwbuff(2)%end - 2, l))/(y_cc(idwbuff(2)%end) - y_cc(idwbuff(2)%end - 2)) + & l) + var%sf(j, idwbuff(2)%end - 2, l))/(y%cc(idwbuff(2)%end) - y%cc(idwbuff(2)%end - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1215,10 +1215,10 @@ contains do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, idwbuff(3)%beg) = (-3._wp*var%sf(j, k, idwbuff(3)%beg) + 4._wp*var%sf(j, k, & & idwbuff(3)%beg + 1) - var%sf(j, k, & - & idwbuff(3)%beg + 2))/(z_cc(idwbuff(3)%beg + 2) - z_cc(is3_viscous%beg)) + & idwbuff(3)%beg + 2))/(z%cc(idwbuff(3)%beg + 2) - z%cc(is3_viscous%beg)) grad_z%sf(j, k, idwbuff(3)%end) = (+3._wp*var%sf(j, k, idwbuff(3)%end) - 4._wp*var%sf(j, k, & & idwbuff(3)%end - 1) + var%sf(j, k, & - & idwbuff(3)%end - 2))/(z_cc(idwbuff(3)%end) - z_cc(idwbuff(3)%end - 2)) + & idwbuff(3)%end - 2))/(z%cc(idwbuff(3)%end) - z%cc(idwbuff(3)%end - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1229,7 +1229,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end - grad_x%sf(0, k, l) = (-3._wp*var%sf(0, k, l) + 4._wp*var%sf(1, k, l) - var%sf(2, k, l))/(x_cc(2) - x_cc(0)) + grad_x%sf(0, k, l) = (-3._wp*var%sf(0, k, l) + 4._wp*var%sf(1, k, l) - var%sf(2, k, l))/(x%cc(2) - x%cc(0)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1239,7 +1239,7 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end grad_x%sf(m, k, l) = (3._wp*var%sf(m, k, l) - 4._wp*var%sf(m - 1, k, l) + var%sf(m - 2, k, & - & l))/(x_cc(m) - x_cc(m - 2)) + & l))/(x%cc(m) - x%cc(m - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1249,7 +1249,7 @@ contains $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end - grad_y%sf(j, 0, l) = (-3._wp*var%sf(j, 0, l) + 4._wp*var%sf(j, 1, l) - var%sf(j, 2, l))/(y_cc(2) - y_cc(0)) + grad_y%sf(j, 0, l) = (-3._wp*var%sf(j, 0, l) + 4._wp*var%sf(j, 1, l) - var%sf(j, 2, l))/(y%cc(2) - y%cc(0)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1259,7 +1259,7 @@ contains do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_y%sf(j, n, l) = (3._wp*var%sf(j, n, l) - 4._wp*var%sf(j, n - 1, l) + var%sf(j, n - 2, & - & l))/(y_cc(n) - y_cc(n - 2)) + & l))/(y%cc(n) - y%cc(n - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1270,7 +1270,7 @@ contains do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, 0) = (-3._wp*var%sf(j, k, 0) + 4._wp*var%sf(j, k, 1) - var%sf(j, k, & - & 2))/(z_cc(2) - z_cc(0)) + & 2))/(z%cc(2) - z%cc(0)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1280,7 +1280,7 @@ contains do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end grad_z%sf(j, k, p) = (3._wp*var%sf(j, k, p) - 4._wp*var%sf(j, k, p - 1) + var%sf(j, k, & - & p - 2))/(z_cc(p) - z_cc(p - 2)) + & p - 2))/(z%cc(p) - z%cc(p - 2)) end do end do $:END_GPU_PARALLEL_LOOP() @@ -1300,31 +1300,31 @@ contains real(wp), intent(in) :: dynamic_viscosity integer, intent(in) :: i, j, k real(wp), dimension(1:3,1:3) :: velocity_gradient_tensor - real(wp), dimension(1:3) :: dx + real(wp), dimension(1:3) :: ds real(wp) :: divergence integer :: l, q !< iterators ! zero the viscous stress, collection of velocity derivatives, and spatial finite differences viscous_stress_tensor = 0._wp velocity_gradient_tensor = 0._wp - dx = 0._wp + ds = 0._wp ! get the change in x used in the finite difference equation - dx(1) = 0.5_wp*(x_cc(i + 1) - x_cc(i - 1)) - dx(2) = 0.5_wp*(y_cc(j + 1) - y_cc(j - 1)) + ds(1) = 0.5_wp*(x%cc(i + 1) - x%cc(i - 1)) + ds(2) = 0.5_wp*(y%cc(j + 1) - y%cc(j - 1)) if (num_dims == 3) then - dx(3) = 0.5_wp*(z_cc(k + 1) - z_cc(k - 1)) + ds(3) = 0.5_wp*(z%cc(k + 1) - z%cc(k - 1)) end if ! compute the velocity gradient tensor do l = 1, num_dims velocity_gradient_tensor(l, 1) = (q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i + 1, j, & - & k) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i - 1, j, k))/(2._wp*dx(1)) + & k) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i - 1, j, k))/(2._wp*ds(1)) velocity_gradient_tensor(l, 2) = (q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j + 1, & - & k) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j - 1, k))/(2._wp*dx(2)) + & k) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j - 1, k))/(2._wp*ds(2)) if (num_dims == 3) then velocity_gradient_tensor(l, 3) = (q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j, & - & k + 1) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j, k - 1))/(2._wp*dx(3)) + & k + 1) - q_prim_vf(eqn_idx%mom%beg + l - 1)%sf(i, j, k - 1))/(2._wp*ds(3)) end if end do diff --git a/src/simulation/m_weno.fpp b/src/simulation/m_weno.fpp index 5ccd85756f..b51d376458 100644 --- a/src/simulation/m_weno.fpp +++ b/src/simulation/m_weno.fpp @@ -185,17 +185,17 @@ contains type(int_bounds_info) :: bc_s !< Boundary conditions (BC) in the s-direction integer :: i !< Generic loop iterator real(wp) :: w(1:8) !< Intermediate var for ideal weights: s_cb across overall stencil - real(wp) :: y(1:4) !< Intermediate var for poly & beta: diff(s_cb) across sub-stencil + real(wp) :: ys(1:4) !< Intermediate var for poly & beta: diff(s_cb) across sub-stencil real(wp) :: h0 !< Reference spacing for uniform-grid detection ! Determine cell count, boundary locations, and BCs for selected WENO direction if (weno_dir == 1) then - s = m; s_cb => x_cb; bc_s = bc_x + s = m; s_cb => x%cb; bc_s = bc_x else if (weno_dir == 2) then - s = n; s_cb => y_cb; bc_s = bc_y + s = n; s_cb => y%cb; bc_s = bc_y else - s = p; s_cb => z_cb; bc_s = bc_z + s = p; s_cb => z%cb; bc_s = bc_z end if #:for WENO_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] @@ -375,7 +375,7 @@ contains ! Smoothness Indicators (beta_coef) To reduce computational cost, we leverage the fact that all ! polynomial coefficients in a stencil sum to 1 and compute the polynomial coefficients (poly_coef_cb) ! for the cell value differences (dvd) instead of the values themselves. The computation of coefficients - ! is further simplified by using grid spacing (y or w) rather than the grid locations (s_cb) directly. + ! is further simplified by using grid spacing (ys or w) rather than the grid locations (s_cb) directly. ! Ideal weights (d_cb) are obtained by comparing the grid location coefficients of the polynomial ! coefficients. The smoothness indicators (beta_coef) are calculated through numerical differentiation ! and integration of each cross term of the polynomial coefficients, using the cell value differences @@ -419,415 +419,451 @@ contains & *(w(1) - w(8))) ! Note: Left has the reversed order of both points and coefficients compared to the right - y = s_cb(i + 1:i + 4) - s_cb(i:i + 3) + ys = s_cb(i + 1:i + 4) - s_cb(i:i + 3) poly_coef_cbR_${XYZ}$ (i + 1, 0, & - & 0) = (y(1)*y(2)*(y(2) + y(3)))/((y(3) + y(4))*(y(2) + y(3) + y(4))*(y(1) & - & + y(2) + y(3) + y(4))) + & 0) = (ys(1)*ys(2)*(ys(2) + ys(3)))/((ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 0, & - & 1) = -(y(1)*y(2)*(3*y(2)**2 + 6*y(2)*y(3) + 3*y(2)*y(4) + 2*y(1)*y(2) & - & + 3*y(3)**2 + 3*y(3)*y(4) + 2*y(1)*y(3) + y(4)**2 + y(1)*y(4)))/((y(2) + y(3) & - & )*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = -(ys(1)*ys(2)*(3*ys(2)**2 + 6*ys(2)*ys(3) + 3*ys(2)*ys(4) + 2*ys(1) & + & *ys(2) + 3*ys(3)**2 + 3*ys(3)*ys(4) + 2*ys(1)*ys(3) + ys(4)**2 + ys(1)*ys(4)) & + & )/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 0, & - & 2) = (y(1)*(y(1)**2 + 3*y(1)*y(2) + 2*y(1)*y(3) + y(4)*y(1) + 3*y(2)**2 & - & + 4*y(2)*y(3) + 2*y(4)*y(2) + y(3)**2 + y(4)*y(3)))/((y(1) + y(2))*(y(1) & - & + y(2) + y(3))*(y(1) + y(2) + y(3) + y(4))) + & 2) = (ys(1)*(ys(1)**2 + 3*ys(1)*ys(2) + 2*ys(1)*ys(3) + ys(4)*ys(1) + 3*ys(2) & + & **2 + 4*ys(2)*ys(3) + 2*ys(4)*ys(2) + ys(3)**2 + ys(4)*ys(3)))/((ys(1) & + & + ys(2))*(ys(1) + ys(2) + ys(3))*(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i:i + 3) - s_cb(i - 1:i + 2) + ys = s_cb(i:i + 3) - s_cb(i - 1:i + 2) poly_coef_cbR_${XYZ}$ (i + 1, 1, & - & 0) = -(y(2)*y(3)*(y(1) + y(2)))/((y(3) + y(4))*(y(2) + y(3) + y(4))*(y(1) & - & + y(2) + y(3) + y(4))) + & 0) = -(ys(2)*ys(3)*(ys(1) + ys(2)))/((ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 1, & - & 1) = (y(2)*(y(1) + y(2))*(y(2)**2 + 4*y(2)*y(3) + 2*y(2)*y(4) + y(1)*y(2) & - & + 3*y(3)**2 + 3*y(3)*y(4) + 2*y(1)*y(3) + y(4)**2 + y(1)*y(4)))/((y(2) + y(3) & - & )*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = (ys(2)*(ys(1) + ys(2))*(ys(2)**2 + 4*ys(2)*ys(3) + 2*ys(2)*ys(4) + ys(1) & + & *ys(2) + 3*ys(3)**2 + 3*ys(3)*ys(4) + 2*ys(1)*ys(3) + ys(4)**2 + ys(1)*ys(4)) & + & )/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 1, & - & 2) = (y(2)*y(3)*(y(3) + y(4)))/((y(1) + y(2))*(y(1) + y(2) + y(3))*(y(1) & - & + y(2) + y(3) + y(4))) + & 2) = (ys(2)*ys(3)*(ys(3) + ys(4)))/((ys(1) + ys(2))*(ys(1) + ys(2) + ys(3)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i - 1:i + 2) - s_cb(i - 2:i + 1) + ys = s_cb(i - 1:i + 2) - s_cb(i - 2:i + 1) poly_coef_cbR_${XYZ}$ (i + 1, 2, & - & 0) = (y(3)*(y(2) + y(3))*(y(1) + y(2) + y(3)))/((y(3) + y(4))*(y(2) + y(3) & - & + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 0) = (ys(3)*(ys(2) + ys(3))*(ys(1) + ys(2) + ys(3)))/((ys(3) + ys(4))*(ys(2) & + & + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 2, & - & 1) = (y(3)*y(4)*(y(1)**2 + 3*y(1)*y(2) + 3*y(1)*y(3) + y(4)*y(1) + 3*y(2)**2 & - & + 6*y(2)*y(3) + 2*y(4)*y(2) + 3*y(3)**2 + 2*y(4)*y(3)))/((y(2) + y(3))*(y(1) & - & + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = (ys(3)*ys(4)*(ys(1)**2 + 3*ys(1)*ys(2) + 3*ys(1)*ys(3) + ys(4)*ys(1) & + & + 3*ys(2)**2 + 6*ys(2)*ys(3) + 2*ys(4)*ys(2) + 3*ys(3)**2 + 2*ys(4)*ys(3))) & + & /((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 2, & - & 2) = -(y(3)*y(4)*(y(2) + y(3)))/((y(1) + y(2))*(y(1) + y(2) + y(3))*(y(1) & - & + y(2) + y(3) + y(4))) + & 2) = -(ys(3)*ys(4)*(ys(2) + ys(3)))/((ys(1) + ys(2))*(ys(1) + ys(2) + ys(3)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i - 2:i + 1) - s_cb(i - 3:i) + ys = s_cb(i - 2:i + 1) - s_cb(i - 3:i) poly_coef_cbR_${XYZ}$ (i + 1, 3, & - & 0) = (y(4)*(y(2)**2 + 4*y(2)*y(3) + 4*y(2)*y(4) + y(1)*y(2) + 3*y(3)**2 & - & + 6*y(3)*y(4) + 2*y(1)*y(3) + 3*y(4)**2 + 2*y(1)*y(4)))/((y(3) + y(4))*(y(2) & - & + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 0) = (ys(4)*(ys(2)**2 + 4*ys(2)*ys(3) + 4*ys(2)*ys(4) + ys(1)*ys(2) + 3*ys(3) & + & **2 + 6*ys(3)*ys(4) + 2*ys(1)*ys(3) + 3*ys(4)**2 + 2*ys(1)*ys(4)))/((ys(3) & + & + ys(4))*(ys(2) + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 3, & - & 1) = -(y(4)*(y(3) + y(4))*(y(1)**2 + 3*y(1)*y(2) + 3*y(1)*y(3) + 2*y(1)*y(4) & - & + 3*y(2)**2 + 6*y(2)*y(3) + 4*y(2)*y(4) + 3*y(3)**2 + 4*y(3)*y(4) + y(4)**2)) & - & /((y(2) + y(3))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) & - & + y(4))) + & 1) = -(ys(4)*(ys(3) + ys(4))*(ys(1)**2 + 3*ys(1)*ys(2) + 3*ys(1)*ys(3) & + & + 2*ys(1)*ys(4) + 3*ys(2)**2 + 6*ys(2)*ys(3) + 4*ys(2)*ys(4) + 3*ys(3)**2 & + & + 4*ys(3)*ys(4) + ys(4)**2))/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) & + & + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbR_${XYZ}$ (i + 1, 3, & - & 2) = (y(4)*(y(3) + y(4))*(y(2) + y(3) + y(4)))/((y(1) + y(2))*(y(1) + y(2) & - & + y(3))*(y(1) + y(2) + y(3) + y(4))) + & 2) = (ys(4)*(ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)))/((ys(1) + ys(2))*(ys(1) & + & + ys(2) + ys(3))*(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i + 1:i - 2:-1) - s_cb(i:i - 3:-1) + ys = s_cb(i + 1:i - 2:-1) - s_cb(i:i - 3:-1) poly_coef_cbL_${XYZ}$ (i + 1, 3, & - & 2) = (y(1)*y(2)*(y(2) + y(3)))/((y(3) + y(4))*(y(2) + y(3) + y(4))*(y(1) & - & + y(2) + y(3) + y(4))) + & 2) = (ys(1)*ys(2)*(ys(2) + ys(3)))/((ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 3, & - & 1) = -(y(1)*y(2)*(3*y(2)**2 + 6*y(2)*y(3) + 3*y(2)*y(4) + 2*y(1)*y(2) & - & + 3*y(3)**2 + 3*y(3)*y(4) + 2*y(1)*y(3) + y(4)**2 + y(1)*y(4)))/((y(2) + y(3) & - & )*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = -(ys(1)*ys(2)*(3*ys(2)**2 + 6*ys(2)*ys(3) + 3*ys(2)*ys(4) + 2*ys(1) & + & *ys(2) + 3*ys(3)**2 + 3*ys(3)*ys(4) + 2*ys(1)*ys(3) + ys(4)**2 + ys(1)*ys(4)) & + & )/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 3, & - & 0) = (y(1)*(y(1)**2 + 3*y(1)*y(2) + 2*y(1)*y(3) + y(4)*y(1) + 3*y(2)**2 & - & + 4*y(2)*y(3) + 2*y(4)*y(2) + y(3)**2 + y(4)*y(3)))/((y(1) + y(2))*(y(1) & - & + y(2) + y(3))*(y(1) + y(2) + y(3) + y(4))) + & 0) = (ys(1)*(ys(1)**2 + 3*ys(1)*ys(2) + 2*ys(1)*ys(3) + ys(4)*ys(1) + 3*ys(2) & + & **2 + 4*ys(2)*ys(3) + 2*ys(4)*ys(2) + ys(3)**2 + ys(4)*ys(3)))/((ys(1) & + & + ys(2))*(ys(1) + ys(2) + ys(3))*(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i + 2:i - 1:-1) - s_cb(i + 1:i - 2:-1) + ys = s_cb(i + 2:i - 1:-1) - s_cb(i + 1:i - 2:-1) poly_coef_cbL_${XYZ}$ (i + 1, 2, & - & 2) = -(y(2)*y(3)*(y(1) + y(2)))/((y(3) + y(4))*(y(2) + y(3) + y(4))*(y(1) & - & + y(2) + y(3) + y(4))) + & 2) = -(ys(2)*ys(3)*(ys(1) + ys(2)))/((ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 2, & - & 1) = (y(2)*(y(1) + y(2))*(y(2)**2 + 4*y(2)*y(3) + 2*y(2)*y(4) + y(1)*y(2) & - & + 3*y(3)**2 + 3*y(3)*y(4) + 2*y(1)*y(3) + y(4)**2 + y(1)*y(4)))/((y(2) + y(3) & - & )*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = (ys(2)*(ys(1) + ys(2))*(ys(2)**2 + 4*ys(2)*ys(3) + 2*ys(2)*ys(4) + ys(1) & + & *ys(2) + 3*ys(3)**2 + 3*ys(3)*ys(4) + 2*ys(1)*ys(3) + ys(4)**2 + ys(1)*ys(4)) & + & )/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 2, & - & 0) = (y(2)*y(3)*(y(3) + y(4)))/((y(1) + y(2))*(y(1) + y(2) + y(3))*(y(1) & - & + y(2) + y(3) + y(4))) + & 0) = (ys(2)*ys(3)*(ys(3) + ys(4)))/((ys(1) + ys(2))*(ys(1) + ys(2) + ys(3)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i + 3:i:-1) - s_cb(i + 2:i - 1:-1) + ys = s_cb(i + 3:i:-1) - s_cb(i + 2:i - 1:-1) poly_coef_cbL_${XYZ}$ (i + 1, 1, & - & 2) = (y(3)*(y(2) + y(3))*(y(1) + y(2) + y(3)))/((y(3) + y(4))*(y(2) + y(3) & - & + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 2) = (ys(3)*(ys(2) + ys(3))*(ys(1) + ys(2) + ys(3)))/((ys(3) + ys(4))*(ys(2) & + & + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 1, & - & 1) = (y(3)*y(4)*(y(1)**2 + 3*y(1)*y(2) + 3*y(1)*y(3) + y(4)*y(1) + 3*y(2)**2 & - & + 6*y(2)*y(3) + 2*y(4)*y(2) + 3*y(3)**2 + 2*y(4)*y(3)))/((y(2) + y(3))*(y(1) & - & + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 1) = (ys(3)*ys(4)*(ys(1)**2 + 3*ys(1)*ys(2) + 3*ys(1)*ys(3) + ys(4)*ys(1) & + & + 3*ys(2)**2 + 6*ys(2)*ys(3) + 2*ys(4)*ys(2) + 3*ys(3)**2 + 2*ys(4)*ys(3))) & + & /((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))*(ys(1) & + & + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 1, & - & 0) = -(y(3)*y(4)*(y(2) + y(3)))/((y(1) + y(2))*(y(1) + y(2) + y(3))*(y(1) & - & + y(2) + y(3) + y(4))) + & 0) = -(ys(3)*ys(4)*(ys(2) + ys(3)))/((ys(1) + ys(2))*(ys(1) + ys(2) + ys(3)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))) - y = s_cb(i + 4:i + 1:-1) - s_cb(i + 3:i:-1) + ys = s_cb(i + 4:i + 1:-1) - s_cb(i + 3:i:-1) poly_coef_cbL_${XYZ}$ (i + 1, 0, & - & 2) = (y(4)*(y(2)**2 + 4*y(2)*y(3) + 4*y(2)*y(4) + y(1)*y(2) + 3*y(3)**2 & - & + 6*y(3)*y(4) + 2*y(1)*y(3) + 3*y(4)**2 + 2*y(1)*y(4)))/((y(3) + y(4))*(y(2) & - & + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))) + & 2) = (ys(4)*(ys(2)**2 + 4*ys(2)*ys(3) + 4*ys(2)*ys(4) + ys(1)*ys(2) + 3*ys(3) & + & **2 + 6*ys(3)*ys(4) + 2*ys(1)*ys(3) + 3*ys(4)**2 + 2*ys(1)*ys(4)))/((ys(3) & + & + ys(4))*(ys(2) + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 0, & - & 1) = -(y(4)*(y(3) + y(4))*(y(1)**2 + 3*y(1)*y(2) + 3*y(1)*y(3) + 2*y(1)*y(4) & - & + 3*y(2)**2 + 6*y(2)*y(3) + 4*y(2)*y(4) + 3*y(3)**2 + 4*y(3)*y(4) + y(4)**2)) & - & /((y(2) + y(3))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) & - & + y(4))) + & 1) = -(ys(4)*(ys(3) + ys(4))*(ys(1)**2 + 3*ys(1)*ys(2) + 3*ys(1)*ys(3) & + & + 2*ys(1)*ys(4) + 3*ys(2)**2 + 6*ys(2)*ys(3) + 4*ys(2)*ys(4) + 3*ys(3)**2 & + & + 4*ys(3)*ys(4) + ys(4)**2))/((ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))*(ys(2) & + & + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1, 0, & - & 0) = (y(4)*(y(3) + y(4))*(y(2) + y(3) + y(4)))/((y(1) + y(2))*(y(1) + y(2) & - & + y(3))*(y(1) + y(2) + y(3) + y(4))) + & 0) = (ys(4)*(ys(3) + ys(4))*(ys(2) + ys(3) + ys(4)))/((ys(1) + ys(2))*(ys(1) & + & + ys(2) + ys(3))*(ys(1) + ys(2) + ys(3) + ys(4))) poly_coef_cbL_${XYZ}$ (i + 1,:,:) = -poly_coef_cbL_${XYZ}$ (i + 1,:,:) ! Note: negative sign as the direction of taking the difference (dvd) is reversed - y = s_cb(i - 2:i + 1) - s_cb(i - 3:i) + ys = s_cb(i - 2:i + 1) - s_cb(i - 3:i) beta_coef_${XYZ}$ (i + 1, 3, & - & 0) = (4*y(4)**2*(5*y(1)**2*y(2)**2 + 20*y(1)**2*y(2)*y(3) + 15*y(1)**2*y(2)*y(4) & - & + 20*y(1)**2*y(3)**2 + 30*y(1)**2*y(3)*y(4) + 60*y(1)**2*y(4)**2 + 10*y(1)*y(2) & - & **3 + 60*y(1)*y(2)**2*y(3) + 45*y(1)*y(2)**2*y(4) + 110*y(1)*y(2)*y(3)**2 & - & + 165*y(1)*y(2)*y(3)*y(4) + 260*y(1)*y(2)*y(4)**2 + 60*y(1)*y(3)**3 + 135*y(1) & - & *y(3)**2*y(4) + 400*y(1)*y(3)*y(4)**2 + 225*y(1)*y(4)**3 + 5*y(2)**4 + 40*y(2) & - & **3*y(3) + 30*y(2)**3*y(4) + 110*y(2)**2*y(3)**2 + 165*y(2)**2*y(3)*y(4) & - & + 260*y(2)**2*y(4)**2 + 120*y(2)*y(3)**3 + 270*y(2)*y(3)**2*y(4) + 800*y(2)*y(3) & - & *y(4)**2 + 450*y(2)*y(4)**3 + 45*y(3)**4 + 135*y(3)**3*y(4) + 600*y(3)**2*y(4) & - & **2 + 675*y(3)*y(4)**3 + 996*y(4)**4))/(5*(y(3) + y(4))**2*(y(2) + y(3) + y(4)) & - & **2*(y(1) + y(2) + y(3) + y(4))**2) + & 0) = (4*ys(4)**2*(5*ys(1)**2*ys(2)**2 + 20*ys(1)**2*ys(2)*ys(3) + 15*ys(1) & + & **2*ys(2)*ys(4) + 20*ys(1)**2*ys(3)**2 + 30*ys(1)**2*ys(3)*ys(4) + 60*ys(1) & + & **2*ys(4)**2 + 10*ys(1)*ys(2)**3 + 60*ys(1)*ys(2)**2*ys(3) + 45*ys(1)*ys(2) & + & **2*ys(4) + 110*ys(1)*ys(2)*ys(3)**2 + 165*ys(1)*ys(2)*ys(3)*ys(4) + 260*ys(1) & + & *ys(2)*ys(4)**2 + 60*ys(1)*ys(3)**3 + 135*ys(1)*ys(3)**2*ys(4) + 400*ys(1)*ys(3) & + & *ys(4)**2 + 225*ys(1)*ys(4)**3 + 5*ys(2)**4 + 40*ys(2)**3*ys(3) + 30*ys(2) & + & **3*ys(4) + 110*ys(2)**2*ys(3)**2 + 165*ys(2)**2*ys(3)*ys(4) + 260*ys(2)**2*ys(4) & + & **2 + 120*ys(2)*ys(3)**3 + 270*ys(2)*ys(3)**2*ys(4) + 800*ys(2)*ys(3)*ys(4)**2 & + & + 450*ys(2)*ys(4)**3 + 45*ys(3)**4 + 135*ys(3)**3*ys(4) + 600*ys(3)**2*ys(4)**2 & + & + 675*ys(3)*ys(4)**3 + 996*ys(4)**4))/(5*(ys(3) + ys(4))**2*(ys(2) + ys(3) & + & + ys(4))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 3, & - & 1) = -(4*y(4)**2*(10*y(1)**3*y(2)*y(3) + 5*y(1)**3*y(2)*y(4) + 20*y(1)**3*y(3) & - & **2 + 25*y(1)**3*y(3)*y(4) + 105*y(1)**3*y(4)**2 + 40*y(1)**2*y(2)**2*y(3) & - & + 20*y(1)**2*y(2)**2*y(4) + 130*y(1)**2*y(2)*y(3)**2 + 155*y(1)**2*y(2)*y(3)*y(4) & - & + 535*y(1)**2*y(2)*y(4)**2 + 90*y(1)**2*y(3)**3 + 165*y(1)**2*y(3)**2*y(4) & - & + 790*y(1)**2*y(3)*y(4)**2 + 415*y(1)**2*y(4)**3 + 60*y(1)*y(2)**3*y(3) + 30*y(1) & - & *y(2)**3*y(4) + 270*y(1)*y(2)**2*y(3)**2 + 315*y(1)*y(2)**2*y(3)*y(4) + 975*y(1) & - & *y(2)**2*y(4)**2 + 360*y(1)*y(2)*y(3)**3 + 645*y(1)*y(2)*y(3)**2*y(4) + 2850*y(1) & - & *y(2)*y(3)*y(4)**2 + 1460*y(1)*y(2)*y(4)**3 + 150*y(1)*y(3)**4 + 360*y(1)*y(3) & - & **3*y(4) + 2000*y(1)*y(3)**2*y(4)**2 + 2005*y(1)*y(3)*y(4)**3 + 2077*y(1)*y(4) & - & **4 + 30*y(2)**4*y(3) + 15*y(2)**4*y(4) + 180*y(2)**3*y(3)**2 + 210*y(2)**3*y(3) & - & *y(4) + 650*y(2)**3*y(4)**2 + 360*y(2)**2*y(3)**3 + 645*y(2)**2*y(3)**2*y(4) & - & + 2850*y(2)**2*y(3)*y(4)**2 + 1460*y(2)**2*y(4)**3 + 300*y(2)*y(3)**4 + 720*y(2) & - & *y(3)**3*y(4) + 4000*y(2)*y(3)**2*y(4)**2 + 4010*y(2)*y(3)*y(4)**3 + 4154*y(2) & - & *y(4)**4 + 90*y(3)**5 + 270*y(3)**4*y(4) + 1800*y(3)**3*y(4)**2 + 2655*y(3) & - & **2*y(4)**3 + 4464*y(3)*y(4)**4 + 1767*y(4)**5))/(5*(y(2) + y(3))*(y(3) + y(4)) & - & *(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 1) = -(4*ys(4)**2*(10*ys(1)**3*ys(2)*ys(3) + 5*ys(1)**3*ys(2)*ys(4) + 20*ys(1) & + & **3*ys(3)**2 + 25*ys(1)**3*ys(3)*ys(4) + 105*ys(1)**3*ys(4)**2 + 40*ys(1) & + & **2*ys(2)**2*ys(3) + 20*ys(1)**2*ys(2)**2*ys(4) + 130*ys(1)**2*ys(2)*ys(3)**2 & + & + 155*ys(1)**2*ys(2)*ys(3)*ys(4) + 535*ys(1)**2*ys(2)*ys(4)**2 + 90*ys(1) & + & **2*ys(3)**3 + 165*ys(1)**2*ys(3)**2*ys(4) + 790*ys(1)**2*ys(3)*ys(4)**2 & + & + 415*ys(1)**2*ys(4)**3 + 60*ys(1)*ys(2)**3*ys(3) + 30*ys(1)*ys(2)**3*ys(4) & + & + 270*ys(1)*ys(2)**2*ys(3)**2 + 315*ys(1)*ys(2)**2*ys(3)*ys(4) + 975*ys(1)*ys(2) & + & **2*ys(4)**2 + 360*ys(1)*ys(2)*ys(3)**3 + 645*ys(1)*ys(2)*ys(3)**2*ys(4) & + & + 2850*ys(1)*ys(2)*ys(3)*ys(4)**2 + 1460*ys(1)*ys(2)*ys(4)**3 + 150*ys(1)*ys(3) & + & **4 + 360*ys(1)*ys(3)**3*ys(4) + 2000*ys(1)*ys(3)**2*ys(4)**2 + 2005*ys(1)*ys(3) & + & *ys(4)**3 + 2077*ys(1)*ys(4)**4 + 30*ys(2)**4*ys(3) + 15*ys(2)**4*ys(4) & + & + 180*ys(2)**3*ys(3)**2 + 210*ys(2)**3*ys(3)*ys(4) + 650*ys(2)**3*ys(4)**2 & + & + 360*ys(2)**2*ys(3)**3 + 645*ys(2)**2*ys(3)**2*ys(4) + 2850*ys(2)**2*ys(3)*ys(4) & + & **2 + 1460*ys(2)**2*ys(4)**3 + 300*ys(2)*ys(3)**4 + 720*ys(2)*ys(3)**3*ys(4) & + & + 4000*ys(2)*ys(3)**2*ys(4)**2 + 4010*ys(2)*ys(3)*ys(4)**3 + 4154*ys(2)*ys(4)**4 & + & + 90*ys(3)**5 + 270*ys(3)**4*ys(4) + 1800*ys(3)**3*ys(4)**2 + 2655*ys(3)**2*ys(4) & + & **3 + 4464*ys(3)*ys(4)**4 + 1767*ys(4)**5))/(5*(ys(2) + ys(3))*(ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))**2*(ys(1) + ys(2) + ys(3) & + & + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 3, & - & 2) = (4*y(4)**2*(10*y(2)**3*y(3) + 5*y(2)**3*y(4) + 50*y(2)**2*y(3)**2 + 60*y(2) & - & **2*y(3)*y(4) + 10*y(1)*y(2)**2*y(3) + 215*y(2)**2*y(4)**2 + 5*y(1)*y(2)**2*y(4) & - & + 70*y(2)*y(3)**3 + 130*y(2)*y(3)**2*y(4) + 30*y(1)*y(2)*y(3)**2 + 775*y(2)*y(3) & - & *y(4)**2 + 35*y(1)*y(2)*y(3)*y(4) + 415*y(2)*y(4)**3 + 110*y(1)*y(2)*y(4)**2 & - & + 30*y(3)**4 + 75*y(3)**3*y(4) + 20*y(1)*y(3)**3 + 665*y(3)**2*y(4)**2 + 35*y(1) & - & *y(3)**2*y(4) + 725*y(3)*y(4)**3 + 220*y(1)*y(3)*y(4)**2 + 1767*y(4)**4 & - & + 105*y(1)*y(4)**3))/(5*(y(1) + y(2))*(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) & - & + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))**2) + & 2) = (4*ys(4)**2*(10*ys(2)**3*ys(3) + 5*ys(2)**3*ys(4) + 50*ys(2)**2*ys(3)**2 & + & + 60*ys(2)**2*ys(3)*ys(4) + 10*ys(1)*ys(2)**2*ys(3) + 215*ys(2)**2*ys(4)**2 & + & + 5*ys(1)*ys(2)**2*ys(4) + 70*ys(2)*ys(3)**3 + 130*ys(2)*ys(3)**2*ys(4) & + & + 30*ys(1)*ys(2)*ys(3)**2 + 775*ys(2)*ys(3)*ys(4)**2 + 35*ys(1)*ys(2)*ys(3)*ys(4) & + & + 415*ys(2)*ys(4)**3 + 110*ys(1)*ys(2)*ys(4)**2 + 30*ys(3)**4 + 75*ys(3)**3*ys(4) & + & + 20*ys(1)*ys(3)**3 + 665*ys(3)**2*ys(4)**2 + 35*ys(1)*ys(3)**2*ys(4) + 725*ys(3) & + & *ys(4)**3 + 220*ys(1)*ys(3)*ys(4)**2 + 1767*ys(4)**4 + 105*ys(1)*ys(4)**3)) & + & /(5*(ys(1) + ys(2))*(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) & + & + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 3, & - & 3) = (4*y(4)**2*(5*y(1)**4*y(3)**2 + 5*y(1)**4*y(3)*y(4) + 50*y(1)**4*y(4)**2 & - & + 30*y(1)**3*y(2)*y(3)**2 + 30*y(1)**3*y(2)*y(3)*y(4) + 300*y(1)**3*y(2)*y(4)**2 & - & + 30*y(1)**3*y(3)**3 + 45*y(1)**3*y(3)**2*y(4) + 415*y(1)**3*y(3)*y(4)**2 & - & + 200*y(1)**3*y(4)**3 + 75*y(1)**2*y(2)**2*y(3)**2 + 75*y(1)**2*y(2)**2*y(3)*y(4) & - & + 750*y(1)**2*y(2)**2*y(4)**2 + 150*y(1)**2*y(2)*y(3)**3 + 225*y(1)**2*y(2)*y(3) & - & **2*y(4) + 2075*y(1)**2*y(2)*y(3)*y(4)**2 + 1000*y(1)**2*y(2)*y(4)**3 + 75*y(1) & - & **2*y(3)**4 + 150*y(1)**2*y(3)**3*y(4) + 1390*y(1)**2*y(3)**2*y(4)**2 + 1315*y(1) & - & **2*y(3)*y(4)**3 + 1081*y(1)**2*y(4)**4 + 90*y(1)*y(2)**3*y(3)**2 + 90*y(1)*y(2) & - & **3*y(3)*y(4) + 900*y(1)*y(2)**3*y(4)**2 + 270*y(1)*y(2)**2*y(3)**3 + 405*y(1) & - & *y(2)**2*y(3)**2*y(4) + 3735*y(1)*y(2)**2*y(3)*y(4)**2 + 1800*y(1)*y(2)**2*y(4) & - & **3 + 270*y(1)*y(2)*y(3)**4 + 540*y(1)*y(2)*y(3)**3*y(4) + 5025*y(1)*y(2)*y(3) & - & **2*y(4)**2 + 4755*y(1)*y(2)*y(3)*y(4)**3 + 4224*y(1)*y(2)*y(4)**4 + 90*y(1)*y(3) & - & **5 + 225*y(1)*y(3)**4*y(4) + 2190*y(1)*y(3)**3*y(4)**2 + 3060*y(1)*y(3)**2*y(4) & - & **3 + 4529*y(1)*y(3)*y(4)**4 + 1762*y(1)*y(4)**5 + 45*y(2)**4*y(3)**2 + 45*y(2) & - & **4*y(3)*y(4) + 450*y(2)**4*y(4)**2 + 180*y(2)**3*y(3)**3 + 270*y(2)**3*y(3) & - & **2*y(4) + 2490*y(2)**3*y(3)*y(4)**2 + 1200*y(2)**3*y(4)**3 + 270*y(2)**2*y(3) & - & **4 + 540*y(2)**2*y(3)**3*y(4) + 5025*y(2)**2*y(3)**2*y(4)**2 + 4755*y(2)**2*y(3) & - & *y(4)**3 + 4224*y(2)**2*y(4)**4 + 180*y(2)*y(3)**5 + 450*y(2)*y(3)**4*y(4) & - & + 4380*y(2)*y(3)**3*y(4)**2 + 6120*y(2)*y(3)**2*y(4)**3 + 9058*y(2)*y(3)*y(4)**4 & - & + 3524*y(2)*y(4)**5 + 45*y(3)**6 + 135*y(3)**5*y(4) + 1395*y(3)**4*y(4)**2 & - & + 2565*y(3)**3*y(4)**3 + 4884*y(3)**2*y(4)**4 + 3624*y(3)*y(4)**5 + 831*y(4)**6)) & - & /(5*(y(2) + y(3))**2*(y(1) + y(2) + y(3))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 3) = (4*ys(4)**2*(5*ys(1)**4*ys(3)**2 + 5*ys(1)**4*ys(3)*ys(4) + 50*ys(1) & + & **4*ys(4)**2 + 30*ys(1)**3*ys(2)*ys(3)**2 + 30*ys(1)**3*ys(2)*ys(3)*ys(4) & + & + 300*ys(1)**3*ys(2)*ys(4)**2 + 30*ys(1)**3*ys(3)**3 + 45*ys(1)**3*ys(3)**2*ys(4) & + & + 415*ys(1)**3*ys(3)*ys(4)**2 + 200*ys(1)**3*ys(4)**3 + 75*ys(1)**2*ys(2) & + & **2*ys(3)**2 + 75*ys(1)**2*ys(2)**2*ys(3)*ys(4) + 750*ys(1)**2*ys(2)**2*ys(4)**2 & + & + 150*ys(1)**2*ys(2)*ys(3)**3 + 225*ys(1)**2*ys(2)*ys(3)**2*ys(4) + 2075*ys(1) & + & **2*ys(2)*ys(3)*ys(4)**2 + 1000*ys(1)**2*ys(2)*ys(4)**3 + 75*ys(1)**2*ys(3)**4 & + & + 150*ys(1)**2*ys(3)**3*ys(4) + 1390*ys(1)**2*ys(3)**2*ys(4)**2 + 1315*ys(1) & + & **2*ys(3)*ys(4)**3 + 1081*ys(1)**2*ys(4)**4 + 90*ys(1)*ys(2)**3*ys(3)**2 & + & + 90*ys(1)*ys(2)**3*ys(3)*ys(4) + 900*ys(1)*ys(2)**3*ys(4)**2 + 270*ys(1)*ys(2) & + & **2*ys(3)**3 + 405*ys(1)*ys(2)**2*ys(3)**2*ys(4) + 3735*ys(1)*ys(2)**2*ys(3) & + & *ys(4)**2 + 1800*ys(1)*ys(2)**2*ys(4)**3 + 270*ys(1)*ys(2)*ys(3)**4 + 540*ys(1) & + & *ys(2)*ys(3)**3*ys(4) + 5025*ys(1)*ys(2)*ys(3)**2*ys(4)**2 + 4755*ys(1)*ys(2) & + & *ys(3)*ys(4)**3 + 4224*ys(1)*ys(2)*ys(4)**4 + 90*ys(1)*ys(3)**5 + 225*ys(1)*ys(3) & + & **4*ys(4) + 2190*ys(1)*ys(3)**3*ys(4)**2 + 3060*ys(1)*ys(3)**2*ys(4)**3 & + & + 4529*ys(1)*ys(3)*ys(4)**4 + 1762*ys(1)*ys(4)**5 + 45*ys(2)**4*ys(3)**2 & + & + 45*ys(2)**4*ys(3)*ys(4) + 450*ys(2)**4*ys(4)**2 + 180*ys(2)**3*ys(3)**3 & + & + 270*ys(2)**3*ys(3)**2*ys(4) + 2490*ys(2)**3*ys(3)*ys(4)**2 + 1200*ys(2) & + & **3*ys(4)**3 + 270*ys(2)**2*ys(3)**4 + 540*ys(2)**2*ys(3)**3*ys(4) + 5025*ys(2) & + & **2*ys(3)**2*ys(4)**2 + 4755*ys(2)**2*ys(3)*ys(4)**3 + 4224*ys(2)**2*ys(4)**4 & + & + 180*ys(2)*ys(3)**5 + 450*ys(2)*ys(3)**4*ys(4) + 4380*ys(2)*ys(3)**3*ys(4)**2 & + & + 6120*ys(2)*ys(3)**2*ys(4)**3 + 9058*ys(2)*ys(3)*ys(4)**4 + 3524*ys(2)*ys(4)**5 & + & + 45*ys(3)**6 + 135*ys(3)**5*ys(4) + 1395*ys(3)**4*ys(4)**2 + 2565*ys(3)**3*ys(4) & + & **3 + 4884*ys(3)**2*ys(4)**4 + 3624*ys(3)*ys(4)**5 + 831*ys(4)**6))/(5*(ys(2) & + & + ys(3))**2*(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) + ys(4))**2*(ys(1) + ys(2) & + & + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 3, & - & 4) = -(4*y(4)**2*(10*y(1)**2*y(2)*y(3)**2 + 10*y(1)**2*y(2)*y(3)*y(4) + 100*y(1) & - & **2*y(2)*y(4)**2 + 10*y(1)**2*y(3)**3 + 15*y(1)**2*y(3)**2*y(4) + 205*y(1) & - & **2*y(3)*y(4)**2 + 100*y(1)**2*y(4)**3 + 30*y(1)*y(2)**2*y(3)**2 + 30*y(1)*y(2) & - & **2*y(3)*y(4) + 300*y(1)*y(2)**2*y(4)**2 + 60*y(1)*y(2)*y(3)**3 + 90*y(1)*y(2) & - & *y(3)**2*y(4) + 1030*y(1)*y(2)*y(3)*y(4)**2 + 500*y(1)*y(2)*y(4)**3 + 30*y(1) & - & *y(3)**4 + 60*y(1)*y(3)**3*y(4) + 835*y(1)*y(3)**2*y(4)**2 + 805*y(1)*y(3)*y(4) & - & **3 + 1762*y(1)*y(4)**4 + 30*y(2)**3*y(3)**2 + 30*y(2)**3*y(3)*y(4) + 300*y(2) & - & **3*y(4)**2 + 90*y(2)**2*y(3)**3 + 135*y(2)**2*y(3)**2*y(4) + 1445*y(2)**2*y(3) & - & *y(4)**2 + 700*y(2)**2*y(4)**3 + 90*y(2)*y(3)**4 + 180*y(2)*y(3)**3*y(4) & - & + 2205*y(2)*y(3)**2*y(4)**2 + 2115*y(2)*y(3)*y(4)**3 + 3624*y(2)*y(4)**4 & - & + 30*y(3)**5 + 75*y(3)**4*y(4) + 1060*y(3)**3*y(4)**2 + 1515*y(3)**2*y(4)**3 & - & + 3824*y(3)*y(4)**4 + 1662*y(4)**5))/(5*(y(1) + y(2))*(y(2) + y(3))*(y(1) + y(2) & - & + y(3))**2*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))**2) + & 4) = -(4*ys(4)**2*(10*ys(1)**2*ys(2)*ys(3)**2 + 10*ys(1)**2*ys(2)*ys(3)*ys(4) & + & + 100*ys(1)**2*ys(2)*ys(4)**2 + 10*ys(1)**2*ys(3)**3 + 15*ys(1)**2*ys(3)**2*ys(4) & + & + 205*ys(1)**2*ys(3)*ys(4)**2 + 100*ys(1)**2*ys(4)**3 + 30*ys(1)*ys(2)**2*ys(3) & + & **2 + 30*ys(1)*ys(2)**2*ys(3)*ys(4) + 300*ys(1)*ys(2)**2*ys(4)**2 + 60*ys(1) & + & *ys(2)*ys(3)**3 + 90*ys(1)*ys(2)*ys(3)**2*ys(4) + 1030*ys(1)*ys(2)*ys(3)*ys(4) & + & **2 + 500*ys(1)*ys(2)*ys(4)**3 + 30*ys(1)*ys(3)**4 + 60*ys(1)*ys(3)**3*ys(4) & + & + 835*ys(1)*ys(3)**2*ys(4)**2 + 805*ys(1)*ys(3)*ys(4)**3 + 1762*ys(1)*ys(4)**4 & + & + 30*ys(2)**3*ys(3)**2 + 30*ys(2)**3*ys(3)*ys(4) + 300*ys(2)**3*ys(4)**2 & + & + 90*ys(2)**2*ys(3)**3 + 135*ys(2)**2*ys(3)**2*ys(4) + 1445*ys(2)**2*ys(3)*ys(4) & + & **2 + 700*ys(2)**2*ys(4)**3 + 90*ys(2)*ys(3)**4 + 180*ys(2)*ys(3)**3*ys(4) & + & + 2205*ys(2)*ys(3)**2*ys(4)**2 + 2115*ys(2)*ys(3)*ys(4)**3 + 3624*ys(2)*ys(4)**4 & + & + 30*ys(3)**5 + 75*ys(3)**4*ys(4) + 1060*ys(3)**3*ys(4)**2 + 1515*ys(3)**2*ys(4) & + & **3 + 3824*ys(3)*ys(4)**4 + 1662*ys(4)**5))/(5*(ys(1) + ys(2))*(ys(2) + ys(3)) & + & *(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) & + & + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 3, & - & 5) = (4*y(4)**2*(5*y(2)**2*y(3)**2 + 5*y(2)**2*y(3)*y(4) + 50*y(2)**2*y(4)**2 & - & + 10*y(2)*y(3)**3 + 15*y(2)*y(3)**2*y(4) + 205*y(2)*y(3)*y(4)**2 + 100*y(2)*y(4) & - & **3 + 5*y(3)**4 + 10*y(3)**3*y(4) + 205*y(3)**2*y(4)**2 + 200*y(3)*y(4)**3 & - & + 831*y(4)**4))/(5*(y(1) + y(2))**2*(y(1) + y(2) + y(3))**2*(y(1) + y(2) + y(3) & - & + y(4))**2) + & 5) = (4*ys(4)**2*(5*ys(2)**2*ys(3)**2 + 5*ys(2)**2*ys(3)*ys(4) + 50*ys(2) & + & **2*ys(4)**2 + 10*ys(2)*ys(3)**3 + 15*ys(2)*ys(3)**2*ys(4) + 205*ys(2)*ys(3) & + & *ys(4)**2 + 100*ys(2)*ys(4)**3 + 5*ys(3)**4 + 10*ys(3)**3*ys(4) + 205*ys(3) & + & **2*ys(4)**2 + 200*ys(3)*ys(4)**3 + 831*ys(4)**4))/(5*(ys(1) + ys(2))**2*(ys(1) & + & + ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) - y = s_cb(i - 1:i + 2) - s_cb(i - 2:i + 1) + ys = s_cb(i - 1:i + 2) - s_cb(i - 2:i + 1) beta_coef_${XYZ}$ (i + 1, 2, & - & 0) = (4*y(3)**2*(5*y(1)**2*y(2)**2 + 5*y(1)**2*y(2)*y(3) + 50*y(1)**2*y(3)**2 & - & + 10*y(1)*y(2)**3 + 15*y(1)*y(2)**2*y(3) + 205*y(1)*y(2)*y(3)**2 + 100*y(1)*y(3) & - & **3 + 5*y(2)**4 + 10*y(2)**3*y(3) + 205*y(2)**2*y(3)**2 + 200*y(2)*y(3)**3 & - & + 831*y(3)**4))/(5*(y(3) + y(4))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) & - & + y(4))**2) + & 0) = (4*ys(3)**2*(5*ys(1)**2*ys(2)**2 + 5*ys(1)**2*ys(2)*ys(3) + 50*ys(1) & + & **2*ys(3)**2 + 10*ys(1)*ys(2)**3 + 15*ys(1)*ys(2)**2*ys(3) + 205*ys(1)*ys(2) & + & *ys(3)**2 + 100*ys(1)*ys(3)**3 + 5*ys(2)**4 + 10*ys(2)**3*ys(3) + 205*ys(2) & + & **2*ys(3)**2 + 200*ys(2)*ys(3)**3 + 831*ys(3)**4))/(5*(ys(3) + ys(4))**2*(ys(2) & + & + ys(3) + ys(4))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 2, & - & 1) = (4*y(3)**2*(5*y(1)**3*y(2)*y(3) + 10*y(1)**3*y(2)*y(4) - 95*y(1)**3*y(3)**2 & - & + 5*y(1)**3*y(3)*y(4) + 20*y(1)**2*y(2)**2*y(3) + 40*y(1)**2*y(2)**2*y(4) & - & - 465*y(1)**2*y(2)*y(3)**2 + 55*y(1)**2*y(2)*y(3)*y(4) + 10*y(1)**2*y(2)*y(4)**2 & - & - 285*y(1)**2*y(3)**3 + 20*y(1)**2*y(3)**2*y(4) + 5*y(1)**2*y(3)*y(4)**2 & - & + 30*y(1)*y(2)**3*y(3) + 60*y(1)*y(2)**3*y(4) - 825*y(1)*y(2)**2*y(3)**2 & - & + 135*y(1)*y(2)**2*y(3)*y(4) + 30*y(1)*y(2)**2*y(4)**2 - 1040*y(1)*y(2)*y(3)**3 & - & + 100*y(1)*y(2)*y(3)**2*y(4) + 35*y(1)*y(2)*y(3)*y(4)**2 - 1847*y(1)*y(3)**4 & - & + 125*y(1)*y(3)**3*y(4) + 110*y(1)*y(3)**2*y(4)**2 + 15*y(2)**4*y(3) + 30*y(2) & - & **4*y(4) - 550*y(2)**3*y(3)**2 + 90*y(2)**3*y(3)*y(4) + 20*y(2)**3*y(4)**2 & - & - 1040*y(2)**2*y(3)**3 + 100*y(2)**2*y(3)**2*y(4) + 35*y(2)**2*y(3)*y(4)**2 & - & - 3694*y(2)*y(3)**4 + 250*y(2)*y(3)**3*y(4) + 220*y(2)*y(3)**2*y(4)**2 & - & - 3219*y(3)**5 - 1452*y(3)**4*y(4) + 105*y(3)**3*y(4)**2))/(5*(y(2) + y(3))*(y(3) & - & + y(4))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4)) & - & **2) + & 1) = (4*ys(3)**2*(5*ys(1)**3*ys(2)*ys(3) + 10*ys(1)**3*ys(2)*ys(4) - 95*ys(1) & + & **3*ys(3)**2 + 5*ys(1)**3*ys(3)*ys(4) + 20*ys(1)**2*ys(2)**2*ys(3) + 40*ys(1) & + & **2*ys(2)**2*ys(4) - 465*ys(1)**2*ys(2)*ys(3)**2 + 55*ys(1)**2*ys(2)*ys(3)*ys(4) & + & + 10*ys(1)**2*ys(2)*ys(4)**2 - 285*ys(1)**2*ys(3)**3 + 20*ys(1)**2*ys(3)**2*ys(4) & + & + 5*ys(1)**2*ys(3)*ys(4)**2 + 30*ys(1)*ys(2)**3*ys(3) + 60*ys(1)*ys(2)**3*ys(4) & + & - 825*ys(1)*ys(2)**2*ys(3)**2 + 135*ys(1)*ys(2)**2*ys(3)*ys(4) + 30*ys(1)*ys(2) & + & **2*ys(4)**2 - 1040*ys(1)*ys(2)*ys(3)**3 + 100*ys(1)*ys(2)*ys(3)**2*ys(4) & + & + 35*ys(1)*ys(2)*ys(3)*ys(4)**2 - 1847*ys(1)*ys(3)**4 + 125*ys(1)*ys(3)**3*ys(4) & + & + 110*ys(1)*ys(3)**2*ys(4)**2 + 15*ys(2)**4*ys(3) + 30*ys(2)**4*ys(4) - 550*ys(2) & + & **3*ys(3)**2 + 90*ys(2)**3*ys(3)*ys(4) + 20*ys(2)**3*ys(4)**2 - 1040*ys(2) & + & **2*ys(3)**3 + 100*ys(2)**2*ys(3)**2*ys(4) + 35*ys(2)**2*ys(3)*ys(4)**2 & + & - 3694*ys(2)*ys(3)**4 + 250*ys(2)*ys(3)**3*ys(4) + 220*ys(2)*ys(3)**2*ys(4)**2 & + & - 3219*ys(3)**5 - 1452*ys(3)**4*ys(4) + 105*ys(3)**3*ys(4)**2))/(5*(ys(2) + ys(3) & + & )*(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))**2*(ys(1) & + & + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 2, & - & 2) = -(4*y(3)**2*(5*y(2)**3*y(3) - 95*y(2)*y(3)**3 - 190*y(2)**2*y(3)**2 & - & + 10*y(2)**3*y(4) + 100*y(3)**3*y(4) - 1562*y(3)**4 - 95*y(1)*y(2)*y(3)**2 & - & + 5*y(1)*y(2)**2*y(3) + 10*y(1)*y(2)**2*y(4) + 100*y(1)*y(3)**2*y(4) + 205*y(2) & - & *y(3)**2*y(4) + 15*y(2)**2*y(3)*y(4) + 10*y(1)*y(2)*y(3)*y(4)))/(5*(y(1) + y(2)) & - & *(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) & - & + y(4))**2) + & 2) = -(4*ys(3)**2*(5*ys(2)**3*ys(3) - 95*ys(2)*ys(3)**3 - 190*ys(2)**2*ys(3)**2 & + & + 10*ys(2)**3*ys(4) + 100*ys(3)**3*ys(4) - 1562*ys(3)**4 - 95*ys(1)*ys(2)*ys(3) & + & **2 + 5*ys(1)*ys(2)**2*ys(3) + 10*ys(1)*ys(2)**2*ys(4) + 100*ys(1)*ys(3)**2*ys(4) & + & + 205*ys(2)*ys(3)**2*ys(4) + 15*ys(2)**2*ys(3)*ys(4) + 10*ys(1)*ys(2)*ys(3)*ys(4) & + & ))/(5*(ys(1) + ys(2))*(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) & + & + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 2, & - & 3) = (4*y(3)**2*(50*y(1)**4*y(3)**2 + 5*y(1)**4*y(3)*y(4) + 5*y(1)**4*y(4)**2 & - & + 300*y(1)**3*y(2)*y(3)**2 + 30*y(1)**3*y(2)*y(3)*y(4) + 30*y(1)**3*y(2)*y(4)**2 & - & + 200*y(1)**3*y(3)**3 + 25*y(1)**3*y(3)**2*y(4) + 35*y(1)**3*y(3)*y(4)**2 & - & + 10*y(1)**3*y(4)**3 + 750*y(1)**2*y(2)**2*y(3)**2 + 75*y(1)**2*y(2)**2*y(3)*y(4) & - & + 75*y(1)**2*y(2)**2*y(4)**2 + 1000*y(1)**2*y(2)*y(3)**3 + 125*y(1)**2*y(2)*y(3) & - & **2*y(4) + 175*y(1)**2*y(2)*y(3)*y(4)**2 + 50*y(1)**2*y(2)*y(4)**3 + 1081*y(1) & - & **2*y(3)**4 - 50*y(1)**2*y(3)**3*y(4) - 10*y(1)**2*y(3)**2*y(4)**2 + 45*y(1) & - & **2*y(3)*y(4)**3 + 5*y(1)**2*y(4)**4 + 900*y(1)*y(2)**3*y(3)**2 + 90*y(1)*y(2) & - & **3*y(3)*y(4) + 90*y(1)*y(2)**3*y(4)**2 + 1800*y(1)*y(2)**2*y(3)**3 + 225*y(1) & - & *y(2)**2*y(3)**2*y(4) + 315*y(1)*y(2)**2*y(3)*y(4)**2 + 90*y(1)*y(2)**2*y(4)**3 & - & + 4224*y(1)*y(2)*y(3)**4 - 120*y(1)*y(2)*y(3)**3*y(4) + 25*y(1)*y(2)*y(3)**2*y(4) & - & **2 + 165*y(1)*y(2)*y(3)*y(4)**3 + 20*y(1)*y(2)*y(4)**4 + 3324*y(1)*y(3)**5 & - & + 1407*y(1)*y(3)**4*y(4) - 100*y(1)*y(3)**3*y(4)**2 + 70*y(1)*y(3)**2*y(4)**3 & - & + 15*y(1)*y(3)*y(4)**4 + 450*y(2)**4*y(3)**2 + 45*y(2)**4*y(3)*y(4) + 45*y(2) & - & **4*y(4)**2 + 1200*y(2)**3*y(3)**3 + 150*y(2)**3*y(3)**2*y(4) + 210*y(2)**3*y(3) & - & *y(4)**2 + 60*y(2)**3*y(4)**3 + 4224*y(2)**2*y(3)**4 - 120*y(2)**2*y(3)**3*y(4) & - & + 25*y(2)**2*y(3)**2*y(4)**2 + 165*y(2)**2*y(3)*y(4)**3 + 20*y(2)**2*y(4)**4 & - & + 6648*y(2)*y(3)**5 + 2814*y(2)*y(3)**4*y(4) - 200*y(2)*y(3)**3*y(4)**2 & - & + 140*y(2)*y(3)**2*y(4)**3 + 30*y(2)*y(3)*y(4)**4 + 3174*y(3)**6 + 3039*y(3) & - & **5*y(4) + 771*y(3)**4*y(4)**2 + 135*y(3)**3*y(4)**3 + 60*y(3)**2*y(4)**4)) & - & /(5*(y(2) + y(3))**2*(y(1) + y(2) + y(3))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 3) = (4*ys(3)**2*(50*ys(1)**4*ys(3)**2 + 5*ys(1)**4*ys(3)*ys(4) + 5*ys(1) & + & **4*ys(4)**2 + 300*ys(1)**3*ys(2)*ys(3)**2 + 30*ys(1)**3*ys(2)*ys(3)*ys(4) & + & + 30*ys(1)**3*ys(2)*ys(4)**2 + 200*ys(1)**3*ys(3)**3 + 25*ys(1)**3*ys(3)**2*ys(4) & + & + 35*ys(1)**3*ys(3)*ys(4)**2 + 10*ys(1)**3*ys(4)**3 + 750*ys(1)**2*ys(2)**2*ys(3) & + & **2 + 75*ys(1)**2*ys(2)**2*ys(3)*ys(4) + 75*ys(1)**2*ys(2)**2*ys(4)**2 & + & + 1000*ys(1)**2*ys(2)*ys(3)**3 + 125*ys(1)**2*ys(2)*ys(3)**2*ys(4) + 175*ys(1) & + & **2*ys(2)*ys(3)*ys(4)**2 + 50*ys(1)**2*ys(2)*ys(4)**3 + 1081*ys(1)**2*ys(3)**4 & + & - 50*ys(1)**2*ys(3)**3*ys(4) - 10*ys(1)**2*ys(3)**2*ys(4)**2 + 45*ys(1)**2*ys(3) & + & *ys(4)**3 + 5*ys(1)**2*ys(4)**4 + 900*ys(1)*ys(2)**3*ys(3)**2 + 90*ys(1)*ys(2) & + & **3*ys(3)*ys(4) + 90*ys(1)*ys(2)**3*ys(4)**2 + 1800*ys(1)*ys(2)**2*ys(3)**3 & + & + 225*ys(1)*ys(2)**2*ys(3)**2*ys(4) + 315*ys(1)*ys(2)**2*ys(3)*ys(4)**2 & + & + 90*ys(1)*ys(2)**2*ys(4)**3 + 4224*ys(1)*ys(2)*ys(3)**4 - 120*ys(1)*ys(2)*ys(3) & + & **3*ys(4) + 25*ys(1)*ys(2)*ys(3)**2*ys(4)**2 + 165*ys(1)*ys(2)*ys(3)*ys(4)**3 & + & + 20*ys(1)*ys(2)*ys(4)**4 + 3324*ys(1)*ys(3)**5 + 1407*ys(1)*ys(3)**4*ys(4) & + & - 100*ys(1)*ys(3)**3*ys(4)**2 + 70*ys(1)*ys(3)**2*ys(4)**3 + 15*ys(1)*ys(3)*ys(4) & + & **4 + 450*ys(2)**4*ys(3)**2 + 45*ys(2)**4*ys(3)*ys(4) + 45*ys(2)**4*ys(4)**2 & + & + 1200*ys(2)**3*ys(3)**3 + 150*ys(2)**3*ys(3)**2*ys(4) + 210*ys(2)**3*ys(3)*ys(4) & + & **2 + 60*ys(2)**3*ys(4)**3 + 4224*ys(2)**2*ys(3)**4 - 120*ys(2)**2*ys(3)**3*ys(4) & + & + 25*ys(2)**2*ys(3)**2*ys(4)**2 + 165*ys(2)**2*ys(3)*ys(4)**3 + 20*ys(2)**2*ys(4) & + & **4 + 6648*ys(2)*ys(3)**5 + 2814*ys(2)*ys(3)**4*ys(4) - 200*ys(2)*ys(3)**3*ys(4) & + & **2 + 140*ys(2)*ys(3)**2*ys(4)**3 + 30*ys(2)*ys(3)*ys(4)**4 + 3174*ys(3)**6 & + & + 3039*ys(3)**5*ys(4) + 771*ys(3)**4*ys(4)**2 + 135*ys(3)**3*ys(4)**3 + 60*ys(3) & + & **2*ys(4)**4))/(5*(ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) & + & + ys(4))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 2, & - & 4) = -(4*y(3)**2*(100*y(1)**2*y(2)*y(3)**2 + 10*y(1)**2*y(2)*y(3)*y(4) + 10*y(1) & - & **2*y(2)*y(4)**2 - 95*y(1)**2*y(3)**2*y(4) + 5*y(1)**2*y(3)*y(4)**2 + 300*y(1) & - & *y(2)**2*y(3)**2 + 30*y(1)*y(2)**2*y(3)*y(4) + 30*y(1)*y(2)**2*y(4)**2 + 200*y(1) & - & *y(2)*y(3)**3 - 260*y(1)*y(2)*y(3)**2*y(4) + 50*y(1)*y(2)*y(3)*y(4)**2 + 10*y(1) & - & *y(2)*y(4)**3 + 1562*y(1)*y(3)**4 - 190*y(1)*y(3)**3*y(4) + 15*y(1)*y(3)**2*y(4) & - & **2 + 5*y(1)*y(3)*y(4)**3 + 300*y(2)**3*y(3)**2 + 30*y(2)**3*y(3)*y(4) + 30*y(2) & - & **3*y(4)**2 + 400*y(2)**2*y(3)**3 - 235*y(2)**2*y(3)**2*y(4) + 85*y(2)**2*y(3) & - & *y(4)**2 + 20*y(2)**2*y(4)**3 + 3224*y(2)*y(3)**4 - 460*y(2)*y(3)**3*y(4) & - & - 35*y(2)*y(3)**2*y(4)**2 + 25*y(2)*y(3)*y(4)**3 + 3124*y(3)**5 + 1467*y(3) & - & **4*y(4) + 110*y(3)**3*y(4)**2 + 105*y(3)**2*y(4)**3))/(5*(y(1) + y(2))*(y(2) & - & + y(3))*(y(1) + y(2) + y(3))**2*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4)) & - & **2) + & 4) = -(4*ys(3)**2*(100*ys(1)**2*ys(2)*ys(3)**2 + 10*ys(1)**2*ys(2)*ys(3)*ys(4) & + & + 10*ys(1)**2*ys(2)*ys(4)**2 - 95*ys(1)**2*ys(3)**2*ys(4) + 5*ys(1)**2*ys(3) & + & *ys(4)**2 + 300*ys(1)*ys(2)**2*ys(3)**2 + 30*ys(1)*ys(2)**2*ys(3)*ys(4) & + & + 30*ys(1)*ys(2)**2*ys(4)**2 + 200*ys(1)*ys(2)*ys(3)**3 - 260*ys(1)*ys(2)*ys(3) & + & **2*ys(4) + 50*ys(1)*ys(2)*ys(3)*ys(4)**2 + 10*ys(1)*ys(2)*ys(4)**3 + 1562*ys(1) & + & *ys(3)**4 - 190*ys(1)*ys(3)**3*ys(4) + 15*ys(1)*ys(3)**2*ys(4)**2 + 5*ys(1)*ys(3) & + & *ys(4)**3 + 300*ys(2)**3*ys(3)**2 + 30*ys(2)**3*ys(3)*ys(4) + 30*ys(2)**3*ys(4) & + & **2 + 400*ys(2)**2*ys(3)**3 - 235*ys(2)**2*ys(3)**2*ys(4) + 85*ys(2)**2*ys(3) & + & *ys(4)**2 + 20*ys(2)**2*ys(4)**3 + 3224*ys(2)*ys(3)**4 - 460*ys(2)*ys(3)**3*ys(4) & + & - 35*ys(2)*ys(3)**2*ys(4)**2 + 25*ys(2)*ys(3)*ys(4)**3 + 3124*ys(3)**5 & + & + 1467*ys(3)**4*ys(4) + 110*ys(3)**3*ys(4)**2 + 105*ys(3)**2*ys(4)**3))/(5*(ys(1) & + & + ys(2))*(ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 2, & - & 5) = (4*y(3)**2*(50*y(2)**2*y(3)**2 + 5*y(2)**2*y(3)*y(4) + 5*y(2)**2*y(4)**2 & - & - 95*y(2)*y(3)**2*y(4) + 5*y(2)*y(3)*y(4)**2 + 781*y(3)**4 + 50*y(3)**2*y(4)**2)) & - & /(5*(y(1) + y(2))**2*(y(1) + y(2) + y(3))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 5) = (4*ys(3)**2*(50*ys(2)**2*ys(3)**2 + 5*ys(2)**2*ys(3)*ys(4) + 5*ys(2) & + & **2*ys(4)**2 - 95*ys(2)*ys(3)**2*ys(4) + 5*ys(2)*ys(3)*ys(4)**2 + 781*ys(3)**4 & + & + 50*ys(3)**2*ys(4)**2))/(5*(ys(1) + ys(2))**2*(ys(1) + ys(2) + ys(3))**2*(ys(1) & + & + ys(2) + ys(3) + ys(4))**2) - y = s_cb(i:i + 3) - s_cb(i - 1:i + 2) + ys = s_cb(i:i + 3) - s_cb(i - 1:i + 2) beta_coef_${XYZ}$ (i + 1, 1, & - & 0) = (4*y(2)**2*(50*y(1)**2*y(2)**2 + 5*y(1)**2*y(2)*y(3) + 5*y(1)**2*y(3)**2 & - & - 95*y(1)*y(2)**2*y(3) + 5*y(1)*y(2)*y(3)**2 + 781*y(2)**4 + 50*y(2)**2*y(3)**2)) & - & /(5*(y(3) + y(4))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 0) = (4*ys(2)**2*(50*ys(1)**2*ys(2)**2 + 5*ys(1)**2*ys(2)*ys(3) + 5*ys(1) & + & **2*ys(3)**2 - 95*ys(1)*ys(2)**2*ys(3) + 5*ys(1)*ys(2)*ys(3)**2 + 781*ys(2)**4 & + & + 50*ys(2)**2*ys(3)**2))/(5*(ys(3) + ys(4))**2*(ys(2) + ys(3) + ys(4))**2*(ys(1) & + & + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 1, & - & 1) = -(4*y(2)**2*(105*y(1)**3*y(2)**2 + 25*y(1)**3*y(2)*y(3) + 5*y(1)**3*y(2) & - & *y(4) + 20*y(1)**3*y(3)**2 + 10*y(1)**3*y(3)*y(4) + 110*y(1)**2*y(2)**3 - 35*y(1) & - & **2*y(2)**2*y(3) + 15*y(1)**2*y(2)**2*y(4) + 85*y(1)**2*y(2)*y(3)**2 + 50*y(1) & - & **2*y(2)*y(3)*y(4) + 5*y(1)**2*y(2)*y(4)**2 + 30*y(1)**2*y(3)**3 + 30*y(1) & - & **2*y(3)**2*y(4) + 10*y(1)**2*y(3)*y(4)**2 + 1467*y(1)*y(2)**4 - 460*y(1)*y(2) & - & **3*y(3) - 190*y(1)*y(2)**3*y(4) - 235*y(1)*y(2)**2*y(3)**2 - 260*y(1)*y(2) & - & **2*y(3)*y(4) - 95*y(1)*y(2)**2*y(4)**2 + 30*y(1)*y(2)*y(3)**3 + 30*y(1)*y(2) & - & *y(3)**2*y(4) + 10*y(1)*y(2)*y(3)*y(4)**2 + 3124*y(2)**5 + 3224*y(2)**4*y(3) & - & + 1562*y(2)**4*y(4) + 400*y(2)**3*y(3)**2 + 200*y(2)**3*y(3)*y(4) + 300*y(2) & - & **2*y(3)**3 + 300*y(2)**2*y(3)**2*y(4) + 100*y(2)**2*y(3)*y(4)**2))/(5*(y(2) & - & + y(3))*(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 1) = -(4*ys(2)**2*(105*ys(1)**3*ys(2)**2 + 25*ys(1)**3*ys(2)*ys(3) + 5*ys(1) & + & **3*ys(2)*ys(4) + 20*ys(1)**3*ys(3)**2 + 10*ys(1)**3*ys(3)*ys(4) + 110*ys(1) & + & **2*ys(2)**3 - 35*ys(1)**2*ys(2)**2*ys(3) + 15*ys(1)**2*ys(2)**2*ys(4) + 85*ys(1) & + & **2*ys(2)*ys(3)**2 + 50*ys(1)**2*ys(2)*ys(3)*ys(4) + 5*ys(1)**2*ys(2)*ys(4)**2 & + & + 30*ys(1)**2*ys(3)**3 + 30*ys(1)**2*ys(3)**2*ys(4) + 10*ys(1)**2*ys(3)*ys(4)**2 & + & + 1467*ys(1)*ys(2)**4 - 460*ys(1)*ys(2)**3*ys(3) - 190*ys(1)*ys(2)**3*ys(4) & + & - 235*ys(1)*ys(2)**2*ys(3)**2 - 260*ys(1)*ys(2)**2*ys(3)*ys(4) - 95*ys(1)*ys(2) & + & **2*ys(4)**2 + 30*ys(1)*ys(2)*ys(3)**3 + 30*ys(1)*ys(2)*ys(3)**2*ys(4) + 10*ys(1) & + & *ys(2)*ys(3)*ys(4)**2 + 3124*ys(2)**5 + 3224*ys(2)**4*ys(3) + 1562*ys(2)**4*ys(4) & + & + 400*ys(2)**3*ys(3)**2 + 200*ys(2)**3*ys(3)*ys(4) + 300*ys(2)**2*ys(3)**3 & + & + 300*ys(2)**2*ys(3)**2*ys(4) + 100*ys(2)**2*ys(3)*ys(4)**2))/(5*(ys(2) + ys(3)) & + & *(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))**2*(ys(1) & + & + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 1, & - & 2) = -(4*y(2)**2*(100*y(1)*y(2)**3 - 190*y(2)**2*y(3)**2 + 10*y(1)*y(3)**3 & - & + 5*y(2)*y(3)**3 - 95*y(2)**3*y(3) - 1562*y(2)**4 + 15*y(1)*y(2)*y(3)**2 & - & + 205*y(1)*y(2)**2*y(3) + 100*y(1)*y(2)**2*y(4) + 10*y(1)*y(3)**2*y(4) + 5*y(2) & - & *y(3)**2*y(4) - 95*y(2)**2*y(3)*y(4) + 10*y(1)*y(2)*y(3)*y(4)))/(5*(y(1) + y(2)) & - & *(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) & - & + y(4))**2) + & 2) = -(4*ys(2)**2*(100*ys(1)*ys(2)**3 - 190*ys(2)**2*ys(3)**2 + 10*ys(1)*ys(3) & + & **3 + 5*ys(2)*ys(3)**3 - 95*ys(2)**3*ys(3) - 1562*ys(2)**4 + 15*ys(1)*ys(2)*ys(3) & + & **2 + 205*ys(1)*ys(2)**2*ys(3) + 100*ys(1)*ys(2)**2*ys(4) + 10*ys(1)*ys(3) & + & **2*ys(4) + 5*ys(2)*ys(3)**2*ys(4) - 95*ys(2)**2*ys(3)*ys(4) + 10*ys(1)*ys(2) & + & *ys(3)*ys(4)))/(5*(ys(1) + ys(2))*(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) & + & + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 1, & - & 3) = (4*y(2)**2*(60*y(1)**4*y(2)**2 + 30*y(1)**4*y(2)*y(3) + 15*y(1)**4*y(2)*y(4) & - & + 20*y(1)**4*y(3)**2 + 20*y(1)**4*y(3)*y(4) + 5*y(1)**4*y(4)**2 + 135*y(1) & - & **3*y(2)**3 + 140*y(1)**3*y(2)**2*y(3) + 70*y(1)**3*y(2)**2*y(4) + 165*y(1) & - & **3*y(2)*y(3)**2 + 165*y(1)**3*y(2)*y(3)*y(4) + 45*y(1)**3*y(2)*y(4)**2 + 60*y(1) & - & **3*y(3)**3 + 90*y(1)**3*y(3)**2*y(4) + 50*y(1)**3*y(3)*y(4)**2 + 10*y(1)**3*y(4) & - & **3 + 771*y(1)**2*y(2)**4 - 200*y(1)**2*y(2)**3*y(3) - 100*y(1)**2*y(2)**3*y(4) & - & + 25*y(1)**2*y(2)**2*y(3)**2 + 25*y(1)**2*y(2)**2*y(3)*y(4) - 10*y(1)**2*y(2) & - & **2*y(4)**2 + 210*y(1)**2*y(2)*y(3)**3 + 315*y(1)**2*y(2)*y(3)**2*y(4) + 175*y(1) & - & **2*y(2)*y(3)*y(4)**2 + 35*y(1)**2*y(2)*y(4)**3 + 45*y(1)**2*y(3)**4 + 90*y(1) & - & **2*y(3)**3*y(4) + 75*y(1)**2*y(3)**2*y(4)**2 + 30*y(1)**2*y(3)*y(4)**3 + 5*y(1) & - & **2*y(4)**4 + 3039*y(1)*y(2)**5 + 2814*y(1)*y(2)**4*y(3) + 1407*y(1)*y(2)**4*y(4) & - & - 120*y(1)*y(2)**3*y(3)**2 - 120*y(1)*y(2)**3*y(3)*y(4) - 50*y(1)*y(2)**3*y(4) & - & **2 + 150*y(1)*y(2)**2*y(3)**3 + 225*y(1)*y(2)**2*y(3)**2*y(4) + 125*y(1)*y(2) & - & **2*y(3)*y(4)**2 + 25*y(1)*y(2)**2*y(4)**3 + 45*y(1)*y(2)*y(3)**4 + 90*y(1)*y(2) & - & *y(3)**3*y(4) + 75*y(1)*y(2)*y(3)**2*y(4)**2 + 30*y(1)*y(2)*y(3)*y(4)**3 + 5*y(1) & - & *y(2)*y(4)**4 + 3174*y(2)**6 + 6648*y(2)**5*y(3) + 3324*y(2)**5*y(4) + 4224*y(2) & - & **4*y(3)**2 + 4224*y(2)**4*y(3)*y(4) + 1081*y(2)**4*y(4)**2 + 1200*y(2)**3*y(3) & - & **3 + 1800*y(2)**3*y(3)**2*y(4) + 1000*y(2)**3*y(3)*y(4)**2 + 200*y(2)**3*y(4) & - & **3 + 450*y(2)**2*y(3)**4 + 900*y(2)**2*y(3)**3*y(4) + 750*y(2)**2*y(3)**2*y(4) & - & **2 + 300*y(2)**2*y(3)*y(4)**3 + 50*y(2)**2*y(4)**4))/(5*(y(2) + y(3))**2*(y(1) & - & + y(2) + y(3))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 3) = (4*ys(2)**2*(60*ys(1)**4*ys(2)**2 + 30*ys(1)**4*ys(2)*ys(3) + 15*ys(1) & + & **4*ys(2)*ys(4) + 20*ys(1)**4*ys(3)**2 + 20*ys(1)**4*ys(3)*ys(4) + 5*ys(1) & + & **4*ys(4)**2 + 135*ys(1)**3*ys(2)**3 + 140*ys(1)**3*ys(2)**2*ys(3) + 70*ys(1) & + & **3*ys(2)**2*ys(4) + 165*ys(1)**3*ys(2)*ys(3)**2 + 165*ys(1)**3*ys(2)*ys(3)*ys(4) & + & + 45*ys(1)**3*ys(2)*ys(4)**2 + 60*ys(1)**3*ys(3)**3 + 90*ys(1)**3*ys(3)**2*ys(4) & + & + 50*ys(1)**3*ys(3)*ys(4)**2 + 10*ys(1)**3*ys(4)**3 + 771*ys(1)**2*ys(2)**4 & + & - 200*ys(1)**2*ys(2)**3*ys(3) - 100*ys(1)**2*ys(2)**3*ys(4) + 25*ys(1)**2*ys(2) & + & **2*ys(3)**2 + 25*ys(1)**2*ys(2)**2*ys(3)*ys(4) - 10*ys(1)**2*ys(2)**2*ys(4)**2 & + & + 210*ys(1)**2*ys(2)*ys(3)**3 + 315*ys(1)**2*ys(2)*ys(3)**2*ys(4) + 175*ys(1) & + & **2*ys(2)*ys(3)*ys(4)**2 + 35*ys(1)**2*ys(2)*ys(4)**3 + 45*ys(1)**2*ys(3)**4 & + & + 90*ys(1)**2*ys(3)**3*ys(4) + 75*ys(1)**2*ys(3)**2*ys(4)**2 + 30*ys(1)**2*ys(3) & + & *ys(4)**3 + 5*ys(1)**2*ys(4)**4 + 3039*ys(1)*ys(2)**5 + 2814*ys(1)*ys(2)**4*ys(3) & + & + 1407*ys(1)*ys(2)**4*ys(4) - 120*ys(1)*ys(2)**3*ys(3)**2 - 120*ys(1)*ys(2) & + & **3*ys(3)*ys(4) - 50*ys(1)*ys(2)**3*ys(4)**2 + 150*ys(1)*ys(2)**2*ys(3)**3 & + & + 225*ys(1)*ys(2)**2*ys(3)**2*ys(4) + 125*ys(1)*ys(2)**2*ys(3)*ys(4)**2 & + & + 25*ys(1)*ys(2)**2*ys(4)**3 + 45*ys(1)*ys(2)*ys(3)**4 + 90*ys(1)*ys(2)*ys(3) & + & **3*ys(4) + 75*ys(1)*ys(2)*ys(3)**2*ys(4)**2 + 30*ys(1)*ys(2)*ys(3)*ys(4)**3 & + & + 5*ys(1)*ys(2)*ys(4)**4 + 3174*ys(2)**6 + 6648*ys(2)**5*ys(3) + 3324*ys(2) & + & **5*ys(4) + 4224*ys(2)**4*ys(3)**2 + 4224*ys(2)**4*ys(3)*ys(4) + 1081*ys(2) & + & **4*ys(4)**2 + 1200*ys(2)**3*ys(3)**3 + 1800*ys(2)**3*ys(3)**2*ys(4) + 1000*ys(2) & + & **3*ys(3)*ys(4)**2 + 200*ys(2)**3*ys(4)**3 + 450*ys(2)**2*ys(3)**4 + 900*ys(2) & + & **2*ys(3)**3*ys(4) + 750*ys(2)**2*ys(3)**2*ys(4)**2 + 300*ys(2)**2*ys(3)*ys(4) & + & **3 + 50*ys(2)**2*ys(4)**4))/(5*(ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3)) & + & **2*(ys(2) + ys(3) + ys(4))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 1, & - & 4) = (4*y(2)**2*(105*y(1)**2*y(2)**3 + 220*y(1)**2*y(2)**2*y(3) + 110*y(1) & - & **2*y(2)**2*y(4) + 35*y(1)**2*y(2)*y(3)**2 + 35*y(1)**2*y(2)*y(3)*y(4) + 5*y(1) & - & **2*y(2)*y(4)**2 + 20*y(1)**2*y(3)**3 + 30*y(1)**2*y(3)**2*y(4) + 10*y(1)**2*y(3) & - & *y(4)**2 - 1452*y(1)*y(2)**4 + 250*y(1)*y(2)**3*y(3) + 125*y(1)*y(2)**3*y(4) & - & + 100*y(1)*y(2)**2*y(3)**2 + 100*y(1)*y(2)**2*y(3)*y(4) + 20*y(1)*y(2)**2*y(4) & - & **2 + 90*y(1)*y(2)*y(3)**3 + 135*y(1)*y(2)*y(3)**2*y(4) + 55*y(1)*y(2)*y(3)*y(4) & - & **2 + 5*y(1)*y(2)*y(4)**3 + 30*y(1)*y(3)**4 + 60*y(1)*y(3)**3*y(4) + 40*y(1)*y(3) & - & **2*y(4)**2 + 10*y(1)*y(3)*y(4)**3 - 3219*y(2)**5 - 3694*y(2)**4*y(3) - 1847*y(2) & - & **4*y(4) - 1040*y(2)**3*y(3)**2 - 1040*y(2)**3*y(3)*y(4) - 285*y(2)**3*y(4)**2 & - & - 550*y(2)**2*y(3)**3 - 825*y(2)**2*y(3)**2*y(4) - 465*y(2)**2*y(3)*y(4)**2 & - & - 95*y(2)**2*y(4)**3 + 15*y(2)*y(3)**4 + 30*y(2)*y(3)**3*y(4) + 20*y(2)*y(3) & - & **2*y(4)**2 + 5*y(2)*y(3)*y(4)**3))/(5*(y(1) + y(2))*(y(2) + y(3))*(y(1) + y(2) & - & + y(3))**2*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) + y(4))**2) + & 4) = (4*ys(2)**2*(105*ys(1)**2*ys(2)**3 + 220*ys(1)**2*ys(2)**2*ys(3) + 110*ys(1) & + & **2*ys(2)**2*ys(4) + 35*ys(1)**2*ys(2)*ys(3)**2 + 35*ys(1)**2*ys(2)*ys(3)*ys(4) & + & + 5*ys(1)**2*ys(2)*ys(4)**2 + 20*ys(1)**2*ys(3)**3 + 30*ys(1)**2*ys(3)**2*ys(4) & + & + 10*ys(1)**2*ys(3)*ys(4)**2 - 1452*ys(1)*ys(2)**4 + 250*ys(1)*ys(2)**3*ys(3) & + & + 125*ys(1)*ys(2)**3*ys(4) + 100*ys(1)*ys(2)**2*ys(3)**2 + 100*ys(1)*ys(2) & + & **2*ys(3)*ys(4) + 20*ys(1)*ys(2)**2*ys(4)**2 + 90*ys(1)*ys(2)*ys(3)**3 & + & + 135*ys(1)*ys(2)*ys(3)**2*ys(4) + 55*ys(1)*ys(2)*ys(3)*ys(4)**2 + 5*ys(1)*ys(2) & + & *ys(4)**3 + 30*ys(1)*ys(3)**4 + 60*ys(1)*ys(3)**3*ys(4) + 40*ys(1)*ys(3)**2*ys(4) & + & **2 + 10*ys(1)*ys(3)*ys(4)**3 - 3219*ys(2)**5 - 3694*ys(2)**4*ys(3) - 1847*ys(2) & + & **4*ys(4) - 1040*ys(2)**3*ys(3)**2 - 1040*ys(2)**3*ys(3)*ys(4) - 285*ys(2) & + & **3*ys(4)**2 - 550*ys(2)**2*ys(3)**3 - 825*ys(2)**2*ys(3)**2*ys(4) - 465*ys(2) & + & **2*ys(3)*ys(4)**2 - 95*ys(2)**2*ys(4)**3 + 15*ys(2)*ys(3)**4 + 30*ys(2)*ys(3) & + & **3*ys(4) + 20*ys(2)*ys(3)**2*ys(4)**2 + 5*ys(2)*ys(3)*ys(4)**3))/(5*(ys(1) & + & + ys(2))*(ys(2) + ys(3))*(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) + ys(4)) & + & *(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 1, & - & 5) = (4*y(2)**2*(831*y(2)**4 + 200*y(2)**3*y(3) + 100*y(2)**3*y(4) + 205*y(2) & - & **2*y(3)**2 + 205*y(2)**2*y(3)*y(4) + 50*y(2)**2*y(4)**2 + 10*y(2)*y(3)**3 & - & + 15*y(2)*y(3)**2*y(4) + 5*y(2)*y(3)*y(4)**2 + 5*y(3)**4 + 10*y(3)**3*y(4) & - & + 5*y(3)**2*y(4)**2))/(5*(y(1) + y(2))**2*(y(1) + y(2) + y(3))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 5) = (4*ys(2)**2*(831*ys(2)**4 + 200*ys(2)**3*ys(3) + 100*ys(2)**3*ys(4) & + & + 205*ys(2)**2*ys(3)**2 + 205*ys(2)**2*ys(3)*ys(4) + 50*ys(2)**2*ys(4)**2 & + & + 10*ys(2)*ys(3)**3 + 15*ys(2)*ys(3)**2*ys(4) + 5*ys(2)*ys(3)*ys(4)**2 + 5*ys(3) & + & **4 + 10*ys(3)**3*ys(4) + 5*ys(3)**2*ys(4)**2))/(5*(ys(1) + ys(2))**2*(ys(1) & + & + ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) - y = s_cb(i + 1:i + 4) - s_cb(i:i + 3) + ys = s_cb(i + 1:i + 4) - s_cb(i:i + 3) beta_coef_${XYZ}$ (i + 1, 0, & - & 0) = (4*y(1)**2*(831*y(1)**4 + 200*y(1)**3*y(2) + 100*y(1)**3*y(3) + 205*y(1) & - & **2*y(2)**2 + 205*y(1)**2*y(2)*y(3) + 50*y(1)**2*y(3)**2 + 10*y(1)*y(2)**3 & - & + 15*y(1)*y(2)**2*y(3) + 5*y(1)*y(2)*y(3)**2 + 5*y(2)**4 + 10*y(2)**3*y(3) & - & + 5*y(2)**2*y(3)**2))/(5*(y(3) + y(4))**2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 0) = (4*ys(1)**2*(831*ys(1)**4 + 200*ys(1)**3*ys(2) + 100*ys(1)**3*ys(3) & + & + 205*ys(1)**2*ys(2)**2 + 205*ys(1)**2*ys(2)*ys(3) + 50*ys(1)**2*ys(3)**2 & + & + 10*ys(1)*ys(2)**3 + 15*ys(1)*ys(2)**2*ys(3) + 5*ys(1)*ys(2)*ys(3)**2 + 5*ys(2) & + & **4 + 10*ys(2)**3*ys(3) + 5*ys(2)**2*ys(3)**2))/(5*(ys(3) + ys(4))**2*(ys(2) & + & + ys(3) + ys(4))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 0, & - & 1) = -(4*y(1)**2*(1662*y(1)**5 + 3824*y(1)**4*y(2) + 3624*y(1)**4*y(3) & - & + 1762*y(1)**4*y(4) + 1515*y(1)**3*y(2)**2 + 2115*y(1)**3*y(2)*y(3) + 805*y(1) & - & **3*y(2)*y(4) + 700*y(1)**3*y(3)**2 + 500*y(1)**3*y(3)*y(4) + 100*y(1)**3*y(4) & - & **2 + 1060*y(1)**2*y(2)**3 + 2205*y(1)**2*y(2)**2*y(3) + 835*y(1)**2*y(2)**2*y(4) & - & + 1445*y(1)**2*y(2)*y(3)**2 + 1030*y(1)**2*y(2)*y(3)*y(4) + 205*y(1)**2*y(2)*y(4) & - & **2 + 300*y(1)**2*y(3)**3 + 300*y(1)**2*y(3)**2*y(4) + 100*y(1)**2*y(3)*y(4)**2 & - & + 75*y(1)*y(2)**4 + 180*y(1)*y(2)**3*y(3) + 60*y(1)*y(2)**3*y(4) + 135*y(1)*y(2) & - & **2*y(3)**2 + 90*y(1)*y(2)**2*y(3)*y(4) + 15*y(1)*y(2)**2*y(4)**2 + 30*y(1)*y(2) & - & *y(3)**3 + 30*y(1)*y(2)*y(3)**2*y(4) + 10*y(1)*y(2)*y(3)*y(4)**2 + 30*y(2)**5 & - & + 90*y(2)**4*y(3) + 30*y(2)**4*y(4) + 90*y(2)**3*y(3)**2 + 60*y(2)**3*y(3)*y(4) & - & + 10*y(2)**3*y(4)**2 + 30*y(2)**2*y(3)**3 + 30*y(2)**2*y(3)**2*y(4) + 10*y(2) & - & **2*y(3)*y(4)**2))/(5*(y(2) + y(3))*(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) & - & + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 1) = -(4*ys(1)**2*(1662*ys(1)**5 + 3824*ys(1)**4*ys(2) + 3624*ys(1)**4*ys(3) & + & + 1762*ys(1)**4*ys(4) + 1515*ys(1)**3*ys(2)**2 + 2115*ys(1)**3*ys(2)*ys(3) & + & + 805*ys(1)**3*ys(2)*ys(4) + 700*ys(1)**3*ys(3)**2 + 500*ys(1)**3*ys(3)*ys(4) & + & + 100*ys(1)**3*ys(4)**2 + 1060*ys(1)**2*ys(2)**3 + 2205*ys(1)**2*ys(2)**2*ys(3) & + & + 835*ys(1)**2*ys(2)**2*ys(4) + 1445*ys(1)**2*ys(2)*ys(3)**2 + 1030*ys(1) & + & **2*ys(2)*ys(3)*ys(4) + 205*ys(1)**2*ys(2)*ys(4)**2 + 300*ys(1)**2*ys(3)**3 & + & + 300*ys(1)**2*ys(3)**2*ys(4) + 100*ys(1)**2*ys(3)*ys(4)**2 + 75*ys(1)*ys(2)**4 & + & + 180*ys(1)*ys(2)**3*ys(3) + 60*ys(1)*ys(2)**3*ys(4) + 135*ys(1)*ys(2)**2*ys(3) & + & **2 + 90*ys(1)*ys(2)**2*ys(3)*ys(4) + 15*ys(1)*ys(2)**2*ys(4)**2 + 30*ys(1)*ys(2) & + & *ys(3)**3 + 30*ys(1)*ys(2)*ys(3)**2*ys(4) + 10*ys(1)*ys(2)*ys(3)*ys(4)**2 & + & + 30*ys(2)**5 + 90*ys(2)**4*ys(3) + 30*ys(2)**4*ys(4) + 90*ys(2)**3*ys(3)**2 & + & + 60*ys(2)**3*ys(3)*ys(4) + 10*ys(2)**3*ys(4)**2 + 30*ys(2)**2*ys(3)**3 & + & + 30*ys(2)**2*ys(3)**2*ys(4) + 10*ys(2)**2*ys(3)*ys(4)**2))/(5*(ys(2) + ys(3)) & + & *(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3))*(ys(2) + ys(3) + ys(4))**2*(ys(1) & + & + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 0, & - & 2) = (4*y(1)**2*(1767*y(1)**4 + 725*y(1)**3*y(2) + 415*y(1)**3*y(3) + 105*y(4) & - & *y(1)**3 + 665*y(1)**2*y(2)**2 + 775*y(1)**2*y(2)*y(3) + 220*y(4)*y(1)**2*y(2) & - & + 215*y(1)**2*y(3)**2 + 110*y(4)*y(1)**2*y(3) + 75*y(1)*y(2)**3 + 130*y(1)*y(2) & - & **2*y(3) + 35*y(4)*y(1)*y(2)**2 + 60*y(1)*y(2)*y(3)**2 + 35*y(4)*y(1)*y(2)*y(3) & - & + 5*y(1)*y(3)**3 + 5*y(4)*y(1)*y(3)**2 + 30*y(2)**4 + 70*y(2)**3*y(3) + 20*y(4) & - & *y(2)**3 + 50*y(2)**2*y(3)**2 + 30*y(4)*y(2)**2*y(3) + 10*y(2)*y(3)**3 + 10*y(4) & - & *y(2)*y(3)**2))/(5*(y(1) + y(2))*(y(3) + y(4))*(y(1) + y(2) + y(3))*(y(2) + y(3) & - & + y(4))*(y(1) + y(2) + y(3) + y(4))**2) + & 2) = (4*ys(1)**2*(1767*ys(1)**4 + 725*ys(1)**3*ys(2) + 415*ys(1)**3*ys(3) & + & + 105*ys(4)*ys(1)**3 + 665*ys(1)**2*ys(2)**2 + 775*ys(1)**2*ys(2)*ys(3) & + & + 220*ys(4)*ys(1)**2*ys(2) + 215*ys(1)**2*ys(3)**2 + 110*ys(4)*ys(1)**2*ys(3) & + & + 75*ys(1)*ys(2)**3 + 130*ys(1)*ys(2)**2*ys(3) + 35*ys(4)*ys(1)*ys(2)**2 & + & + 60*ys(1)*ys(2)*ys(3)**2 + 35*ys(4)*ys(1)*ys(2)*ys(3) + 5*ys(1)*ys(3)**3 & + & + 5*ys(4)*ys(1)*ys(3)**2 + 30*ys(2)**4 + 70*ys(2)**3*ys(3) + 20*ys(4)*ys(2)**3 & + & + 50*ys(2)**2*ys(3)**2 + 30*ys(4)*ys(2)**2*ys(3) + 10*ys(2)*ys(3)**3 + 10*ys(4) & + & *ys(2)*ys(3)**2))/(5*(ys(1) + ys(2))*(ys(3) + ys(4))*(ys(1) + ys(2) + ys(3)) & + & *(ys(2) + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 0, & - & 3) = (4*y(1)**2*(831*y(1)**6 + 3624*y(1)**5*y(2) + 3524*y(1)**5*y(3) + 1762*y(1) & - & **5*y(4) + 4884*y(1)**4*y(2)**2 + 9058*y(1)**4*y(2)*y(3) + 4529*y(1)**4*y(2)*y(4) & - & + 4224*y(1)**4*y(3)**2 + 4224*y(1)**4*y(3)*y(4) + 1081*y(1)**4*y(4)**2 & - & + 2565*y(1)**3*y(2)**3 + 6120*y(1)**3*y(2)**2*y(3) + 3060*y(1)**3*y(2)**2*y(4) & - & + 4755*y(1)**3*y(2)*y(3)**2 + 4755*y(1)**3*y(2)*y(3)*y(4) + 1315*y(1)**3*y(2) & - & *y(4)**2 + 1200*y(1)**3*y(3)**3 + 1800*y(1)**3*y(3)**2*y(4) + 1000*y(1)**3*y(3) & - & *y(4)**2 + 200*y(1)**3*y(4)**3 + 1395*y(1)**2*y(2)**4 + 4380*y(1)**2*y(2)**3*y(3) & - & + 2190*y(1)**2*y(2)**3*y(4) + 5025*y(1)**2*y(2)**2*y(3)**2 + 5025*y(1)**2*y(2) & - & **2*y(3)*y(4) + 1390*y(1)**2*y(2)**2*y(4)**2 + 2490*y(1)**2*y(2)*y(3)**3 & - & + 3735*y(1)**2*y(2)*y(3)**2*y(4) + 2075*y(1)**2*y(2)*y(3)*y(4)**2 + 415*y(1) & - & **2*y(2)*y(4)**3 + 450*y(1)**2*y(3)**4 + 900*y(1)**2*y(3)**3*y(4) + 750*y(1) & - & **2*y(3)**2*y(4)**2 + 300*y(1)**2*y(3)*y(4)**3 + 50*y(1)**2*y(4)**4 + 135*y(1) & - & *y(2)**5 + 450*y(1)*y(2)**4*y(3) + 225*y(1)*y(2)**4*y(4) + 540*y(1)*y(2)**3*y(3) & - & **2 + 540*y(1)*y(2)**3*y(3)*y(4) + 150*y(1)*y(2)**3*y(4)**2 + 270*y(1)*y(2) & - & **2*y(3)**3 + 405*y(1)*y(2)**2*y(3)**2*y(4) + 225*y(1)*y(2)**2*y(3)*y(4)**2 & - & + 45*y(1)*y(2)**2*y(4)**3 + 45*y(1)*y(2)*y(3)**4 + 90*y(1)*y(2)*y(3)**3*y(4) & - & + 75*y(1)*y(2)*y(3)**2*y(4)**2 + 30*y(1)*y(2)*y(3)*y(4)**3 + 5*y(1)*y(2)*y(4)**4 & - & + 45*y(2)**6 + 180*y(2)**5*y(3) + 90*y(2)**5*y(4) + 270*y(2)**4*y(3)**2 & - & + 270*y(2)**4*y(3)*y(4) + 75*y(2)**4*y(4)**2 + 180*y(2)**3*y(3)**3 + 270*y(2) & - & **3*y(3)**2*y(4) + 150*y(2)**3*y(3)*y(4)**2 + 30*y(2)**3*y(4)**3 + 45*y(2) & - & **2*y(3)**4 + 90*y(2)**2*y(3)**3*y(4) + 75*y(2)**2*y(3)**2*y(4)**2 + 30*y(2) & - & **2*y(3)*y(4)**3 + 5*y(2)**2*y(4)**4))/(5*(y(2) + y(3))**2*(y(1) + y(2) + y(3)) & - & **2*(y(2) + y(3) + y(4))**2*(y(1) + y(2) + y(3) + y(4))**2) + & 3) = (4*ys(1)**2*(831*ys(1)**6 + 3624*ys(1)**5*ys(2) + 3524*ys(1)**5*ys(3) & + & + 1762*ys(1)**5*ys(4) + 4884*ys(1)**4*ys(2)**2 + 9058*ys(1)**4*ys(2)*ys(3) & + & + 4529*ys(1)**4*ys(2)*ys(4) + 4224*ys(1)**4*ys(3)**2 + 4224*ys(1)**4*ys(3)*ys(4) & + & + 1081*ys(1)**4*ys(4)**2 + 2565*ys(1)**3*ys(2)**3 + 6120*ys(1)**3*ys(2)**2*ys(3) & + & + 3060*ys(1)**3*ys(2)**2*ys(4) + 4755*ys(1)**3*ys(2)*ys(3)**2 + 4755*ys(1) & + & **3*ys(2)*ys(3)*ys(4) + 1315*ys(1)**3*ys(2)*ys(4)**2 + 1200*ys(1)**3*ys(3)**3 & + & + 1800*ys(1)**3*ys(3)**2*ys(4) + 1000*ys(1)**3*ys(3)*ys(4)**2 + 200*ys(1) & + & **3*ys(4)**3 + 1395*ys(1)**2*ys(2)**4 + 4380*ys(1)**2*ys(2)**3*ys(3) + 2190*ys(1) & + & **2*ys(2)**3*ys(4) + 5025*ys(1)**2*ys(2)**2*ys(3)**2 + 5025*ys(1)**2*ys(2) & + & **2*ys(3)*ys(4) + 1390*ys(1)**2*ys(2)**2*ys(4)**2 + 2490*ys(1)**2*ys(2)*ys(3)**3 & + & + 3735*ys(1)**2*ys(2)*ys(3)**2*ys(4) + 2075*ys(1)**2*ys(2)*ys(3)*ys(4)**2 & + & + 415*ys(1)**2*ys(2)*ys(4)**3 + 450*ys(1)**2*ys(3)**4 + 900*ys(1)**2*ys(3) & + & **3*ys(4) + 750*ys(1)**2*ys(3)**2*ys(4)**2 + 300*ys(1)**2*ys(3)*ys(4)**3 & + & + 50*ys(1)**2*ys(4)**4 + 135*ys(1)*ys(2)**5 + 450*ys(1)*ys(2)**4*ys(3) & + & + 225*ys(1)*ys(2)**4*ys(4) + 540*ys(1)*ys(2)**3*ys(3)**2 + 540*ys(1)*ys(2) & + & **3*ys(3)*ys(4) + 150*ys(1)*ys(2)**3*ys(4)**2 + 270*ys(1)*ys(2)**2*ys(3)**3 & + & + 405*ys(1)*ys(2)**2*ys(3)**2*ys(4) + 225*ys(1)*ys(2)**2*ys(3)*ys(4)**2 & + & + 45*ys(1)*ys(2)**2*ys(4)**3 + 45*ys(1)*ys(2)*ys(3)**4 + 90*ys(1)*ys(2)*ys(3) & + & **3*ys(4) + 75*ys(1)*ys(2)*ys(3)**2*ys(4)**2 + 30*ys(1)*ys(2)*ys(3)*ys(4)**3 & + & + 5*ys(1)*ys(2)*ys(4)**4 + 45*ys(2)**6 + 180*ys(2)**5*ys(3) + 90*ys(2)**5*ys(4) & + & + 270*ys(2)**4*ys(3)**2 + 270*ys(2)**4*ys(3)*ys(4) + 75*ys(2)**4*ys(4)**2 & + & + 180*ys(2)**3*ys(3)**3 + 270*ys(2)**3*ys(3)**2*ys(4) + 150*ys(2)**3*ys(3)*ys(4) & + & **2 + 30*ys(2)**3*ys(4)**3 + 45*ys(2)**2*ys(3)**4 + 90*ys(2)**2*ys(3)**3*ys(4) & + & + 75*ys(2)**2*ys(3)**2*ys(4)**2 + 30*ys(2)**2*ys(3)*ys(4)**3 + 5*ys(2)**2*ys(4) & + & **4))/(5*(ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3))**2*(ys(2) + ys(3) + ys(4)) & + & **2*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 0, & - & 4) = -(4*y(1)**2*(1767*y(1)**5 + 4464*y(1)**4*y(2) + 4154*y(1)**4*y(3) & - & + 2077*y(1)**4*y(4) + 2655*y(1)**3*y(2)**2 + 4010*y(1)**3*y(2)*y(3) + 2005*y(1) & - & **3*y(2)*y(4) + 1460*y(1)**3*y(3)**2 + 1460*y(1)**3*y(3)*y(4) + 415*y(1)**3*y(4) & - & **2 + 1800*y(1)**2*y(2)**3 + 4000*y(1)**2*y(2)**2*y(3) + 2000*y(1)**2*y(2) & - & **2*y(4) + 2850*y(1)**2*y(2)*y(3)**2 + 2850*y(1)**2*y(2)*y(3)*y(4) + 790*y(1) & - & **2*y(2)*y(4)**2 + 650*y(1)**2*y(3)**3 + 975*y(1)**2*y(3)**2*y(4) + 535*y(1) & - & **2*y(3)*y(4)**2 + 105*y(1)**2*y(4)**3 + 270*y(1)*y(2)**4 + 720*y(1)*y(2)**3*y(3) & - & + 360*y(1)*y(2)**3*y(4) + 645*y(1)*y(2)**2*y(3)**2 + 645*y(1)*y(2)**2*y(3)*y(4) & - & + 165*y(1)*y(2)**2*y(4)**2 + 210*y(1)*y(2)*y(3)**3 + 315*y(1)*y(2)*y(3)**2*y(4) & - & + 155*y(1)*y(2)*y(3)*y(4)**2 + 25*y(1)*y(2)*y(4)**3 + 15*y(1)*y(3)**4 + 30*y(1) & - & *y(3)**3*y(4) + 20*y(1)*y(3)**2*y(4)**2 + 5*y(1)*y(3)*y(4)**3 + 90*y(2)**5 & - & + 300*y(2)**4*y(3) + 150*y(2)**4*y(4) + 360*y(2)**3*y(3)**2 + 360*y(2)**3*y(3) & - & *y(4) + 90*y(2)**3*y(4)**2 + 180*y(2)**2*y(3)**3 + 270*y(2)**2*y(3)**2*y(4) & - & + 130*y(2)**2*y(3)*y(4)**2 + 20*y(2)**2*y(4)**3 + 30*y(2)*y(3)**4 + 60*y(2)*y(3) & - & **3*y(4) + 40*y(2)*y(3)**2*y(4)**2 + 10*y(2)*y(3)*y(4)**3))/(5*(y(1) + y(2)) & - & *(y(2) + y(3))*(y(1) + y(2) + y(3))**2*(y(2) + y(3) + y(4))*(y(1) + y(2) + y(3) & - & + y(4))**2) + & 4) = -(4*ys(1)**2*(1767*ys(1)**5 + 4464*ys(1)**4*ys(2) + 4154*ys(1)**4*ys(3) & + & + 2077*ys(1)**4*ys(4) + 2655*ys(1)**3*ys(2)**2 + 4010*ys(1)**3*ys(2)*ys(3) & + & + 2005*ys(1)**3*ys(2)*ys(4) + 1460*ys(1)**3*ys(3)**2 + 1460*ys(1)**3*ys(3)*ys(4) & + & + 415*ys(1)**3*ys(4)**2 + 1800*ys(1)**2*ys(2)**3 + 4000*ys(1)**2*ys(2)**2*ys(3) & + & + 2000*ys(1)**2*ys(2)**2*ys(4) + 2850*ys(1)**2*ys(2)*ys(3)**2 + 2850*ys(1) & + & **2*ys(2)*ys(3)*ys(4) + 790*ys(1)**2*ys(2)*ys(4)**2 + 650*ys(1)**2*ys(3)**3 & + & + 975*ys(1)**2*ys(3)**2*ys(4) + 535*ys(1)**2*ys(3)*ys(4)**2 + 105*ys(1)**2*ys(4) & + & **3 + 270*ys(1)*ys(2)**4 + 720*ys(1)*ys(2)**3*ys(3) + 360*ys(1)*ys(2)**3*ys(4) & + & + 645*ys(1)*ys(2)**2*ys(3)**2 + 645*ys(1)*ys(2)**2*ys(3)*ys(4) + 165*ys(1)*ys(2) & + & **2*ys(4)**2 + 210*ys(1)*ys(2)*ys(3)**3 + 315*ys(1)*ys(2)*ys(3)**2*ys(4) & + & + 155*ys(1)*ys(2)*ys(3)*ys(4)**2 + 25*ys(1)*ys(2)*ys(4)**3 + 15*ys(1)*ys(3)**4 & + & + 30*ys(1)*ys(3)**3*ys(4) + 20*ys(1)*ys(3)**2*ys(4)**2 + 5*ys(1)*ys(3)*ys(4)**3 & + & + 90*ys(2)**5 + 300*ys(2)**4*ys(3) + 150*ys(2)**4*ys(4) + 360*ys(2)**3*ys(3)**2 & + & + 360*ys(2)**3*ys(3)*ys(4) + 90*ys(2)**3*ys(4)**2 + 180*ys(2)**2*ys(3)**3 & + & + 270*ys(2)**2*ys(3)**2*ys(4) + 130*ys(2)**2*ys(3)*ys(4)**2 + 20*ys(2)**2*ys(4) & + & **3 + 30*ys(2)*ys(3)**4 + 60*ys(2)*ys(3)**3*ys(4) + 40*ys(2)*ys(3)**2*ys(4)**2 & + & + 10*ys(2)*ys(3)*ys(4)**3))/(5*(ys(1) + ys(2))*(ys(2) + ys(3))*(ys(1) + ys(2) & + & + ys(3))**2*(ys(2) + ys(3) + ys(4))*(ys(1) + ys(2) + ys(3) + ys(4))**2) beta_coef_${XYZ}$ (i + 1, 0, & - & 5) = (4*y(1)**2*(996*y(1)**4 + 675*y(1)**3*y(2) + 450*y(1)**3*y(3) + 225*y(1) & - & **3*y(4) + 600*y(1)**2*y(2)**2 + 800*y(1)**2*y(2)*y(3) + 400*y(1)**2*y(2)*y(4) & - & + 260*y(1)**2*y(3)**2 + 260*y(1)**2*y(3)*y(4) + 60*y(1)**2*y(4)**2 + 135*y(1) & - & *y(2)**3 + 270*y(1)*y(2)**2*y(3) + 135*y(1)*y(2)**2*y(4) + 165*y(1)*y(2)*y(3)**2 & - & + 165*y(1)*y(2)*y(3)*y(4) + 30*y(1)*y(2)*y(4)**2 + 30*y(1)*y(3)**3 + 45*y(1)*y(3) & - & **2*y(4) + 15*y(1)*y(3)*y(4)**2 + 45*y(2)**4 + 120*y(2)**3*y(3) + 60*y(2)**3*y(4) & - & + 110*y(2)**2*y(3)**2 + 110*y(2)**2*y(3)*y(4) + 20*y(2)**2*y(4)**2 + 40*y(2)*y(3) & - & **3 + 60*y(2)*y(3)**2*y(4) + 20*y(2)*y(3)*y(4)**2 + 5*y(3)**4 + 10*y(3)**3*y(4) & - & + 5*y(3)**2*y(4)**2))/(5*(y(1) + y(2))**2*(y(1) + y(2) + y(3))**2*(y(1) + y(2) & - & + y(3) + y(4))**2) + & 5) = (4*ys(1)**2*(996*ys(1)**4 + 675*ys(1)**3*ys(2) + 450*ys(1)**3*ys(3) & + & + 225*ys(1)**3*ys(4) + 600*ys(1)**2*ys(2)**2 + 800*ys(1)**2*ys(2)*ys(3) & + & + 400*ys(1)**2*ys(2)*ys(4) + 260*ys(1)**2*ys(3)**2 + 260*ys(1)**2*ys(3)*ys(4) & + & + 60*ys(1)**2*ys(4)**2 + 135*ys(1)*ys(2)**3 + 270*ys(1)*ys(2)**2*ys(3) & + & + 135*ys(1)*ys(2)**2*ys(4) + 165*ys(1)*ys(2)*ys(3)**2 + 165*ys(1)*ys(2)*ys(3) & + & *ys(4) + 30*ys(1)*ys(2)*ys(4)**2 + 30*ys(1)*ys(3)**3 + 45*ys(1)*ys(3)**2*ys(4) & + & + 15*ys(1)*ys(3)*ys(4)**2 + 45*ys(2)**4 + 120*ys(2)**3*ys(3) + 60*ys(2)**3*ys(4) & + & + 110*ys(2)**2*ys(3)**2 + 110*ys(2)**2*ys(3)*ys(4) + 20*ys(2)**2*ys(4)**2 & + & + 40*ys(2)*ys(3)**3 + 60*ys(2)*ys(3)**2*ys(4) + 20*ys(2)*ys(3)*ys(4)**2 + 5*ys(3) & + & **4 + 10*ys(3)**3*ys(4) + 5*ys(3)**2*ys(4)**2))/(5*(ys(1) + ys(2))**2*(ys(1) & + & + ys(2) + ys(3))**2*(ys(1) + ys(2) + ys(3) + ys(4))**2) end do else ! (Fu, et al., 2016) Table 2 (for right flux) From 9b968a5346a5e4c17a8e7dcf100d8d81cfbff7bc Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 09:03:00 -0500 Subject: [PATCH 02/20] refactor: consolidate stretch and body force params into derived types Implements items 7 and 5 from issue #1427: - x_a/x_b/y_a/y_b/z_a/z_b -> type(bounds_info) :: x_stretch, y_stretch, z_stretch - bf_x/bf_y/bf_z + k_x/w_x/p_x/g_x (and y/z) -> type(body_force_axis) :: bf_x, bf_y, bf_z --- docs/documentation/case.md | 20 ++--- examples/2D_axisym_shockwatercavity/case.py | 8 +- examples/2D_hardcoded_ic/case.py | 8 +- examples/2D_isentropicvortex/case.py | 8 +- .../2D_isentropicvortex_analytical/case.py | 8 +- examples/2D_phasechange_bubble/case.py | 8 +- examples/2D_rayleigh_taylor/case.py | 10 +-- examples/2D_shockdroplet/case.py | 4 +- examples/2D_shockdroplet_muscl/case.py | 4 +- examples/3D_performance_test/case.py | 12 +-- examples/3D_phasechange_bubble/case.py | 12 +-- examples/3D_rayleigh_taylor/case.py | 10 +-- examples/3D_rayleigh_taylor_muscl/case.py | 10 +-- examples/3D_shockdroplet/case.py | 12 +-- examples/3D_shockdroplet_muscl/case.py | 12 +-- examples/3D_sphbubcollapse/case.py | 12 +-- examples/3D_turb_mixing/case.py | 4 +- src/common/m_derived_types.fpp | 6 ++ src/pre_process/m_global_parameters.fpp | 21 +++--- src/pre_process/m_grid.f90 | 50 +++++++------ src/pre_process/m_mpi_proxy.fpp | 7 +- src/pre_process/m_start_up.fpp | 2 +- src/simulation/m_body_forces.fpp | 10 +-- src/simulation/m_global_parameters.fpp | 53 ++++++------- src/simulation/m_ibm.fpp | 6 +- src/simulation/m_mpi_proxy.fpp | 16 ++-- src/simulation/m_start_up.fpp | 14 ++-- toolchain/mfc/case_validator.py | 10 +-- toolchain/mfc/params/definitions.py | 74 +++++++++---------- toolchain/mfc/params/descriptions.py | 42 +++++------ toolchain/mfc/params/namelist_parser.py | 54 +++++++------- toolchain/mfc/test/cases.py | 22 +++--- 32 files changed, 274 insertions(+), 275 deletions(-) diff --git a/docs/documentation/case.md b/docs/documentation/case.md index b92e8f945e..187bab00c7 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -146,13 +146,13 @@ When the simulation is 2D/axi-symmetric or 1D, it requires that $p=0$ or $p=n=0$ - `stretch_[x,y,z]` activates grid stretching in the $[x,y,z]$ directions. The grid is gradually stretched such that the domain boundaries are pushed away from the origin along a specified axis. -- `a_[x,y,z]`, `[x,y,z]_a`, and `[x,y,z]_b` are parameters that define the grid stretching function. When grid stretching along the $x$ axis is considered, the stretching function is given as: +- `a_[x,y,z]`, `[x,y,z]_stretch%%beg`, and `[x,y,z]_stretch%%end` (where `beg` is the negative-direction anchor and `end` the positive-direction anchor) are parameters that define the grid stretching function. When grid stretching along the $x$ axis is considered, the stretching function is given as: -\f[ x_{cb,stretch} = x_{cb} + \frac{x_{cb}}{a_x} \Bigg[ \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_a)}{L} \right) \right] + \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_b)}{L} \right) \right] -2 \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_b-x_a)}{2L} \right) \right] \Bigg] \f] +\f[ x_{cb,stretch} = x_{cb} + \frac{x_{cb}}{a_x} \Bigg[ \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_{stretch,beg})}{L} \right) \right] + \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{cb}-x_{stretch,end})}{L} \right) \right] -2 \mathrm{log}\left[\mathrm{cosh} \left( \frac{a_x(x_{stretch,end}-x_{stretch,beg})}{2L} \right) \right] \Bigg] \f] where `x_cb` and `x_[cb,stretch]` are the coordinates of a cell boundary at the original and stretched domains, respectively. `L` is the domain length along the `x` axis: `L`=`x_domain%%end`-`x_domain%%beg`. -Crudely speaking, `x_a` and `x_b` define the coordinates at which the grid begins to get stretched in the negative and positive directions along the $x$ axis, respectively. +Crudely speaking, `x_stretch%%beg` and `x_stretch%%end` define the coordinates at which the grid begins to get stretched in the negative and positive directions along the $x$ axis, respectively. $a_x$ defines the smoothness of the stretching. Stretching along the $y$ and $z$ axes follows the same logistics. Optimal choice of the parameters for grid stretching is case-dependent and left to the user. @@ -987,15 +987,15 @@ This parameter enables the use of true `pi_\infty` in bubble dynamics models whe | Parameter | Type | Description | | ---: | :---: | :--- | -| `bf_x[y,z]` | Logical | Enable body forces in the x[y,z] direction | -| `k_x[y,y]` | Real | Magnitude of oscillating acceleration | -| `w_x[y,z]` | Real | Frequency of oscillating acceleration | -| `p_x[y,z]` | Real | Phase shift of oscillating acceleration | -| `g_x[y,z]` | Real | Magnitude of background acceleration | +| `bf_[x,y,z]%%enabled` | Logical | Enable body forces in the [x,y,z] direction | +| `bf_[x,y,z]%%k` | Real | Magnitude of oscillating acceleration | +| `bf_[x,y,z]%%w` | Real | Frequency of oscillating acceleration | +| `bf_[x,y,z]%%p` | Real | Phase shift of oscillating acceleration | +| `bf_[x,y,z]%%g` | Real | Magnitude of background acceleration | -`k_x[y,z]`, `w_x[y,z]`, `p_x[y,z]`, and `g_x[y,z]` define an oscillating acceleration in the `x[y,z]` direction with the form +`bf_[x,y,z]%%k`, `bf_[x,y,z]%%w`, `bf_[x,y,z]%%p`, and `bf_[x,y,z]%%g` define an oscillating acceleration in the `[x,y,z]` direction with the form -\f[ a_{x[y,z]} = g_{x[y,z]} + k_{x[y,z]}\sin\left(w_{x[y,z]}t + p_{x[y,z]}\right). \f] +\f[ a_{[x,y,z]} = bf_{[x,y,z]}\%g + bf_{[x,y,z]}\%k\sin\left(bf_{[x,y,z]}\%w \cdot t + bf_{[x,y,z]}\%p\right). \f] By convention, positive accelerations in the `x[y,z]` direction are in the positive `x[y,z]` direction. diff --git a/examples/2D_axisym_shockwatercavity/case.py b/examples/2D_axisym_shockwatercavity/case.py index b331322e76..38d2cd2aa5 100644 --- a/examples/2D_axisym_shockwatercavity/case.py +++ b/examples/2D_axisym_shockwatercavity/case.py @@ -161,12 +161,12 @@ "y_domain%end": ye, "stretch_x": "T", "a_x": 20, - "x_a": -1.2 * D0, - "x_b": 1.2 * D0, + "x_stretch%beg": -1.2 * D0, + "x_stretch%end": 1.2 * D0, "stretch_y": "T", "a_y": 20, - "y_a": -0.0 * D0, - "y_b": 1.2 * D0, + "y_stretch%beg": -0.0 * D0, + "y_stretch%end": 1.2 * D0, "m": Nx, "n": Ny, "p": 0, diff --git a/examples/2D_hardcoded_ic/case.py b/examples/2D_hardcoded_ic/case.py index e26e01f8ac..7e1fd1eb6e 100644 --- a/examples/2D_hardcoded_ic/case.py +++ b/examples/2D_hardcoded_ic/case.py @@ -14,14 +14,14 @@ "x_domain%end": 4.0e00, "stretch_x": "T", "a_x": 7, - "x_a": -2, - "x_b": 2, + "x_stretch%beg": -2, + "x_stretch%end": 2, "y_domain%beg": 0.0e00, "y_domain%end": 4.0e00, "stretch_y": "T", "a_y": 7, - "y_a": -2, - "y_b": 2, + "y_stretch%beg": -2, + "y_stretch%end": 2, "m": 199, "n": 199, "p": 0, diff --git a/examples/2D_isentropicvortex/case.py b/examples/2D_isentropicvortex/case.py index 6bbffcd45c..c1d80a63b1 100644 --- a/examples/2D_isentropicvortex/case.py +++ b/examples/2D_isentropicvortex/case.py @@ -57,10 +57,10 @@ "loops_y": 2, "a_x": 1.03, "a_y": 1.03, - "x_a": -1.5, - "y_a": -1.5, - "x_b": 1.5, - "y_b": 1.5, + "x_stretch%beg": -1.5, + "y_stretch%beg": -1.5, + "x_stretch%end": 1.5, + "y_stretch%end": 1.5, "m": Nx, "n": Nx, "p": 0, diff --git a/examples/2D_isentropicvortex_analytical/case.py b/examples/2D_isentropicvortex_analytical/case.py index ba31fb491c..84e8bddb2a 100644 --- a/examples/2D_isentropicvortex_analytical/case.py +++ b/examples/2D_isentropicvortex_analytical/case.py @@ -57,10 +57,10 @@ "loops_y": 2, "a_x": 1.03, "a_y": 1.03, - "x_a": -1.5, - "y_a": -1.5, - "x_b": 1.5, - "y_b": 1.5, + "x_stretch%beg": -1.5, + "y_stretch%beg": -1.5, + "x_stretch%end": 1.5, + "y_stretch%end": 1.5, "m": Nx, "n": Nx, "p": 0, diff --git a/examples/2D_phasechange_bubble/case.py b/examples/2D_phasechange_bubble/case.py index c7b782daab..4ec49144fe 100644 --- a/examples/2D_phasechange_bubble/case.py +++ b/examples/2D_phasechange_bubble/case.py @@ -191,13 +191,13 @@ "stretch_x": "T", "loops_x": 3, "a_x": 4.0e0, - "x_a": -2.0 * R0, - "x_b": 2.0 * R0, + "x_stretch%beg": -2.0 * R0, + "x_stretch%end": 2.0 * R0, "stretch_y": "T", "loops_y": 3, "a_y": 4.0e0, - "y_a": -2.0 * R0, - "y_b": 2.0 * R0, + "y_stretch%beg": -2.0 * R0, + "y_stretch%end": 2.0 * R0, "cyl_coord": "T", "m": Nx, "n": Ny, diff --git a/examples/2D_rayleigh_taylor/case.py b/examples/2D_rayleigh_taylor/case.py index ab7d9267db..498daadbcd 100644 --- a/examples/2D_rayleigh_taylor/case.py +++ b/examples/2D_rayleigh_taylor/case.py @@ -79,11 +79,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y": "T", - "k_y": 0.0, - "w_y": 0.0, - "p_y": 0.0, - "g_y": -9.81, + "bf_y%enabled": "T", + "bf_y%k": 0.0, + "bf_y%w": 0.0, + "bf_y%p": 0.0, + "bf_y%g": -9.81, # Water Patch "patch_icpp(1)%geometry": 3, "patch_icpp(1)%hcid": 204, diff --git a/examples/2D_shockdroplet/case.py b/examples/2D_shockdroplet/case.py index 910d1e42aa..f75e2296df 100755 --- a/examples/2D_shockdroplet/case.py +++ b/examples/2D_shockdroplet/case.py @@ -38,8 +38,8 @@ "y_domain%end": 6 * D, "stretch_y": "T", "a_y": 3.67, - "y_a": -5.7 * D, - "y_b": 5.7 * D, + "y_stretch%beg": -5.7 * D, + "y_stretch%end": 5.7 * D, "loops_y": 2, "m": int(Nx), "n": int(Ny), diff --git a/examples/2D_shockdroplet_muscl/case.py b/examples/2D_shockdroplet_muscl/case.py index e27e13aefe..0de30d0529 100755 --- a/examples/2D_shockdroplet_muscl/case.py +++ b/examples/2D_shockdroplet_muscl/case.py @@ -38,8 +38,8 @@ "y_domain%end": 6 * D, "stretch_y": "T", "a_y": 3.67, - "y_a": -5.7 * D, - "y_b": 5.7 * D, + "y_stretch%beg": -5.7 * D, + "y_stretch%end": 5.7 * D, "loops_y": 2, "m": int(Nx), "n": int(Ny), diff --git a/examples/3D_performance_test/case.py b/examples/3D_performance_test/case.py index 4d4a4dc4b5..f851865759 100644 --- a/examples/3D_performance_test/case.py +++ b/examples/3D_performance_test/case.py @@ -16,16 +16,16 @@ "z_domain%end": 4.0e-03 / 1.0e-03, "stretch_x": "T", "a_x": 4.0e00, - "x_a": -1.5e-03 / 1.0e-03, - "x_b": 1.5e-03 / 1.0e-03, + "x_stretch%beg": -1.5e-03 / 1.0e-03, + "x_stretch%end": 1.5e-03 / 1.0e-03, "stretch_y": "T", "a_y": 4.0e00, - "y_a": -1.5e-03 / 1.0e-03, - "y_b": 1.5e-03 / 1.0e-03, + "y_stretch%beg": -1.5e-03 / 1.0e-03, + "y_stretch%end": 1.5e-03 / 1.0e-03, "stretch_z": "T", "a_z": 4.0e00, - "z_a": -1.5e-03 / 1.0e-03, - "z_b": 1.5e-03 / 1.0e-03, + "z_stretch%beg": -1.5e-03 / 1.0e-03, + "z_stretch%end": 1.5e-03 / 1.0e-03, "cyl_coord": "F", "m": 200, "n": 200, diff --git a/examples/3D_phasechange_bubble/case.py b/examples/3D_phasechange_bubble/case.py index 6c71aa1936..9d9fbf6d34 100644 --- a/examples/3D_phasechange_bubble/case.py +++ b/examples/3D_phasechange_bubble/case.py @@ -193,18 +193,18 @@ "stretch_x": "T", "loops_x": 3, "a_x": 4.0e0, - "x_a": -2.0 * R0, - "x_b": 2.0 * R0, + "x_stretch%beg": -2.0 * R0, + "x_stretch%end": 2.0 * R0, "stretch_y": "T", "loops_y": 3, "a_y": 4.0e0, - "y_a": -2.0 * R0, - "y_b": 2.0 * R0, + "y_stretch%beg": -2.0 * R0, + "y_stretch%end": 2.0 * R0, "stretch_z": "T", "loops_z": 3, "a_z": 4.0e0, - "z_a": -2.0 * R0, - "z_b": 2.0 * R0, + "z_stretch%beg": -2.0 * R0, + "z_stretch%end": 2.0 * R0, "cyl_coord": "F", "m": Nx, "n": Ny, diff --git a/examples/3D_rayleigh_taylor/case.py b/examples/3D_rayleigh_taylor/case.py index 647127426d..74d1e838a7 100644 --- a/examples/3D_rayleigh_taylor/case.py +++ b/examples/3D_rayleigh_taylor/case.py @@ -86,11 +86,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y": "T", - "k_y": 0.0, - "w_y": 0.0, - "p_y": 0.0, - "g_y": -98.1, + "bf_y%enabled": "T", + "bf_y%k": 0.0, + "bf_y%w": 0.0, + "bf_y%p": 0.0, + "bf_y%g": -98.1, # Water Patch "patch_icpp(1)%geometry": 9, "patch_icpp(1)%hcid": 300, diff --git a/examples/3D_rayleigh_taylor_muscl/case.py b/examples/3D_rayleigh_taylor_muscl/case.py index f93248383c..e9f2ce8b32 100644 --- a/examples/3D_rayleigh_taylor_muscl/case.py +++ b/examples/3D_rayleigh_taylor_muscl/case.py @@ -84,11 +84,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y": "T", - "k_y": 0.0, - "w_y": 0.0, - "p_y": 0.0, - "g_y": -98.1, + "bf_y%enabled": "T", + "bf_y%k": 0.0, + "bf_y%w": 0.0, + "bf_y%p": 0.0, + "bf_y%g": -98.1, # Water Patch "patch_icpp(1)%geometry": 9, "patch_icpp(1)%hcid": 300, diff --git a/examples/3D_shockdroplet/case.py b/examples/3D_shockdroplet/case.py index 10741bc82e..bd1c663e67 100644 --- a/examples/3D_shockdroplet/case.py +++ b/examples/3D_shockdroplet/case.py @@ -173,16 +173,16 @@ "z_domain%end": ze, "stretch_x": "T", "a_x": 20, - "x_a": -1.2 * D0, - "x_b": 1.2 * D0, + "x_stretch%beg": -1.2 * D0, + "x_stretch%end": 1.2 * D0, "stretch_y": "T", "a_y": 20, - "y_a": -0.0 * D0, - "y_b": 1.2 * D0, + "y_stretch%beg": -0.0 * D0, + "y_stretch%end": 1.2 * D0, "stretch_z": "T", "a_z": 20, - "z_a": -0.0 * D0, - "z_b": 1.2 * D0, + "z_stretch%beg": -0.0 * D0, + "z_stretch%end": 1.2 * D0, "m": Nx, "n": Ny, "p": Nz, diff --git a/examples/3D_shockdroplet_muscl/case.py b/examples/3D_shockdroplet_muscl/case.py index d1defd1e5d..e478f65046 100644 --- a/examples/3D_shockdroplet_muscl/case.py +++ b/examples/3D_shockdroplet_muscl/case.py @@ -173,16 +173,16 @@ "z_domain%end": ze, "stretch_x": "T", "a_x": 20, - "x_a": -1.2 * D0, - "x_b": 1.2 * D0, + "x_stretch%beg": -1.2 * D0, + "x_stretch%end": 1.2 * D0, "stretch_y": "T", "a_y": 20, - "y_a": -0.0 * D0, - "y_b": 1.2 * D0, + "y_stretch%beg": -0.0 * D0, + "y_stretch%end": 1.2 * D0, "stretch_z": "T", "a_z": 20, - "z_a": -0.0 * D0, - "z_b": 1.2 * D0, + "z_stretch%beg": -0.0 * D0, + "z_stretch%end": 1.2 * D0, "m": Nx, "n": Ny, "p": Nz, diff --git a/examples/3D_sphbubcollapse/case.py b/examples/3D_sphbubcollapse/case.py index d22975494b..95b92135d2 100644 --- a/examples/3D_sphbubcollapse/case.py +++ b/examples/3D_sphbubcollapse/case.py @@ -23,16 +23,16 @@ # away from the bubble / origin "stretch_x": "T", "a_x": 4.0e00, - "x_a": -1.5e-03 / 1.0e-03, - "x_b": 1.5e-03 / 1.0e-03, + "x_stretch%beg": -1.5e-03 / 1.0e-03, + "x_stretch%end": 1.5e-03 / 1.0e-03, "stretch_y": "T", "a_y": 4.0e00, - "y_a": -1.5e-03 / 1.0e-03, - "y_b": 1.5e-03 / 1.0e-03, + "y_stretch%beg": -1.5e-03 / 1.0e-03, + "y_stretch%end": 1.5e-03 / 1.0e-03, "stretch_z": "T", "a_z": 4.0e00, - "z_a": -1.5e-03 / 1.0e-03, - "z_b": 1.5e-03 / 1.0e-03, + "z_stretch%beg": -1.5e-03 / 1.0e-03, + "z_stretch%end": 1.5e-03 / 1.0e-03, "cyl_coord": "F", "m": 99, "n": 99, diff --git a/examples/3D_turb_mixing/case.py b/examples/3D_turb_mixing/case.py index f4b8a0c486..5ef0adc43b 100644 --- a/examples/3D_turb_mixing/case.py +++ b/examples/3D_turb_mixing/case.py @@ -54,8 +54,8 @@ "y_domain%end": Ly / 2.0, "stretch_y": "T", "a_y": 2, - "y_a": -0.3 * Ly, - "y_b": 0.3 * Ly, + "y_stretch%beg": -0.3 * Ly, + "y_stretch%end": 0.3 * Ly, "loops_y": 2, "z_domain%beg": 0.0, "z_domain%end": Lz, diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index c06090472e..489dfd2c06 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -175,6 +175,12 @@ module m_derived_types real(wp) :: end end type bounds_info + !> Derived type grouping body force parameters for one coordinate direction + type body_force_axis + real(wp) :: k, w, p, g + logical :: enabled + end type body_force_axis + !> Defines parameters for a Model Patch type ic_model_parameters character(LEN=pathlen_max) :: filepath !< Path the STL file relative to case_dir. diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index d4ee7d690b..17b7f2397a 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -46,11 +46,10 @@ module m_global_parameters real(wp) :: dx, dy, dz !< Minimum cell-widths in the x-, y- and z-coordinate directions type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions logical :: stretch_x, stretch_y, stretch_z !< Grid stretching flags for the x-, y- and z-coordinate directions - ! Grid stretching: a_x/a_y/a_z = rate, x_a/y_a/z_a = location - real(wp) :: a_x, a_y, a_z - integer :: loops_x, loops_y, loops_z - real(wp) :: x_a, y_a, z_a - real(wp) :: x_b, y_b, z_b + ! Grid stretching: a_x/a_y/a_z = rate, x_stretch%beg/end = locations + real(wp) :: a_x, a_y, a_z + integer :: loops_x, loops_y, loops_z + type(bounds_info) :: x_stretch, y_stretch, z_stretch ! Simulation Algorithm Parameters integer :: model_eqns !< Multicomponent flow model @@ -230,12 +229,12 @@ contains loops_x = 1 loops_y = 1 loops_z = 1 - x_a = dflt_real - x_b = dflt_real - y_a = dflt_real - y_b = dflt_real - z_a = dflt_real - z_b = dflt_real + x_stretch%beg = dflt_real + x_stretch%end = dflt_real + y_stretch%beg = dflt_real + y_stretch%end = dflt_real + z_stretch%beg = dflt_real + z_stretch%end = dflt_real ! Simulation algorithm parameters model_eqns = dflt_int diff --git a/src/pre_process/m_grid.f90 b/src/pre_process/m_grid.f90 index ce8d9b279b..9abed16500 100644 --- a/src/pre_process/m_grid.f90 +++ b/src/pre_process/m_grid.f90 @@ -51,13 +51,13 @@ impure subroutine s_generate_serial_grid if (stretch_x) then length = abs(x%cb(m) - x%cb(-1)) x%cb = x%cb/length - x_a = x_a/length - x_b = x_b/length + x_stretch%beg = x_stretch%beg/length + x_stretch%end = x_stretch%end/length do j = 1, loops_x do i = -1, m - x%cb(i) = x%cb(i)/a_x*(a_x + log(cosh(a_x*(x%cb(i) - x_a))) + log(cosh(a_x*(x%cb(i) - x_b))) & - & - 2._wp*log(cosh(a_x*(x_b - x_a)/2._wp))) + x%cb(i) = x%cb(i)/a_x*(a_x + log(cosh(a_x*(x%cb(i) - x_stretch%beg))) + log(cosh(a_x*(x%cb(i) - x_stretch%end) & + & )) - 2._wp*log(cosh(a_x*(x_stretch%end - x_stretch%beg)/2._wp))) end do end do x%cb = x%cb*length @@ -98,13 +98,13 @@ impure subroutine s_generate_serial_grid if (stretch_y) then length = abs(y%cb(n) - y%cb(-1)) y%cb = y%cb/length - y_a = y_a/length - y_b = y_b/length + y_stretch%beg = y_stretch%beg/length + y_stretch%end = y_stretch%end/length do j = 1, loops_y do i = -1, n - y%cb(i) = y%cb(i)/a_y*(a_y + log(cosh(a_y*(y%cb(i) - y_a))) + log(cosh(a_y*(y%cb(i) - y_b))) & - & - 2._wp*log(cosh(a_y*(y_b - y_a)/2._wp))) + y%cb(i) = y%cb(i)/a_y*(a_y + log(cosh(a_y*(y%cb(i) - y_stretch%beg))) + log(cosh(a_y*(y%cb(i) - y_stretch%end) & + & )) - 2._wp*log(cosh(a_y*(y_stretch%end - y_stretch%beg)/2._wp))) end do end do @@ -132,13 +132,13 @@ impure subroutine s_generate_serial_grid if (stretch_z) then length = abs(z%cb(p) - z%cb(-1)) z%cb = z%cb/length - z_a = z_a/length - z_b = z_b/length + z_stretch%beg = z_stretch%beg/length + z_stretch%end = z_stretch%end/length do j = 1, loops_z do i = -1, p - z%cb(i) = z%cb(i)/a_z*(a_z + log(cosh(a_z*(z%cb(i) - z_a))) + log(cosh(a_z*(z%cb(i) - z_b))) & - & - 2._wp*log(cosh(a_z*(z_b - z_a)/2._wp))) + z%cb(i) = z%cb(i)/a_z*(a_z + log(cosh(a_z*(z%cb(i) - z_stretch%beg))) + log(cosh(a_z*(z%cb(i) - z_stretch%end) & + & )) - 2._wp*log(cosh(a_z*(z_stretch%end - z_stretch%beg)/2._wp))) end do end do @@ -180,13 +180,13 @@ impure subroutine s_generate_parallel_grid x_cb_glb = x_cb_glb/length - x_a = x_a/length - x_b = x_b/length + x_stretch%beg = x_stretch%beg/length + x_stretch%end = x_stretch%end/length do j = 1, loops_x do i = -1, m_glb - x_cb_glb(i) = x_cb_glb(i)/a_x*(a_x + log(cosh(a_x*(x_cb_glb(i) - x_a))) + log(cosh(a_x*(x_cb_glb(i) - x_b))) & - & - 2._wp*log(cosh(a_x*(x_b - x_a)/2._wp))) + x_cb_glb(i) = x_cb_glb(i)/a_x*(a_x + log(cosh(a_x*(x_cb_glb(i) - x_stretch%beg))) + log(cosh(a_x*(x_cb_glb(i) & + & - x_stretch%end))) - 2._wp*log(cosh(a_x*(x_stretch%end - x_stretch%beg)/2._wp))) end do end do @@ -214,13 +214,14 @@ impure subroutine s_generate_parallel_grid y_cb_glb = y_cb_glb/length - y_a = y_a/length - y_b = y_b/length + y_stretch%beg = y_stretch%beg/length + y_stretch%end = y_stretch%end/length do j = 1, loops_y do i = -1, n_glb - y_cb_glb(i) = y_cb_glb(i)/a_y*(a_y + log(cosh(a_y*(y_cb_glb(i) - y_a))) + log(cosh(a_y*(y_cb_glb(i) - y_b) & - & )) - 2._wp*log(cosh(a_y*(y_b - y_a)/2._wp))) + y_cb_glb(i) = y_cb_glb(i)/a_y*(a_y + log(cosh(a_y*(y_cb_glb(i) - y_stretch%beg))) & + & + log(cosh(a_y*(y_cb_glb(i) - y_stretch%end))) - 2._wp*log(cosh(a_y*(y_stretch%end & + & - y_stretch%beg)/2._wp))) end do end do @@ -238,13 +239,14 @@ impure subroutine s_generate_parallel_grid length = abs(z_cb_glb(p_glb) - z_cb_glb(-1)) z_cb_glb = z_cb_glb/length - z_a = z_a/length - z_b = z_b/length + z_stretch%beg = z_stretch%beg/length + z_stretch%end = z_stretch%end/length do j = 1, loops_z do i = -1, p_glb - z_cb_glb(i) = z_cb_glb(i)/a_z*(a_z + log(cosh(a_z*(z_cb_glb(i) - z_a))) + log(cosh(a_z*(z_cb_glb(i) & - & - z_b))) - 2._wp*log(cosh(a_z*(z_b - z_a)/2._wp))) + z_cb_glb(i) = z_cb_glb(i)/a_z*(a_z + log(cosh(a_z*(z_cb_glb(i) - z_stretch%beg))) & + & + log(cosh(a_z*(z_cb_glb(i) - z_stretch%end))) - 2._wp*log(cosh(a_z*(z_stretch%end & + & - z_stretch%beg)/2._wp))) end do end do diff --git a/src/pre_process/m_mpi_proxy.fpp b/src/pre_process/m_mpi_proxy.fpp index cad964ace4..4893855e71 100644 --- a/src/pre_process/m_mpi_proxy.fpp +++ b/src/pre_process/m_mpi_proxy.fpp @@ -52,9 +52,10 @@ contains #:endfor call MPI_BCAST(fluid_rho(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr) - #:for VAR in [ 'x_domain%beg', 'x_domain%end', 'y_domain%beg', & - & 'y_domain%end', 'z_domain%beg', 'z_domain%end', 'a_x', 'a_y', & - & 'a_z', 'x_a', 'x_b', 'y_a', 'y_b', 'z_a', 'z_b', 'bc_x%beg', & + #:for VAR in [ 'x_domain%beg', 'x_domain%end', 'y_domain%beg', & + & 'y_domain%end', 'z_domain%beg', 'z_domain%end', 'a_x', 'a_y', & + & 'a_z', 'x_stretch%beg', 'x_stretch%end', 'y_stretch%beg', 'y_stretch%end', & + & 'z_stretch%beg', 'z_stretch%end', 'bc_x%beg', & & 'bc_x%end', 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', & & 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', & & 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV', 'palpha_eps', & diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index 593e71d60a..c4d33bc25b 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -75,7 +75,7 @@ contains character(len=1000) :: line namelist /user_inputs/ case_dir, old_grid, old_ic, t_step_old, t_step_start, m, n, p, x_domain, y_domain, z_domain, & - & stretch_x, stretch_y, stretch_z, a_x, a_y, a_z, x_a, y_a, z_a, x_b, y_b, z_b, model_eqns, num_fluids, mpp_lim, & + & stretch_x, stretch_y, stretch_z, a_x, a_y, a_z, x_stretch, y_stretch, z_stretch, model_eqns, num_fluids, mpp_lim, & & weno_order, bc_x, bc_y, bc_z, num_patches, hypoelasticity, mhd, patch_icpp, fluid_pp, bub_pp, precision, & & parallel_io, mixlayer_vel_profile, mixlayer_vel_coef, mixlayer_perturb, mixlayer_perturb_nk, mixlayer_perturb_k0, & & pi_fac, perturb_flow, perturb_flow_fluid, perturb_flow_mag, perturb_sph, perturb_sph_fluid, fluid_rho, cyl_coord, & diff --git a/src/simulation/m_body_forces.fpp b/src/simulation/m_body_forces.fpp index fb5320f09e..abbad139a1 100644 --- a/src/simulation/m_body_forces.fpp +++ b/src/simulation/m_body_forces.fpp @@ -45,8 +45,8 @@ contains real(wp), intent(in) :: t #:for DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] - if (bf_${XYZ}$) then - accel_bf(${DIR}$) = g_${XYZ}$ + k_${XYZ}$*sin(w_${XYZ}$*t - p_${XYZ}$) + if (bf_${XYZ}$%enabled) then + accel_bf(${DIR}$) = bf_${XYZ}$%g + bf_${XYZ}$%k*sin(bf_${XYZ}$%w*t - bf_${XYZ}$%p) end if #:endfor @@ -98,7 +98,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (bf_x) then ! x-direction body forces + if (bf_x%enabled) then ! x-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p @@ -113,7 +113,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bf_y) then ! y-direction body forces + if (bf_y%enabled) then ! y-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p @@ -129,7 +129,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bf_z) then ! z-direction body forces + if (bf_z%enabled) then ! z-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index b8a756640f..23bc64a09d 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -161,27 +161,20 @@ module m_global_parameters real(wp) :: ic_eps !< THINC Epsilon to compress on surface cells real(wp) :: ic_beta !< THINC Sharpness Parameter $:GPU_DECLARE(create='[int_comp, ic_eps, ic_beta]') - integer :: hyper_model !< hyperelasticity solver algorithm - logical :: elasticity !< elasticity modeling, true for hyper or hypo - logical, parameter :: chemistry = .${chemistry}$. !< Chemistry modeling - logical :: shear_stress !< Shear stresses - logical :: bulk_stress !< Bulk stresses - logical :: cont_damage !< Continuum damage modeling - logical :: hyper_cleaning !< Hyperbolic cleaning for MHD for divB=0 - integer :: num_igr_iters !< number of iterations for elliptic solve - integer :: num_igr_warm_start_iters !< number of warm start iterations for elliptic solve - real(wp) :: alf_factor !< alpha factor for IGR - logical :: bodyForces - logical :: bf_x, bf_y, bf_z !< body force toggle in three directions - !> amplitude, frequency, and phase shift sinusoid in each direction - #:for dir in {'x', 'y', 'z'} - #:for param in {'k','w','p','g'} - real(wp) :: ${param}$_${dir}$ - #:endfor - #:endfor + integer :: hyper_model !< hyperelasticity solver algorithm + logical :: elasticity !< elasticity modeling, true for hyper or hypo + logical, parameter :: chemistry = .${chemistry}$. !< Chemistry modeling + logical :: shear_stress !< Shear stresses + logical :: bulk_stress !< Bulk stresses + logical :: cont_damage !< Continuum damage modeling + logical :: hyper_cleaning !< Hyperbolic cleaning for MHD for divB=0 + integer :: num_igr_iters !< number of iterations for elliptic solve + integer :: num_igr_warm_start_iters !< number of warm start iterations for elliptic solve + real(wp) :: alf_factor !< alpha factor for IGR + logical :: bodyForces + type(body_force_axis) :: bf_x, bf_y, bf_z !< body force parameters per direction real(wp), dimension(3) :: accel_bf $:GPU_DECLARE(create='[accel_bf]') - ! $:GPU_DECLARE(create='[k_x,w_x,p_x,g_x,k_y,w_y,p_y,g_y,k_z,w_z,p_z,g_z]') integer :: cpu_start, cpu_end, cpu_rate @@ -227,12 +220,11 @@ module m_global_parameters #endif type(bounds_info) :: x_domain, y_domain, z_domain $:GPU_DECLARE(create='[x_domain, y_domain, z_domain]') - real(wp) :: x_a, y_a, z_a - real(wp) :: x_b, y_b, z_b - logical :: parallel_io !< Format of the data files - logical :: file_per_process !< shared file or not when using parallel io - integer :: precision !< Precision of output files - logical :: down_sample !< down sample the output files + type(bounds_info) :: x_stretch, y_stretch, z_stretch + logical :: parallel_io !< Format of the data files + logical :: file_per_process !< shared file or not when using parallel io + integer :: precision !< Precision of output files + logical :: down_sample !< down sample the output files $:GPU_DECLARE(create='[down_sample]') integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM @@ -680,13 +672,10 @@ contains surface_tension = .false. bodyForces = .false. - bf_x = .false.; bf_y = .false.; bf_z = .false. - !> amplitude, frequency, and phase shift sinusoid in each direction - #:for dir in {'x', 'y', 'z'} - #:for param in {'k','w','p','g'} - ${param}$_${dir}$ = dflt_real - #:endfor - #:endfor + bf_x%enabled = .false.; bf_y%enabled = .false.; bf_z%enabled = .false. + bf_x%k = 0._wp; bf_x%w = 0._wp; bf_x%p = 0._wp; bf_x%g = 0._wp + bf_y%k = 0._wp; bf_y%w = 0._wp; bf_y%p = 0._wp; bf_y%g = 0._wp + bf_z%k = 0._wp; bf_z%w = 0._wp; bf_z%p = 0._wp; bf_z%g = 0._wp fft_wrt = .false. dummy = .false. diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 8103f28d72..048ac14933 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -1017,13 +1017,13 @@ contains ! consider body forces after reducing to avoid double counting do i = 1, num_ibs - if (bf_x) then + if (bf_x%enabled) then forces(i, 1) = forces(i, 1) + accel_bf(1)*patch_ib(i)%mass end if - if (bf_y) then + if (bf_y%enabled) then forces(i, 2) = forces(i, 2) + accel_bf(2)*patch_ib(i)%mass end if - if (bf_z) then + if (bf_z%enabled) then forces(i, 3) = forces(i, 3) + accel_bf(3)*patch_ib(i)%mass end if end do diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index b3c7cb6f49..1aa7fad220 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -63,8 +63,9 @@ contains call MPI_BCAST(case_dir, len(case_dir), MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) - #:for VAR in ['k_x', 'k_y', 'k_z', 'w_x', 'w_y', 'w_z', 'p_x', 'p_y', & - & 'p_z', 'g_x', 'g_y', 'g_z'] + #:for VAR in ['bf_x%k', 'bf_x%w', 'bf_x%p', 'bf_x%g', & + & 'bf_y%k', 'bf_y%w', 'bf_y%p', 'bf_y%g', & + & 'bf_z%k', 'bf_z%w', 'bf_z%p', 'bf_z%g'] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor @@ -86,7 +87,7 @@ contains & 'parallel_io', 'hypoelasticity', 'bubbles_euler', 'polytropic', & & 'polydisperse', 'qbmm', 'acoustic_source', 'probe_wrt', 'integral_wrt', & & 'prim_vars_wrt', 'weno_avg', 'file_per_process', 'relax', & - & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf_x', 'bf_y', 'bf_z', & + & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf_x%enabled', 'bf_y%enabled', 'bf_z%enabled', & & 'bc_x%grcbc_in', 'bc_x%grcbc_out', 'bc_x%grcbc_vel_out', & & 'bc_y%grcbc_in', 'bc_y%grcbc_out', 'bc_y%grcbc_vel_out', & & 'bc_z%grcbc_in', 'bc_z%grcbc_out', 'bc_z%grcbc_vel_out', & @@ -130,11 +131,12 @@ contains & 'bc_y%vb1','bc_y%vb2','bc_y%vb3','bc_y%ve1','bc_y%ve2','bc_y%ve3', & & 'bc_z%vb1','bc_z%vb2','bc_z%vb3','bc_z%ve1','bc_z%ve2','bc_z%ve3', & & 'bc_x%pres_in','bc_x%pres_out','bc_y%pres_in','bc_y%pres_out', 'bc_z%pres_in','bc_z%pres_out', & - & 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', & - & 'z_domain%beg', 'z_domain%end', 'x_a', 'x_b', 'y_a', 'y_b', 'z_a', & - & 'bc_x%Twall_in', 'bc_x%Twall_out', 'bc_y%Twall_in', 'bc_y%Twall_out', & + & 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', & + & 'z_domain%beg', 'z_domain%end', 'x_stretch%beg', 'x_stretch%end', & + & 'y_stretch%beg', 'y_stretch%end', 'z_stretch%beg', 'z_stretch%end', & + & 'bc_x%Twall_in', 'bc_x%Twall_out', 'bc_y%Twall_in', 'bc_y%Twall_out', & & 'bc_z%Twall_in', 'bc_z%Twall_out', & - & 'z_b', 't_stop', 't_save', 'cfl_target', 'Bx0', 'alf_factor', & + & 't_stop', 't_save', 'cfl_target', 'Bx0', 'alf_factor', & & 'tau_star', 'cont_damage_s', 'alpha_bar', 'adap_dt_tol', & & 'ic_eps', 'ic_beta', 'hyper_cleaning_speed', & & 'hyper_cleaning_tau', 'coefficient_of_restitution', 'collision_time', & diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index bc2796e776..3e8c99e84d 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -88,7 +88,7 @@ contains rdma_mpi, teno_CT, mp_weno, weno_avg, & riemann_solver, low_Mach, wave_speeds, avg_state, & bc_x, bc_y, bc_z, & - x_a, y_a, z_a, x_b, y_b, z_b, & + x_stretch, y_stretch, z_stretch, & x_domain, y_domain, z_domain, & hypoelasticity, & ib, num_ibs, patch_ib, & @@ -108,11 +108,11 @@ contains #:endif Ca, Web, Re_inv, acoustic_source, acoustic, num_source, polytropic, thermal, integral, integral_wrt, num_integrals, & & polydisperse, poly_sigma, qbmm, relax, relax_model, palpha_eps, ptgalpha_eps, file_per_process, sigma, pi_fac, & - & adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, bf_x, bf_y, bf_z, k_x, k_y, k_z, w_x, w_y, w_z, p_x, p_y, p_z, g_x, & - & g_y, g_z, n_start, t_save, t_stop, cfl_adap_dt, cfl_const_dt, cfl_target, surface_tension, bubbles_lagrange, & - & lag_params, hyperelasticity, R0ref, num_bc_patches, Bx0, cont_damage, tau_star, cont_damage_s, alpha_bar, & - & hyper_cleaning, hyper_cleaning_speed, hyper_cleaning_tau, alf_factor, num_igr_iters, num_igr_warm_start_iters, & - & int_comp, ic_eps, ic_beta, nv_uvm_out_of_core, nv_uvm_igr_temps_on_gpu, nv_uvm_pref_gpu, down_sample, fft_wrt + & adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, bf_x, bf_y, bf_z, n_start, t_save, t_stop, cfl_adap_dt, & + & cfl_const_dt, cfl_target, surface_tension, bubbles_lagrange, lag_params, hyperelasticity, R0ref, num_bc_patches, & + & Bx0, cont_damage, tau_star, cont_damage_s, alpha_bar, hyper_cleaning, hyper_cleaning_speed, hyper_cleaning_tau, & + & alf_factor, num_igr_iters, num_igr_warm_start_iters, int_comp, ic_eps, ic_beta, nv_uvm_out_of_core, & + & nv_uvm_igr_temps_on_gpu, nv_uvm_pref_gpu, down_sample, fft_wrt inquire (FILE=trim(file_path), EXIST=file_exist) @@ -129,7 +129,7 @@ contains close (1) - if ((bf_x) .or. (bf_y) .or. (bf_z)) then + if (bf_x%enabled .or. bf_y%enabled .or. bf_z%enabled) then bodyForces = .true. end if diff --git a/toolchain/mfc/case_validator.py b/toolchain/mfc/case_validator.py index 05a3fee92c..30a0d3c577 100644 --- a/toolchain/mfc/case_validator.py +++ b/toolchain/mfc/case_validator.py @@ -1300,15 +1300,15 @@ def check_grid_stretching(self): continue a = self.get(f"a_{direction}") - coord_a = self.get(f"{direction}_a") - coord_b = self.get(f"{direction}_b") + coord_a = self.get(f"{direction}_stretch%beg") + coord_b = self.get(f"{direction}_stretch%end") self.prohibit(old_grid, f"old_grid and stretch_{direction} are incompatible") self.prohibit(a is None, f"a_{direction} must be set with stretch_{direction} enabled") - self.prohibit(coord_a is None, f"{direction}_a must be set with stretch_{direction} enabled") - self.prohibit(coord_b is None, f"{direction}_b must be set with stretch_{direction} enabled") + self.prohibit(coord_a is None, f"{direction}_stretch%%beg must be set with stretch_{direction} enabled") + self.prohibit(coord_b is None, f"{direction}_stretch%%end must be set with stretch_{direction} enabled") if coord_a is not None and coord_b is not None: - self.prohibit(coord_a >= coord_b, f"{direction}_a must be less than {direction}_b with stretch_{direction} enabled") + self.prohibit(coord_a >= coord_b, f"{direction}_stretch%%beg must be less than {direction}_stretch%%end with stretch_{direction} enabled") def check_perturb_density(self): """Checks initial partial density perturbation constraints (pre-process)""" diff --git a/toolchain/mfc/params/definitions.py b/toolchain/mfc/params/definitions.py index c8db5547d0..737d701d89 100644 --- a/toolchain/mfc/params/definitions.py +++ b/toolchain/mfc/params/definitions.py @@ -171,12 +171,12 @@ def _fc(name: str, default: int) -> int: "a_x": "Grid stretching rate in x", "a_y": "Grid stretching rate in y", "a_z": "Grid stretching rate in z", - "x_a": "Stretching start (negative x)", - "x_b": "Stretching start (positive x)", - "y_a": "Stretching start (negative y)", - "y_b": "Stretching start (positive y)", - "z_a": "Stretching start (negative z)", - "z_b": "Stretching start (positive z)", + "x_stretch%beg": "Stretching start (negative x)", + "x_stretch%end": "Stretching start (positive x)", + "y_stretch%beg": "Stretching start (negative y)", + "y_stretch%end": "Stretching start (positive y)", + "z_stretch%beg": "Stretching start (negative z)", + "z_stretch%end": "Stretching start (positive z)", "loops_x": "Stretching iterations in x", "loops_y": "Stretching iterations in y", "loops_z": "Stretching iterations in z", @@ -268,21 +268,21 @@ def _fc(name: str, default: int) -> int: "format": "Output format", "precision": "Output precision", # Body forces - "bf_x": "Enable body force in x", - "bf_y": "Enable body force in y", - "bf_z": "Enable body force in z", - "k_x": "Body force wavenumber in x", - "k_y": "Body force wavenumber in y", - "k_z": "Body force wavenumber in z", - "w_x": "Body force frequency in x", - "w_y": "Body force frequency in y", - "w_z": "Body force frequency in z", - "p_x": "Body force phase in x", - "p_y": "Body force phase in y", - "p_z": "Body force phase in z", - "g_x": "Gravitational acceleration in x", - "g_y": "Gravitational acceleration in y", - "g_z": "Gravitational acceleration in z", + "bf_x%enabled": "Enable body force in x", + "bf_y%enabled": "Enable body force in y", + "bf_z%enabled": "Enable body force in z", + "bf_x%k": "Body force wavenumber in x", + "bf_y%k": "Body force wavenumber in y", + "bf_z%k": "Body force wavenumber in z", + "bf_x%w": "Body force frequency in x", + "bf_y%w": "Body force frequency in y", + "bf_z%w": "Body force frequency in z", + "bf_x%p": "Body force phase in x", + "bf_y%p": "Body force phase in y", + "bf_z%p": "Body force phase in z", + "bf_x%g": "Gravitational acceleration in x", + "bf_y%g": "Gravitational acceleration in y", + "bf_z%g": "Gravitational acceleration in z", # More output "E_wrt": "Write energy field", "c_wrt": "Write sound speed field", @@ -744,32 +744,32 @@ def get_value_label(param_name: str, value: int) -> str: }, "stretch_x": { "when_true": { - "requires": ["a_x", "x_a", "x_b"], + "requires": ["a_x", "x_stretch%beg", "x_stretch%end"], } }, "stretch_y": { "when_true": { - "requires": ["a_y", "y_a", "y_b"], + "requires": ["a_y", "y_stretch%beg", "y_stretch%end"], } }, "stretch_z": { "when_true": { - "requires": ["a_z", "z_a", "z_b"], + "requires": ["a_z", "z_stretch%beg", "z_stretch%end"], } }, - "bf_x": { + "bf_x%enabled": { "when_true": { - "requires": ["k_x", "w_x", "p_x", "g_x"], + "requires": ["bf_x%k", "bf_x%w", "bf_x%p", "bf_x%g"], } }, - "bf_y": { + "bf_y%enabled": { "when_true": { - "requires": ["k_y", "w_y", "p_y", "g_y"], + "requires": ["bf_y%k", "bf_y%w", "bf_y%p", "bf_y%g"], } }, - "bf_z": { + "bf_z%enabled": { "when_true": { - "requires": ["k_z", "w_z", "p_z", "g_z"], + "requires": ["bf_z%k", "bf_z%w", "bf_z%p", "bf_z%g"], } }, "teno": { @@ -854,8 +854,8 @@ def _load(): for n in ["stretch_x", "stretch_y", "stretch_z"]: _r(n, LOG, {"grid"}) for d in ["x", "y", "z"]: - _r(f"{d}_a", REAL, {"grid"}) - _r(f"{d}_b", REAL, {"grid"}) + _r(f"{d}_stretch%beg", REAL, {"grid"}) + _r(f"{d}_stretch%end", REAL, {"grid"}) _r(f"a_{d}", REAL, {"grid"}) _r(f"loops_{d}", INT, {"grid"}) _r(f"{d}_domain%beg", REAL, {"grid"}) @@ -1076,11 +1076,11 @@ def _load(): # Body force for d in ["x", "y", "z"]: - _r(f"g_{d}", REAL, math=r"\f$g_" + d + r"\f$") - _r(f"k_{d}", REAL, math=r"\f$k_" + d + r"\f$") - _r(f"w_{d}", REAL, math=r"\f$\omega_" + d + r"\f$") - _r(f"p_{d}", REAL, math=r"\f$\phi_" + d + r"\f$") - _r(f"bf_{d}", LOG) + _r(f"bf_{d}%g", REAL, math=r"\f$g_" + d + r"\f$") + _r(f"bf_{d}%k", REAL, math=r"\f$k_" + d + r"\f$") + _r(f"bf_{d}%w", REAL, math=r"\f$\omega_" + d + r"\f$") + _r(f"bf_{d}%p", REAL, math=r"\f$\phi_" + d + r"\f$") + _r(f"bf_{d}%enabled", LOG) # INDEXED PARAMETERS diff --git a/toolchain/mfc/params/descriptions.py b/toolchain/mfc/params/descriptions.py index 8ceab7f96c..630085bade 100644 --- a/toolchain/mfc/params/descriptions.py +++ b/toolchain/mfc/params/descriptions.py @@ -26,12 +26,12 @@ "a_x": "Rate of grid stretching in the x-direction", "a_y": "Rate of grid stretching in the y-direction", "a_z": "Rate of grid stretching in the z-direction", - "x_a": "Start of stretching in negative x-direction", - "x_b": "Start of stretching in positive x-direction", - "y_a": "Start of stretching in negative y-direction", - "y_b": "Start of stretching in positive y-direction", - "z_a": "Start of stretching in negative z-direction", - "z_b": "Start of stretching in positive z-direction", + "x_stretch%beg": "Start of stretching in negative x-direction", + "x_stretch%end": "Start of stretching in positive x-direction", + "y_stretch%beg": "Start of stretching in negative y-direction", + "y_stretch%end": "Start of stretching in positive y-direction", + "z_stretch%beg": "Start of stretching in negative z-direction", + "z_stretch%end": "Start of stretching in positive z-direction", "loops_x": "Number of times to apply grid stretching in x", "loops_y": "Number of times to apply grid stretching in y", "loops_z": "Number of times to apply grid stretching in z", @@ -214,21 +214,21 @@ "lag_header": "Enable Lagrangian output header", "chem_wrt_T": "Write temperature field for chemistry", # Body force parameters - "bf_x": "Enable body force in x-direction", - "bf_y": "Enable body force in y-direction", - "bf_z": "Enable body force in z-direction", - "g_x": "Body force magnitude in x-direction", - "g_y": "Body force magnitude in y-direction", - "g_z": "Body force magnitude in z-direction", - "k_x": "Body force wavenumber in x-direction", - "k_y": "Body force wavenumber in y-direction", - "k_z": "Body force wavenumber in z-direction", - "w_x": "Body force frequency in x-direction", - "w_y": "Body force frequency in y-direction", - "w_z": "Body force frequency in z-direction", - "p_x": "Body force phase in x-direction", - "p_y": "Body force phase in y-direction", - "p_z": "Body force phase in z-direction", + "bf_x%enabled": "Enable body force in x-direction", + "bf_y%enabled": "Enable body force in y-direction", + "bf_z%enabled": "Enable body force in z-direction", + "bf_x%g": "Body force magnitude in x-direction", + "bf_y%g": "Body force magnitude in y-direction", + "bf_z%g": "Body force magnitude in z-direction", + "bf_x%k": "Body force wavenumber in x-direction", + "bf_y%k": "Body force wavenumber in y-direction", + "bf_z%k": "Body force wavenumber in z-direction", + "bf_x%w": "Body force frequency in x-direction", + "bf_y%w": "Body force frequency in y-direction", + "bf_z%w": "Body force frequency in z-direction", + "bf_x%p": "Body force phase in x-direction", + "bf_y%p": "Body force phase in y-direction", + "bf_z%p": "Body force phase in z-direction", # Output flags "mom_wrt": "Write momentum to database", "flux_wrt": "Write flux data", diff --git a/toolchain/mfc/params/namelist_parser.py b/toolchain/mfc/params/namelist_parser.py index 52385255d3..b013807583 100644 --- a/toolchain/mfc/params/namelist_parser.py +++ b/toolchain/mfc/params/namelist_parser.py @@ -115,14 +115,14 @@ "thermal", "viscous", "weno_order", - "x_a", - "x_b", + "x_stretch%beg", + "x_stretch%end", "x_domain", - "y_a", - "y_b", + "y_stretch%beg", + "y_stretch%end", "y_domain", - "z_a", - "z_b", + "z_stretch%beg", + "z_stretch%end", "z_domain", }, "simulation": { @@ -144,9 +144,9 @@ "bc_x", "bc_y", "bc_z", - "bf_x", - "bf_y", - "bf_z", + "bf_x%enabled", + "bf_y%enabled", + "bf_z%enabled", "bub_pp", "bubble_model", "bubbles_euler", @@ -165,9 +165,9 @@ "fft_wrt", "file_per_process", "fluid_pp", - "g_x", - "g_y", - "g_z", + "bf_x%g", + "bf_y%g", + "bf_z%g", "hyper_cleaning", "hyper_cleaning_speed", "hyper_cleaning_tau", @@ -184,9 +184,9 @@ "int_comp", "integral", "integral_wrt", - "k_x", - "k_y", - "k_z", + "bf_x%k", + "bf_y%k", + "bf_z%k", "lag_params", "low_Mach", "m", @@ -214,9 +214,9 @@ "nv_uvm_out_of_core", "nv_uvm_pref_gpu", "p", - "p_x", - "p_y", - "p_z", + "bf_x%p", + "bf_y%p", + "bf_z%p", "palpha_eps", "parallel_io", "patch_ib", @@ -254,9 +254,9 @@ "thermal", "time_stepper", "viscous", - "w_x", - "w_y", - "w_z", + "bf_x%w", + "bf_y%w", + "bf_z%w", "wave_speeds", "weno_Re_flux", "weno_avg", @@ -264,14 +264,14 @@ "weno_order", "wenoz", "wenoz_q", - "x_a", - "x_b", + "x_stretch%beg", + "x_stretch%end", "x_domain", - "y_a", - "y_b", + "y_stretch%beg", + "y_stretch%end", "y_domain", - "z_a", - "z_b", + "z_stretch%beg", + "z_stretch%end", "z_domain", }, "post_process": { diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index b72584a032..30e9d4a166 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -1186,13 +1186,13 @@ def alter_hypoelasticity(dimInfo): def alter_body_forces(dimInfo): ndims = len(dimInfo[0]) - stack.push("Bodyforces", {"bf_x": "T", "k_x": 1, "w_x": 1, "p_x": 1, "g_x": 10}) + stack.push("Bodyforces", {"bf_x%enabled": "T", "bf_x%k": 1, "bf_x%w": 1, "bf_x%p": 1, "bf_x%g": 10}) if ndims >= 2: - stack.push("", {"bf_y": "T", "k_y": 1, "w_y": 1, "p_y": 1, "g_y": 10}) + stack.push("", {"bf_y%enabled": "T", "bf_y%k": 1, "bf_y%w": 1, "bf_y%p": 1, "bf_y%g": 10}) if ndims == 3: - stack.push("", {"bf_z": "T", "k_z": 1, "w_z": 1, "p_z": 1, "g_z": 10}) + stack.push("", {"bf_z%enabled": "T", "bf_z%k": 1, "bf_z%w": 1, "bf_z%p": 1, "bf_z%g": 10}) cases.append(define_case_d(stack, "", {})) @@ -2291,18 +2291,18 @@ def kernel_golden_tests(): **base_3d, "stretch_x": "T", "a_x": 2.0, - "x_a": 0.3, - "x_b": 0.7, + "x_stretch%beg": 0.3, + "x_stretch%end": 0.7, "loops_x": 1, "stretch_y": "T", "a_y": 2.0, - "y_a": 0.3, - "y_b": 0.7, + "y_stretch%beg": 0.3, + "y_stretch%end": 0.7, "loops_y": 1, "stretch_z": "T", "a_z": 2.0, - "z_a": 0.3, - "z_b": 0.7, + "z_stretch%beg": 0.3, + "z_stretch%end": 0.7, "loops_z": 1, # Enlarge x/y coverage for all patches (stretched domain reaches ~1.39) "patch_icpp(1)%x_centroid": 0.75, @@ -2381,8 +2381,8 @@ def kernel_golden_tests(): # x-stretching creates non-uniform cells at the bubble interface "stretch_x": "T", "a_x": 2.0, - "x_a": 0.3, - "x_b": 0.7, + "x_stretch%beg": 0.3, + "x_stretch%end": 0.7, "loops_x": 1, }, ) From 13d1297114219a68924b326a27e849b1c29c1726 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 09:29:46 -0500 Subject: [PATCH 03/20] fix: update analytical IC codegen to use x%cc(i) after grid_axis refactor --- toolchain/mfc/case.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/toolchain/mfc/case.py b/toolchain/mfc/case.py index 65c49f8304..21e04b996c 100644 --- a/toolchain/mfc/case.py +++ b/toolchain/mfc/case.py @@ -189,9 +189,9 @@ def __get_analytic_ic_fpp(self, print: bool) -> str: # values from the case file def rhs_replace(match): return { - "x": "x_cc(i)", - "y": "y_cc(j)", - "z": "z_cc(k)", + "x": "x%cc(i)", + "y": "y%cc(j)", + "z": "z%cc(k)", "xc": f"patch_icpp({pid})%x_centroid", "yc": f"patch_icpp({pid})%y_centroid", "zc": f"patch_icpp({pid})%z_centroid", @@ -271,9 +271,9 @@ def __get_analytic_mib_fpp(self, print: bool) -> str: # values from the case file def rhs_replace(match): return { - "x": "x_cc(i)", - "y": "y_cc(j)", - "z": "z_cc(k)", + "x": "x%cc(i)", + "y": "y%cc(j)", + "z": "z%cc(k)", "t": "mytime", "r": f"patch_ib({pid})%radius", "e": f"{math.e}", From cddf79a0c5eea3e542b0bc80e2de1327cf340ac8 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 09:49:15 -0500 Subject: [PATCH 04/20] style: apply ffmt v0.4.0 formatting to refactored files --- src/pre_process/m_assign_variables.fpp | 8 ++--- src/pre_process/m_icpp_patches.fpp | 41 +++++++++++++------------- src/simulation/m_acoustic_src.fpp | 3 +- src/simulation/m_cbc.fpp | 32 ++++++++++---------- src/simulation/m_hypoelastic.fpp | 3 +- src/simulation/m_ibm.fpp | 24 +++++++-------- src/simulation/m_qbmm.fpp | 4 +-- 7 files changed, 56 insertions(+), 59 deletions(-) diff --git a/src/pre_process/m_assign_variables.fpp b/src/pre_process/m_assign_variables.fpp index 67b7497187..1622a92890 100644 --- a/src/pre_process/m_assign_variables.fpp +++ b/src/pre_process/m_assign_variables.fpp @@ -97,15 +97,15 @@ contains do i = 1, eqn_idx%E - eqn_idx%mom%beg q_prim_vf(i + 1)%sf(j, k, l) = 1._wp/q_prim_vf(1)%sf(j, k, & - & l)*(eta*patch_icpp(patch_id)%rho*patch_icpp(patch_id)%vel(i) + (1._wp - eta)*patch_icpp(smooth_patch_id) & - & %rho*patch_icpp(smooth_patch_id)%vel(i)) + & l)*(eta*patch_icpp(patch_id)%rho*patch_icpp(patch_id)%vel(i) + (1._wp - eta) & + & *patch_icpp(smooth_patch_id)%rho*patch_icpp(smooth_patch_id)%vel(i)) end do q_prim_vf(eqn_idx%gamma)%sf(j, k, l) = eta*patch_icpp(patch_id)%gamma + (1._wp - eta)*patch_icpp(smooth_patch_id)%gamma q_prim_vf(eqn_idx%E)%sf(j, k, l) = 1._wp/q_prim_vf(eqn_idx%gamma)%sf(j, k, & - & l)*(eta*patch_icpp(patch_id)%gamma*patch_icpp(patch_id)%pres + (1._wp - eta)*patch_icpp(smooth_patch_id) & - & %gamma*patch_icpp(smooth_patch_id)%pres) + & l)*(eta*patch_icpp(patch_id)%gamma*patch_icpp(patch_id)%pres + (1._wp - eta) & + & *patch_icpp(smooth_patch_id)%gamma*patch_icpp(smooth_patch_id)%pres) q_prim_vf(eqn_idx%pi_inf)%sf(j, k, l) = eta*patch_icpp(patch_id)%pi_inf + (1._wp - eta)*patch_icpp(smooth_patch_id)%pi_inf diff --git a/src/pre_process/m_icpp_patches.fpp b/src/pre_process/m_icpp_patches.fpp index 2e6c12b8f7..2ea6a4bdca 100644 --- a/src/pre_process/m_icpp_patches.fpp +++ b/src/pre_process/m_icpp_patches.fpp @@ -316,8 +316,9 @@ contains & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp end if - if (((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2 <= radius**2 .and. patch_icpp(patch_id) & - & %alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, 0) == smooth_patch_id) then + if (((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2 <= radius**2 & + & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, & + & 0) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -367,8 +368,8 @@ contains do i = 0, m myr = sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp .and. patch_icpp(patch_id) & - & %alter_patch(patch_id_fp(i, j, 0))) then + if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp & + & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -429,8 +430,8 @@ contains do i = 0, m myr = sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp .and. patch_icpp(patch_id) & - & %alter_patch(patch_id_fp(i, j, k))) then + if (myr <= radius + thickness/2._wp .and. myr >= radius - thickness/2._wp & + & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -489,8 +490,9 @@ contains & + 0.5_wp end if - if ((((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2 <= 1._wp .and. patch_icpp(patch_id) & - & %alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, 0) == smooth_patch_id) then + if ((((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2 <= 1._wp & + & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, & + & 0) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, 0, eta, q_prim_vf, patch_id_fp) @:analytical() @@ -558,8 +560,8 @@ contains & - z_centroid)/c)**2) - 1._wp))*(-0.5_wp) + 0.5_wp end if - if ((((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z - z_centroid)/c) & - & **2 <= 1._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & + if ((((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z - z_centroid)/c)**2 <= 1._wp & + & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -634,8 +636,8 @@ contains if ((q_prim_vf(1)%sf(i, j, 0) < 1.e-10) .and. (model_eqns == 4)) then ! zero density, reassign according to Tait EOS q_prim_vf(1)%sf(i, j, 0) = (((q_prim_vf(eqn_idx%E)%sf(i, j, & - & 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))*rhoref*(1._wp - q_prim_vf(eqn_idx%alf) & - & %sf(i, j, 0)) + & 0) + pi_inf)/(pref + pi_inf))**(1._wp/lit_gamma))*rhoref*(1._wp & + & - q_prim_vf(eqn_idx%alf)%sf(i, j, 0)) end if ! Updating the patch identities bookkeeping variable @@ -1067,8 +1069,8 @@ contains cart_z = z%cc(k) end if - if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) & - & .and. y_boundary%beg <= cart_y .and. y_boundary%end >= cart_y .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) then + if (x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i) .and. y_boundary%beg <= cart_y & + & .and. y_boundary%end >= cart_y .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) then if (patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) @@ -1158,12 +1160,11 @@ contains end if end if - if (((.not. f_is_default(length_x) .and. (cart_y - y_centroid)**2 + (cart_z - z_centroid) & - & **2 <= radius**2 .and. x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i)) & - & .or. (.not. f_is_default(length_y) .and. (x%cc(i) - x_centroid)**2 + (cart_z - z_centroid) & - & **2 <= radius**2 .and. y_boundary%beg <= cart_y .and. y_boundary%end >= cart_y) & - & .or. (.not. f_is_default(length_z) .and. (x%cc(i) - x_centroid)**2 + (cart_y - y_centroid) & - & **2 <= radius**2 .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) & + if (((.not. f_is_default(length_x) .and. (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2 & + & .and. x_boundary%beg <= x%cc(i) .and. x_boundary%end >= x%cc(i)) .or. (.not. f_is_default(length_y) & + & .and. (x%cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2 .and. y_boundary%beg <= cart_y & + & .and. y_boundary%end >= cart_y) .or. (.not. f_is_default(length_z) .and. (x%cc(i) - x_centroid)**2 & + & + (cart_y - y_centroid)**2 <= radius**2 .and. z_boundary%beg <= cart_z .and. z_boundary%end >= cart_z) & & .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then call s_assign_patch_primitive_variables(patch_id, i, j, k, eta, q_prim_vf, patch_id_fp) diff --git a/src/simulation/m_acoustic_src.fpp b/src/simulation/m_acoustic_src.fpp index 528095f4b9..01806dd78f 100644 --- a/src/simulation/m_acoustic_src.fpp +++ b/src/simulation/m_acoustic_src.fpp @@ -69,8 +69,7 @@ contains & gauss_sigma_dist(1:num_source), gauss_sigma_time(1:num_source), foc_length(1:num_source), & & aperture(1:num_source), npulse(1:num_source), pulse(1:num_source), dir(1:num_source), delay(1:num_source), & & element_polygon_ratio(1:num_source), rotate_angle(1:num_source), element_spacing_angle(1:num_source), & - & num_elements(1:num_source), element_on(1:num_source), bb_num_freq(1:num_source), bb_bandwidth(1:num_source), & - & bb_lowest_freq(1:num_source)) + & num_elements(1:num_source), element_on(1:num_source), bb_num_freq(1:num_source), bb_bandwidth(1:num_source), bb_lowest_freq(1:num_source)) do i = 1, num_source do j = 1, 3 diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index 86a56be813..565ca6c9b6 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -725,15 +725,15 @@ contains Ma = vel(dir_idx(1))/c - if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SLIP_WALL) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SLIP_WALL)) then + if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SLIP_WALL) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_SLIP_WALL)) then call s_compute_slip_wall_L(lambda, L, rho, c, dpres_ds, dvel_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, dpres_ds, dvel_ds) ! Add GRCBC for Subsonic Inflow if (bc_${XYZ}$%grcbc_in) then @@ -759,8 +759,8 @@ contains & dir_idx(1))*sign(1, & & cbc_loc))/Del_in(${CBC_DIR}$) + c*(1._wp + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) ! Add GRCBC for Subsonic Outflow (Pressure) @@ -773,19 +773,19 @@ contains & + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) end if end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then call s_compute_force_free_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, & & dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then call s_compute_constant_pressure_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_INFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_INFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then call s_compute_supersonic_inflow_L(L) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) & - & .or. (cbc_loc == 1 .and. bc_${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc_${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then call s_compute_supersonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, & & dYs_ds) end if diff --git a/src/simulation/m_hypoelastic.fpp b/src/simulation/m_hypoelastic.fpp index 8165e8f5bc..546cbe572f 100644 --- a/src/simulation/m_hypoelastic.fpp +++ b/src/simulation/m_hypoelastic.fpp @@ -312,8 +312,7 @@ contains ! S_rr -= rho * v/r * (tau_rr + 2/3*G) rhs_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) = rhs_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) - rho_K_field(k, & & l, q)*q_prim_vf(eqn_idx%mom%beg + 1)%sf(k, l, & - & q)/y%cc(l)*(q_prim_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) + (2._wp/3._wp)*G_K_field(k, l, & - & q)) ! tau_rr + 2/3*G + & q)/y%cc(l)*(q_prim_vf(eqn_idx%stress%beg + 2)%sf(k, l, q) + (2._wp/3._wp)*G_K_field(k, l, q)) ! tau_rr + 2/3*G ! S_thetatheta += rho * ( -(tau_thetatheta + 2/3*G)*(du/x%spacing + dv/dr + v/r) + 2*(tau_thetatheta + ! G)*v/r ) diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 048ac14933..71d0bcc530 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -544,8 +544,7 @@ contains if (p == 0) gp_layers_z = 0 $:GPU_PARALLEL_LOOP(private='[i, j, k, ii, jj, kk, is_gp, local_idx, patch_id, encoded_patch_id, xp, yp, zp]', & - & copyin='[count, count_i, x_domain, y_domain, z_domain]', firstprivate='[gp_layers, gp_layers_z]', & - & collapse=3) + & copyin='[count, count_i, x_domain, y_domain, z_domain]', firstprivate='[gp_layers, gp_layers_z]', collapse=3) do i = 0, m do j = 0, n do k = 0, p @@ -941,17 +940,16 @@ contains ! Get the pressure contribution to force via a finite difference to compute the 2D components of the ! gradient of the pressure and cell volume local_force_contribution(1) = local_force_contribution(1) - (q_prim_vf(eqn_idx%E + fluid_idx)%sf(i & - & + 1, j, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i - 1, j, & - & k))/(2._wp*dx_loc) ! force is the negative pressure gradient + & + 1, j, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i - 1, j, k))/(2._wp*dx_loc) ! force is the negative pressure gradient local_force_contribution(2) = local_force_contribution(2) - (q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, & & j + 1, k) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, j - 1, k))/(2._wp*dy_loc) cell_volume = abs(dx_loc*dy_loc) ! add the 3D component of the pressure gradient, if we are working in 3 dimensions if (num_dims == 3) then dz_loc = z%cc(k + 1) - z%cc(k) - local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(eqn_idx%E + fluid_idx) & - & %sf(i, j, k + 1) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, j, & - & k - 1))/(2._wp*dz_loc) + local_force_contribution(3) = local_force_contribution(3) - (q_prim_vf(eqn_idx%E & + & + fluid_idx)%sf(i, j, k + 1) - q_prim_vf(eqn_idx%E + fluid_idx)%sf(i, & + & j, k - 1))/(2._wp*dz_loc) cell_volume = abs(cell_volume*dz_loc) end if end do @@ -1061,8 +1059,8 @@ contains ! Offset only needs to be computes for specific geometries - if (patch_ib(ib_marker)%geometry == 4 .or. patch_ib(ib_marker)%geometry == 5 .or. patch_ib(ib_marker) & - & %geometry == 11 .or. patch_ib(ib_marker)%geometry == 12) then + if (patch_ib(ib_marker)%geometry == 4 .or. patch_ib(ib_marker)%geometry == 5 .or. patch_ib(ib_marker)%geometry == 11 & + & .or. patch_ib(ib_marker)%geometry == 12) then center_of_mass_local = [0._wp, 0._wp, 0._wp] num_cells_local = 0 @@ -1131,11 +1129,11 @@ contains if (patch_ib(ib_marker)%geometry == 2) then ! circle patch_ib(ib_marker)%moment = 0.5_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2 else if (patch_ib(ib_marker)%geometry == 3) then ! rectangle - patch_ib(ib_marker)%moment = patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker) & - & %length_y**2)/6._wp + patch_ib(ib_marker)%moment = patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 & + & + patch_ib(ib_marker)%length_y**2)/6._wp else if (patch_ib(ib_marker)%geometry == 6) then ! ellipse - patch_ib(ib_marker)%moment = 0.0625_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker) & - & %length_y**2) + patch_ib(ib_marker)%moment = 0.0625_wp*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%length_x**2 & + & + patch_ib(ib_marker)%length_y**2) else if (patch_ib(ib_marker)%geometry == 8) then ! sphere patch_ib(ib_marker)%moment = 0.4*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2 else ! we do not have an analytic moment of inertia calculation and need to approximate it directly via a sum diff --git a/src/simulation/m_qbmm.fpp b/src/simulation/m_qbmm.fpp index 4a1533b247..3730941e19 100644 --- a/src/simulation/m_qbmm.fpp +++ b/src/simulation/m_qbmm.fpp @@ -841,8 +841,8 @@ contains & momrhs(:,i1, i2, j, q)) end if case (2) - if ((j >= 7 .and. j <= 9) .or. (j >= 22 .and. j <= 23) & - & .or. (j >= 10 .and. j <= 11) .or. (j == 26)) then + if ((j >= 7 .and. j <= 9) .or. (j >= 22 .and. j <= 23) .or. (j >= 10 & + & .and. j <= 11) .or. (j == 26)) then momsum = momsum + coeff(j, i1, i2)*(R0(q)**momrhs(3, i1, i2, j, & & q))*f_quad2D(abscX(:,q), abscY(:,q), wght_pb(:,q), & & momrhs(:,i1, i2, j, q)) From 3b65a519a8e4204e3936ee85a65fa9caf81e72b3 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 10:35:52 -0500 Subject: [PATCH 05/20] refactor: consolidate IB dynamics arrays into ib_dynamics_t struct --- src/common/m_derived_types.fpp | 5 +++ src/post_process/m_data_output.fpp | 71 ++++++++++++++---------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 489dfd2c06..40054c44b2 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -181,6 +181,11 @@ module m_derived_types logical :: enabled end type body_force_axis + !> Groups per-body allocatable arrays (x, y, z) for one IB dynamics quantity + type ib_dynamics_t + real(wp), allocatable, dimension(:) :: x, y, z + end type ib_dynamics_t + !> Defines parameters for a Model Patch type ic_model_parameters character(LEN=pathlen_max) :: filepath !< Path the STL file relative to case_dir. diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index 79e7427330..3a3bc9e117 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -1356,12 +1356,7 @@ contains integer, dimension(num_procs) :: meshtypes integer :: i, ios, file_unit integer :: ierr, nBodies - real(wp), dimension(:), allocatable :: px, py, pz - real(wp), dimension(:), allocatable :: force_x, force_y, force_z - real(wp), dimension(:), allocatable :: torque_x, torque_y, torque_z - real(wp), dimension(:), allocatable :: vel_x, vel_y, vel_z - real(wp), dimension(:), allocatable :: omega_x, omega_y, omega_z - real(wp), dimension(:), allocatable :: angle_x, angle_y, angle_z + type(ib_dynamics_t) :: pos, force, torque, vel, omega, angle real(wp), dimension(:), allocatable :: ib_diameter ! Build path to per-timestep IB state file @@ -1377,12 +1372,12 @@ contains if (nBodies > 0) then allocate (ib_data(nBodies, NFIELDS_PER_IB)) - allocate (px(nBodies), py(nBodies), pz(nBodies)) - allocate (force_x(nBodies), force_y(nBodies), force_z(nBodies)) - allocate (torque_x(nBodies), torque_y(nBodies), torque_z(nBodies)) - allocate (vel_x(nBodies), vel_y(nBodies), vel_z(nBodies)) - allocate (omega_x(nBodies), omega_y(nBodies), omega_z(nBodies)) - allocate (angle_x(nBodies), angle_y(nBodies), angle_z(nBodies)) + allocate (pos%x(nBodies), pos%y(nBodies), pos%z(nBodies)) + allocate (force%x(nBodies), force%y(nBodies), force%z(nBodies)) + allocate (torque%x(nBodies), torque%y(nBodies), torque%z(nBodies)) + allocate (vel%x(nBodies), vel%y(nBodies), vel%z(nBodies)) + allocate (omega%x(nBodies), omega%y(nBodies), omega%z(nBodies)) + allocate (angle%x(nBodies), angle%y(nBodies), angle%z(nBodies)) allocate (ib_diameter(nBodies)) if (proc_rank == 0) then @@ -1401,12 +1396,12 @@ contains call MPI_BCAST(ib_data, nBodies*NFIELDS_PER_IB, mpi_p, 0, MPI_COMM_WORLD, ierr) do i = 1, nBodies - force_x(i) = ib_data(i, 2); force_y(i) = ib_data(i, 3); force_z(i) = ib_data(i, 4) - torque_x(i) = ib_data(i, 5); torque_y(i) = ib_data(i, 6); torque_z(i) = ib_data(i, 7) - vel_x(i) = ib_data(i, 8); vel_y(i) = ib_data(i, 9); vel_z(i) = ib_data(i, 10) - omega_x(i) = ib_data(i, 11); omega_y(i) = ib_data(i, 12); omega_z(i) = ib_data(i, 13) - angle_x(i) = ib_data(i, 14); angle_y(i) = ib_data(i, 15); angle_z(i) = ib_data(i, 16) - px(i) = ib_data(i, 17); py(i) = ib_data(i, 18); pz(i) = ib_data(i, 19) + force%x(i) = ib_data(i, 2); force%y(i) = ib_data(i, 3); force%z(i) = ib_data(i, 4) + torque%x(i) = ib_data(i, 5); torque%y(i) = ib_data(i, 6); torque%z(i) = ib_data(i, 7) + vel%x(i) = ib_data(i, 8); vel%y(i) = ib_data(i, 9); vel%z(i) = ib_data(i, 10) + omega%x(i) = ib_data(i, 11); omega%y(i) = ib_data(i, 12); omega%z(i) = ib_data(i, 13) + angle%x(i) = ib_data(i, 14); angle%y(i) = ib_data(i, 15); angle%z(i) = ib_data(i, 16) + pos%x(i) = ib_data(i, 17); pos%y(i) = ib_data(i, 18); pos%z(i) = ib_data(i, 19) ib_diameter(i) = ib_data(i, 20)*2.0_wp end do @@ -1419,28 +1414,28 @@ contains err = DBPUTMMESH(dbroot, 'ib_bodies', 16, num_procs, meshnames, len_trim(meshnames), meshtypes, DB_F77NULL, ierr) end if - err = DBPUTPM(dbfile, 'ib_bodies', 9, 3, px, py, pz, nBodies, DB_DOUBLE, DB_F77NULL, ierr) - - call s_write_ib_variable('ib_force_x', t_step, force_x, nBodies) - call s_write_ib_variable('ib_force_y', t_step, force_y, nBodies) - call s_write_ib_variable('ib_force_z', t_step, force_z, nBodies) - call s_write_ib_variable('ib_torque_x', t_step, torque_x, nBodies) - call s_write_ib_variable('ib_torque_y', t_step, torque_y, nBodies) - call s_write_ib_variable('ib_torque_z', t_step, torque_z, nBodies) - call s_write_ib_variable('ib_vel_x', t_step, vel_x, nBodies) - call s_write_ib_variable('ib_vel_y', t_step, vel_y, nBodies) - call s_write_ib_variable('ib_vel_z', t_step, vel_z, nBodies) - call s_write_ib_variable('ib_omega_x', t_step, omega_x, nBodies) - call s_write_ib_variable('ib_omega_y', t_step, omega_y, nBodies) - call s_write_ib_variable('ib_omega_z', t_step, omega_z, nBodies) - call s_write_ib_variable('ib_angle_x', t_step, angle_x, nBodies) - call s_write_ib_variable('ib_angle_y', t_step, angle_y, nBodies) - call s_write_ib_variable('ib_angle_z', t_step, angle_z, nBodies) + err = DBPUTPM(dbfile, 'ib_bodies', 9, 3, pos%x, pos%y, pos%z, nBodies, DB_DOUBLE, DB_F77NULL, ierr) + + call s_write_ib_variable('ib_force_x', t_step, force%x, nBodies) + call s_write_ib_variable('ib_force_y', t_step, force%y, nBodies) + call s_write_ib_variable('ib_force_z', t_step, force%z, nBodies) + call s_write_ib_variable('ib_torque_x', t_step, torque%x, nBodies) + call s_write_ib_variable('ib_torque_y', t_step, torque%y, nBodies) + call s_write_ib_variable('ib_torque_z', t_step, torque%z, nBodies) + call s_write_ib_variable('ib_vel_x', t_step, vel%x, nBodies) + call s_write_ib_variable('ib_vel_y', t_step, vel%y, nBodies) + call s_write_ib_variable('ib_vel_z', t_step, vel%z, nBodies) + call s_write_ib_variable('ib_omega_x', t_step, omega%x, nBodies) + call s_write_ib_variable('ib_omega_y', t_step, omega%y, nBodies) + call s_write_ib_variable('ib_omega_z', t_step, omega%z, nBodies) + call s_write_ib_variable('ib_angle_x', t_step, angle%x, nBodies) + call s_write_ib_variable('ib_angle_y', t_step, angle%y, nBodies) + call s_write_ib_variable('ib_angle_z', t_step, angle%z, nBodies) call s_write_ib_variable('ib_diameter', t_step, ib_diameter, nBodies) - deallocate (ib_data, px, py, pz, force_x, force_y, force_z) - deallocate (torque_x, torque_y, torque_z, vel_x, vel_y, vel_z) - deallocate (omega_x, omega_y, omega_z, angle_x, angle_y, angle_z) + deallocate (ib_data, pos%x, pos%y, pos%z, force%x, force%y, force%z) + deallocate (torque%x, torque%y, torque%z, vel%x, vel%y, vel%z) + deallocate (omega%x, omega%y, omega%z, angle%x, angle%y, angle%z) deallocate (ib_diameter) end if #endif From 3f9f38230cdcb84f5e2833527a9c1d0eff124cce Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 12:51:47 -0500 Subject: [PATCH 06/20] refactor: introduce bc_dir_t type, strip BC payload from int_bounds_info --- src/common/m_derived_types.fpp | 27 ++++++++++++------------ src/post_process/m_global_parameters.fpp | 2 +- src/pre_process/m_global_parameters.fpp | 2 +- src/simulation/m_global_parameters.fpp | 4 ++-- src/simulation/m_weno.fpp | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 40054c44b2..f115972e9c 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -103,27 +103,28 @@ module m_derived_types integer :: end end type idx_bounds_info - !> Integer bounds for variables + !> Integer beg/end bounds pair for loop index ranges and domain extents. type int_bounds_info - integer :: beg - integer :: end - real(wp) :: vb1 - real(wp) :: vb2 - real(wp) :: vb3 - real(wp) :: ve1 - real(wp) :: ve2 - real(wp) :: ve3 + integer :: beg + integer :: end + end type int_bounds_info + + !> Boundary condition parameters for one coordinate direction (beg/end faces + face data). + type bc_dir_t + integer :: beg, end + real(wp) :: vb1, vb2, vb3 + real(wp) :: ve1, ve2, ve3 real(wp) :: pres_in, pres_out real(wp), dimension(3) :: vel_in, vel_out real(wp), dimension(num_fluids_max) :: alpha_rho_in, alpha_in logical :: grcbc_in, grcbc_out, grcbc_vel_out logical :: isothermal_in, isothermal_out real(wp) :: Twall_in, Twall_out - end type int_bounds_info + end type bc_dir_t - !> Groups the x, y, z boundary condition begin/end codes for passing as a single argument. + !> Groups the x, y, z boundary condition structs for passing as a single argument. type bc_xyz_info - type(int_bounds_info) :: x, y, z + type(bc_dir_t) :: x, y, z end type bc_xyz_info !> QBMM moment index mappings - separate from bub beg/end so eqn_idx contains no allocatables. @@ -137,7 +138,7 @@ module m_derived_types end type qbmm_idx_info !> All conserved-variable equation indices, computed at startup from model_eqns and enabled features. - !> Range indices (beg/end) use int_bounds_info; scalar indices are plain integers (0 = inactive). + !> Range indices (beg/end) use idx_bounds_info; scalar indices are plain integers (0 = inactive). !> Contains no allocatable members - safe for GPU_DECLARE as a single struct. type eqn_idx_info type(idx_bounds_info) :: cont !< Partial densities (continuity equations) diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 1e19b61598..ff1d31d633 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -117,7 +117,7 @@ module m_global_parameters logical :: bc_io !> @name Boundary conditions in the x-, y- and z-coordinate directions !> @{ - type(int_bounds_info) :: bc_x, bc_y, bc_z + type(bc_dir_t) :: bc_x, bc_y, bc_z !> @} integer :: shear_num !< Number of shear stress components diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index 17b7f2397a..c5257139d8 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -86,7 +86,7 @@ module m_global_parameters ! Cell indices (InDices With BUFFer): includes buffer except in pre_process type(int_bounds_info) :: idwbuff(1:3) - type(int_bounds_info) :: bc_x, bc_y, bc_z !< Boundary conditions in the x-, y- and z-coordinate directions + type(bc_dir_t) :: bc_x, bc_y, bc_z !< Boundary conditions in the x-, y- and z-coordinate directions integer :: shear_num !< Number of shear stress components integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress integer :: shear_BC_flip_num !< Number of shear stress components to reflect for boundary conditions diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 23bc64a09d..e04baf392c 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -202,12 +202,12 @@ module m_global_parameters logical :: bc_io !> @name Boundary conditions (BC) in the x-, y- and z-directions, respectively !> @{ - type(int_bounds_info) :: bc_x, bc_y, bc_z + type(bc_dir_t) :: bc_x, bc_y, bc_z !> @} !> @name Original boundary conditions preserved for immersed boundary code !> (bc_x/y/z get overwritten with MPI neighbor ranks during decomposition) !> @{ - type(int_bounds_info) :: ib_bc_x, ib_bc_y, ib_bc_z + type(bc_dir_t) :: ib_bc_x, ib_bc_y, ib_bc_z !> @} #if defined(MFC_OpenACC) $:GPU_DECLARE(create='[bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3]') diff --git a/src/simulation/m_weno.fpp b/src/simulation/m_weno.fpp index b51d376458..7cd622694a 100644 --- a/src/simulation/m_weno.fpp +++ b/src/simulation/m_weno.fpp @@ -182,7 +182,7 @@ contains type(int_bounds_info), intent(in) :: is integer :: s real(wp), pointer, dimension(:) :: s_cb => null() !< Cell-boundary locations in the s-direction - type(int_bounds_info) :: bc_s !< Boundary conditions (BC) in the s-direction + type(bc_dir_t) :: bc_s !< Boundary conditions (BC) in the s-direction integer :: i !< Generic loop iterator real(wp) :: w(1:8) !< Intermediate var for ideal weights: s_cb across overall stencil real(wp) :: ys(1:4) !< Intermediate var for poly & beta: diff(s_cb) across sub-stencil From eb90ba8fd80e27abcfa1509e5f9db01ef622d3d4 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 15:42:02 -0500 Subject: [PATCH 07/20] fix: update boundary_conditions local var to bc_dir_t in m_mpi_common --- src/common/m_mpi_common.fpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index b2d6465243..db6dee421c 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -503,7 +503,7 @@ contains integer, intent(in) :: mpi_dir, pbc_loc, nVar integer :: i, j, k, l, r, q !< Generic loop iterators integer :: buffer_counts(1:3), buffer_count - type(int_bounds_info) :: boundary_conditions(1:3) + type(bc_dir_t) :: boundary_conditions(1:3) integer :: beg_end(1:2), grid_dims(1:3) integer :: dst_proc, src_proc, recv_tag, send_tag logical :: beg_end_geq_0, qbmm_comm, chem_diff_comm From 15f3a647fd2183e4d2913e54809f590b6d53d1d0 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 18:23:21 -0500 Subject: [PATCH 08/20] ci: remove AMD GPU container from Docker workflow --- .github/Dockerfile | 44 ------------------------------------ .github/workflows/docker.yml | 38 ++----------------------------- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index 8193ea46e2..5735777e63 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -7,8 +7,6 @@ ARG CXX_COMPILER ARG FC_COMPILER ARG COMPILER_PATH ARG COMPILER_LD_LIBRARY_PATH -ARG AFAR_VERSION -ARG OLCF_AFAR_ROOT="" ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC @@ -29,47 +27,10 @@ RUN apt-get update -y && \ python3.12 python3.12-venv python3-pip \ libfftw3-dev \ openmpi-bin libopenmpi-dev; \ - elif [ "$TARGET" = "amd" ]; then \ - apt-get install -y \ - build-essential git make gcc g++ gfortran bc \ - python3.12 python3.12-venv python3-pip \ - libfftw3-dev libnuma1 libdrm2 libdrm-amdgpu1; \ fi && \ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# AMD: download AFAR, install cmake 3.28 (Ubuntu 22.04 ships 3.22 which doesn't -# recognize amdflang as LLVMFlang), then build MPICH with amdflang so the -# generated mpi.mod is compiler-compatible. -RUN if [ "$TARGET" = "amd" ] && [ -n "$AFAR_VERSION" ]; then \ - OLCF_AFAR_ROOT="/opt/${AFAR_VERSION}" && \ - wget -q "https://repo.radeon.com/rocm/misc/flang/${AFAR_VERSION}-ubuntu.tar.bz2" -O /tmp/afar.tar.bz2 && \ - tar -xjf /tmp/afar.tar.bz2 -C /opt/ && \ - rm /tmp/afar.tar.bz2 && \ - CMAKE_VER=3.28.6 && \ - wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.sh" \ - -O /tmp/cmake-install.sh && \ - chmod +x /tmp/cmake-install.sh && \ - /tmp/cmake-install.sh --prefix=/usr/local --skip-license --exclude-subdir && \ - rm /tmp/cmake-install.sh && \ - printf '#!/bin/bash\nargs=()\nwhile [ "$#" -gt 0 ]; do\n if [ "$1" = "-soname" ]; then\n args+=("-Wl,-soname,$2"); shift 2\n else\n args+=("$1"); shift\n fi\ndone\nexec '"${OLCF_AFAR_ROOT}"'/bin/amdflang "${args[@]}"\n' \ - > /usr/local/bin/amdflang-ld-wrap && \ - chmod +x /usr/local/bin/amdflang-ld-wrap && \ - MPICH_VER=3.4.3 && \ - wget -q "https://www.mpich.org/static/downloads/${MPICH_VER}/mpich-${MPICH_VER}.tar.gz" \ - -O /tmp/mpich.tar.gz && \ - mkdir -p /tmp/mpich-src && \ - tar -xzf /tmp/mpich.tar.gz -C /tmp/mpich-src --strip-components=1 && \ - cd /tmp/mpich-src && \ - FC=/usr/local/bin/amdflang-ld-wrap CC=gcc CXX=g++ \ - ./configure --prefix=/opt/mpich --enable-shared --disable-static \ - --with-device=ch3 2>&1 && \ - make -j$(nproc) 2>&1 && \ - make install 2>&1 && \ - cd / && \ - rm -rf /tmp/mpich-src /tmp/mpich.tar.gz; \ - fi - ENV OMPI_ALLOW_RUN_AS_ROOT=1 ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 ENV HYDRA_LAUNCHER=fork @@ -80,7 +41,6 @@ COPY ../ /opt/MFC ENV CC=${CC_COMPILER} ENV CXX=${CXX_COMPILER} ENV FC=${FC_COMPILER} -ENV OLCF_AFAR_ROOT=${OLCF_AFAR_ROOT} ENV PATH="${COMPILER_PATH}:/opt/mpich/bin:$PATH" ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:/opt/mpich/lib:${LD_LIBRARY_PATH:-}" @@ -95,8 +55,6 @@ RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \ cd /opt/MFC && \ if [ "$TARGET" = "gpu" ]; then \ ./mfc.sh build --gpu acc -j $(nproc); \ - elif [ "$TARGET" = "amd" ]; then \ - ./mfc.sh build --gpu mp -j $(nproc); \ else \ ./mfc.sh build -j $(nproc); \ fi @@ -104,8 +62,6 @@ RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \ RUN cd /opt/MFC && \ if [ "$TARGET" = "gpu" ]; then \ ./mfc.sh test -a --dry-run --gpu acc -j $(nproc); \ - elif [ "$TARGET" = "amd" ]; then \ - ./mfc.sh test -a --dry-run --gpu mp -j $(nproc); \ else \ ./mfc.sh test -a --dry-run -j $(nproc); \ fi diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c27107daed..181de1d8b8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,7 +28,6 @@ jobs: - { name: 'cpu', tag: 'cpu', runner: 'ubuntu-22.04-arm', base_image: 'ubuntu:22.04' } - { name: 'gpu', tag: 'gpu-nvidia', runner: 'ubuntu-22.04', base_image: 'nvcr.io/nvidia/nvhpc:24.5-devel-cuda_multi-ubuntu22.04', compiler_arch: 'Linux_x86_64' } - { name: 'gpu', tag: 'gpu-nvidia', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:24.5-devel-cuda_multi-ubuntu22.04', compiler_arch: 'Linux_aarch64' } - - { name: 'amd', tag: 'gpu-amd', runner: 'ubuntu-22.04', base_image: 'ubuntu:22.04' } runs-on: ${{ matrix.config.runner }} outputs: tag: ${{ steps.clone.outputs.tag }} @@ -135,37 +134,6 @@ jobs: ${{ env.GH_REGISTRY }}:${{ env.TAG }}-${{ matrix.config.tag }}-${{ matrix.config.runner }} push: true - - name: Set AMD AFAR vars - if: ${{ matrix.config.name == 'amd' }} - run: | - AFAR=rocm-afar-8873-drop-22.2.0 - ROOT="/opt/${AFAR}" - echo "AFAR_VERSION=${AFAR}" >> $GITHUB_ENV - echo "AFAR_ROOT=${ROOT}" >> $GITHUB_ENV - - - name: Build and push image (amd) - if: ${{ matrix.config.name == 'amd' }} - uses: docker/build-push-action@v6 - with: - context: /mnt/share - file: /mnt/share/Dockerfile - build-args: | - BASE_IMAGE=${{ matrix.config.base_image }} - TARGET=amd - AFAR_VERSION=${{ env.AFAR_VERSION }} - OLCF_AFAR_ROOT=${{ env.AFAR_ROOT }} - CC_COMPILER=gcc - CXX_COMPILER=g++ - FC_COMPILER=${{ env.AFAR_ROOT }}/bin/amdflang - COMPILER_PATH=${{ env.AFAR_ROOT }}/lib/llvm/bin:${{ env.AFAR_ROOT }}/bin - COMPILER_LD_LIBRARY_PATH=${{ env.AFAR_ROOT }}/lib:${{ env.AFAR_ROOT }}/lib/llvm/lib - labels: | - org.opencontainers.image.source=https://github.com/${{ github.repository }} - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-gpu-amd-ubuntu-22.04 - ${{ env.GH_REGISTRY }}:${{ env.TAG }}-gpu-amd-ubuntu-22.04 - push: true - manifests: runs-on: ubuntu-latest needs: Container @@ -201,9 +169,8 @@ jobs: run: | GH="${{ env.GH_REGISTRY }}" for R in "$DH" "$GH"; do - docker buildx imagetools create -t $R:$TAG-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm + docker buildx imagetools create -t $R:$TAG-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm docker buildx imagetools create -t $R:$TAG-gpu-nvidia $R:$TAG-gpu-nvidia-ubuntu-22.04 $R:$TAG-gpu-nvidia-ubuntu-22.04-arm - docker buildx imagetools create -t $R:$TAG-gpu-amd $R:$TAG-gpu-amd-ubuntu-22.04 done - name: Update latest tags @@ -214,7 +181,6 @@ jobs: run: | GH="${{ env.GH_REGISTRY }}" for R in "$DH" "$GH"; do - docker buildx imagetools create -t $R:latest-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm + docker buildx imagetools create -t $R:latest-cpu $R:$TAG-cpu-ubuntu-22.04 $R:$TAG-cpu-ubuntu-22.04-arm docker buildx imagetools create -t $R:latest-gpu-nvidia $R:$TAG-gpu-nvidia-ubuntu-22.04 $R:$TAG-gpu-nvidia-ubuntu-22.04-arm - docker buildx imagetools create -t $R:latest-gpu-amd $R:$TAG-gpu-amd-ubuntu-22.04 done From 7f2cd02ef22aadfd047b5a633576914b336f94db Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 19:50:03 -0500 Subject: [PATCH 09/20] refactor: move dx/dy/dz min spacing into grid_axis%min_spacing Remove module-level dx, dy, dz scalars from pre_process m_global_parameters. Add min_spacing field to the grid_axis derived type so each axis carries its own minimum cell width. Update all call sites in m_grid, m_start_up, m_icpp_patches, m_mpi_common, and 2dHardcodedIC. --- src/common/include/2dHardcodedIC.fpp | 2 +- src/common/m_derived_types.fpp | 3 +- src/common/m_mpi_common.fpp | 15 ++++--- src/pre_process/m_global_parameters.fpp | 3 +- src/pre_process/m_grid.f90 | 11 +++-- src/pre_process/m_icpp_patches.fpp | 60 +++++++++++++------------ src/pre_process/m_start_up.fpp | 24 +++++----- 7 files changed, 65 insertions(+), 53 deletions(-) diff --git a/src/common/include/2dHardcodedIC.fpp b/src/common/include/2dHardcodedIC.fpp index 0f9a33c33b..b58c02d84c 100644 --- a/src/common/include/2dHardcodedIC.fpp +++ b/src/common/include/2dHardcodedIC.fpp @@ -157,7 +157,7 @@ if (x%cc(i) <= 0.7_wp*lam) then d = x%cc(i) - lam*(0.4_wp - 0.1_wp*sin(2.0_wp*pi*(y%cc(j)/lam + 0.25_wp))) #ifdef MFC_PRE_PROCESS - fsm = 0.5_wp*(1.0_wp + erf(d/(ei*sqrt(dx*dy)))) + fsm = 0.5_wp*(1.0_wp + erf(d/(ei*sqrt(x%min_spacing*y%min_spacing)))) #else fsm = 0.5_wp*(1.0_wp + erf(d/(ei*sqrt(x%spacing(i)*y%spacing(j))))) #endif diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index f115972e9c..54136ee85a 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -13,9 +13,10 @@ module m_derived_types implicit none - !> Derived type for a single spatial grid axis: cell-boundary, cell-center, and per-cell spacing arrays + !> Derived type for a single spatial grid axis: cell-boundary, cell-center, per-cell spacing arrays, and minimum spacing scalar type grid_axis real(wp), allocatable, dimension(:) :: cb, cc, spacing + real(wp) :: min_spacing = 0._wp end type grid_axis !> Derived type adding the field position (fp) as an attribute diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index db6dee421c..b66321dcce 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -1022,12 +1022,15 @@ contains integer :: num_procs_x, num_procs_y, num_procs_z !< Optimal number of processors in the x-, y- and z-directions !> Non-optimal number of processors in the x-, y- and z-directions real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z - real(wp) :: fct_min !< Processor factorization (fct) minimization parameter - integer :: MPI_COMM_CART !< Cartesian processor topology communicator - integer :: rem_cells !< Remaining cells after distribution among processors - integer :: recon_order !< WENO or MUSCL reconstruction order - integer :: i, j !< Generic loop iterators - integer :: ierr !< Generic flag used to identify and report MPI errors + real(wp) :: fct_min !< Processor factorization (fct) minimization parameter +#ifdef MFC_PRE_PROCESS + real(wp) :: dx, dy, dz !< uniform spacing temporaries for domain decomposition +#endif + integer :: MPI_COMM_CART !< Cartesian processor topology communicator + integer :: rem_cells !< Remaining cells after distribution among processors + integer :: recon_order !< WENO or MUSCL reconstruction order + integer :: i, j !< Generic loop iterators + integer :: ierr !< Generic flag used to identify and report MPI errors if (recon_type == WENO_TYPE) then recon_order = weno_order diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index c5257139d8..4e2ae66306 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -41,9 +41,8 @@ module m_global_parameters integer :: num_vels !< Number of velocity components (different from num_dims for mhd) logical :: cyl_coord integer :: grid_geometry !< Cylindrical coordinates (either axisymmetric or full 3D) - !> Cell-boundary (cb) and cell-center (cc) arrays per direction + !> Cell-boundary (cb), cell-center (cc), per-cell spacing, and minimum spacing per direction type(grid_axis) :: x, y, z - real(wp) :: dx, dy, dz !< Minimum cell-widths in the x-, y- and z-coordinate directions type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions logical :: stretch_x, stretch_y, stretch_z !< Grid stretching flags for the x-, y- and z-coordinate directions ! Grid stretching: a_x/a_y/a_z = rate, x_stretch%beg/end = locations diff --git a/src/pre_process/m_grid.f90 b/src/pre_process/m_grid.f90 index 9abed16500..17ce26cd75 100644 --- a/src/pre_process/m_grid.f90 +++ b/src/pre_process/m_grid.f90 @@ -34,8 +34,9 @@ end subroutine s_generate_abstract_grid impure subroutine s_generate_serial_grid ! Generic loop iterator - integer :: i, j !< generic loop operators - real(wp) :: length !< domain lengths + integer :: i, j !< generic loop operators + real(wp) :: length !< domain lengths + real(wp) :: dx, dy, dz !< local uniform spacing temporaries ! Uniform grid: dx = (x_end - x_beg) / (m + 1) dx = (x_domain%end - x_domain%beg)/real(m + 1, wp) @@ -68,6 +69,7 @@ impure subroutine s_generate_serial_grid print *, 'Stretched grid: min/max x grid: ', minval(x%cc(:)), maxval(x%cc(:)) if (num_procs > 1) call s_mpi_reduce_min(dx) end if + x%min_spacing = dx ! Grid Generation in the y-direction if (n == 0) return @@ -115,6 +117,7 @@ impure subroutine s_generate_serial_grid if (num_procs > 1) call s_mpi_reduce_min(dy) end if + y%min_spacing = dy ! Grid Generation in the z-direction if (p == 0) return @@ -149,6 +152,7 @@ impure subroutine s_generate_serial_grid if (num_procs > 1) call s_mpi_reduce_min(dz) end if + z%min_spacing = dz end subroutine s_generate_serial_grid @@ -156,7 +160,8 @@ end subroutine s_generate_serial_grid impure subroutine s_generate_parallel_grid #ifdef MFC_MPI - real(wp) :: length !< domain lengths + real(wp) :: length !< domain lengths + real(wp) :: dx, dy, dz !< local uniform spacing temporaries ! Locations of cell boundaries real(wp), allocatable, dimension(:) :: x_cb_glb, y_cb_glb, z_cb_glb !< Locations of cell boundaries character(LEN=path_len + name_len) :: file_loc !< Generic string used to store the address of a file diff --git a/src/pre_process/m_icpp_patches.fpp b/src/pre_process/m_icpp_patches.fpp index 2ea6a4bdca..632a45228c 100644 --- a/src/pre_process/m_icpp_patches.fpp +++ b/src/pre_process/m_icpp_patches.fpp @@ -312,8 +312,9 @@ contains do i = 0, m if (patch_icpp(patch_id)%smoothen) then ! Smooth Heaviside via hyperbolic tangent; smooth_coeff controls interface sharpness - eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp + eta = tanh(smooth_coeff/min(x%min_spacing, & + & y%min_spacing)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) & + & + 0.5_wp end if if (((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2 <= radius**2 & @@ -485,9 +486,9 @@ contains do j = 0, n do i = 0, m if (patch_icpp(patch_id)%smoothen) then - eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2) - 1._wp))*(-0.5_wp) & - & + 0.5_wp + eta = tanh(smooth_coeff/min(x%min_spacing, & + & y%min_spacing)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2) - 1._wp)) & + & *(-0.5_wp) + 0.5_wp end if if ((((x%cc(i) - x_centroid)/a)**2 + ((y%cc(j) - y_centroid)/b)**2 <= 1._wp & @@ -555,8 +556,8 @@ contains end if if (patch_icpp(patch_id)%smoothen) then - eta = tanh(smooth_coeff/min(dx, dy, & - & dz)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z & + eta = tanh(smooth_coeff/min(x%min_spacing, y%min_spacing, & + & z%min_spacing)*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z & & - z_centroid)/c)**2) - 1._wp))*(-0.5_wp) + 0.5_wp end if @@ -688,7 +689,8 @@ contains do j = 0, n do i = 0, m if (patch_icpp(patch_id)%smoothen) then - eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(dx, dy)*(a*x%cc(i) + b*y%cc(j) + c)/sqrt(a**2 + b**2)) + eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(x%min_spacing, & + & y%min_spacing)*(a*x%cc(i) + b*y%cc(j) + c)/sqrt(a**2 + b**2)) end if if ((a*x%cc(i) + b*y%cc(j) + c >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & @@ -878,7 +880,7 @@ contains end if end if if (patch_icpp(patch_id)%smoothen) then - eta = 0.5_wp + 0.5_wp*tanh(smooth_coeff/min(dx, dy)*(R_boundary - r)) + eta = 0.5_wp + 0.5_wp*tanh(smooth_coeff/min(x%min_spacing, y%min_spacing)*(R_boundary - r)) end if if ((r <= R_boundary .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0))) .or. patch_id_fp(i, j, & & 0) == smooth_patch_id) then @@ -940,7 +942,8 @@ contains end do end do if (patch_icpp(patch_id)%smoothen) then - eta_local = 0.5_wp + 0.5_wp*tanh(smooth_coeff/min(dx, dy, dz)*(R_surface - r)) + eta_local = 0.5_wp + 0.5_wp*tanh(smooth_coeff/min(x%min_spacing, y%min_spacing, & + & z%min_spacing)*(R_surface - r)) end if if ((r <= R_surface .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, & & k) == smooth_patch_id) then @@ -998,9 +1001,9 @@ contains end if if (patch_icpp(patch_id)%smoothen) then - eta = tanh(smooth_coeff/min(dx, dy, & - & dz)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) & - & - radius))*(-0.5_wp) + 0.5_wp + eta = tanh(smooth_coeff/min(x%min_spacing, y%min_spacing, & + & z%min_spacing)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z & + & - z_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp end if if ((((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2) & @@ -1146,17 +1149,17 @@ contains if (patch_icpp(patch_id)%smoothen) then if (.not. f_is_default(length_x)) then - eta = tanh(smooth_coeff/min(dy, & - & dz)*(sqrt((cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) - radius))*(-0.5_wp) & - & + 0.5_wp + eta = tanh(smooth_coeff/min(y%min_spacing, & + & z%min_spacing)*(sqrt((cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) - radius)) & + & *(-0.5_wp) + 0.5_wp else if (.not. f_is_default(length_y)) then - eta = tanh(smooth_coeff/min(dx, & - & dz)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2) - radius))*(-0.5_wp) & - & + 0.5_wp + eta = tanh(smooth_coeff/min(x%min_spacing, & + & z%min_spacing)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_z - z_centroid)**2) - radius)) & + & *(-0.5_wp) + 0.5_wp else - eta = tanh(smooth_coeff/min(dx, & - & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2) - radius))*(-0.5_wp) & - & + 0.5_wp + eta = tanh(smooth_coeff/min(x%min_spacing, & + & y%min_spacing)*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2) - radius)) & + & *(-0.5_wp) + 0.5_wp end if end if @@ -1232,8 +1235,9 @@ contains end if if (patch_icpp(patch_id)%smoothen) then - eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(dx, dy, & - & dz)*(a*x%cc(i) + b*cart_y + c*cart_z + d)/sqrt(a**2 + b**2 + c**2)) + eta = 5.e-1_wp + 5.e-1_wp*tanh(smooth_coeff/min(x%min_spacing, y%min_spacing, & + & z%min_spacing)*(a*x%cc(i) + b*cart_y + c*cart_z + d)/sqrt(a**2 + b**2 & + & + c**2)) end if if ((a*x%cc(i) + b*cart_y + c*cart_z + d >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, & @@ -1326,11 +1330,11 @@ contains write (*, "(A, 3(2X, F20.10))") " > Cen:", (bbox%min(1:3) + bbox%max(1:3))/2._wp write (*, "(A, 3(2X, F20.10))") " > Max:", bbox%max(1:3) - grid_mm(1,:) = (/minval(x%cc) - 0.e5_wp*dx, maxval(x%cc) + 0.e5_wp*dx/) - grid_mm(2,:) = (/minval(y%cc) - 0.e5_wp*dy, maxval(y%cc) + 0.e5_wp*dy/) + grid_mm(1,:) = (/minval(x%cc) - 0.e5_wp*x%min_spacing, maxval(x%cc) + 0.e5_wp*x%min_spacing/) + grid_mm(2,:) = (/minval(y%cc) - 0.e5_wp*y%min_spacing, maxval(y%cc) + 0.e5_wp*y%min_spacing/) if (p > 0) then - grid_mm(3,:) = (/minval(z%cc) - 0.e5_wp*dz, maxval(z%cc) + 0.e5_wp*dz/) + grid_mm(3,:) = (/minval(z%cc) - 0.e5_wp*z%min_spacing, maxval(z%cc) + 0.e5_wp*z%min_spacing/) else grid_mm(3,:) = (/0._wp, 0._wp/) end if @@ -1356,7 +1360,7 @@ contains point = f_convert_cyl_to_cart(point) end if - eta = f_model_is_inside(model, point, (/dx, dy, dz/), patch_icpp(patch_id)%model_spc) + eta = f_model_is_inside(model, point, (/x%min_spacing, y%min_spacing, z%min_spacing/), patch_icpp(patch_id)%model_spc) if (eta > patch_icpp(patch_id)%model_threshold) then eta = 1._wp diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index c4d33bc25b..590e771c3c 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -181,8 +181,8 @@ contains x%cc(0:m) = (x%cb(0:m) + x%cb(-1:(m - 1)))/2._wp - dx = minval(x%cb(0:m) - x%cb(-1:m - 1)) - if (num_procs > 1) call s_mpi_reduce_min(dx) + x%min_spacing = minval(x%cb(0:m) - x%cb(-1:m - 1)) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) x_domain%beg = x%cb(-1) x_domain%end = x%cb(m) @@ -201,8 +201,8 @@ contains y%cc(0:n) = (y%cb(0:n) + y%cb(-1:(n - 1)))/2._wp - dy = minval(y%cb(0:n) - y%cb(-1:n - 1)) - if (num_procs > 1) call s_mpi_reduce_min(dy) + y%min_spacing = minval(y%cb(0:n) - y%cb(-1:n - 1)) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) y_domain%beg = y%cb(-1) y_domain%end = y%cb(n) @@ -221,8 +221,8 @@ contains z%cc(0:p) = (z%cb(0:p) + z%cb(-1:(p - 1)))/2._wp - dz = minval(z%cb(0:p) - z%cb(-1:p - 1)) - if (num_procs > 1) call s_mpi_reduce_min(dz) + z%min_spacing = minval(z%cb(0:p) - z%cb(-1:p - 1)) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) z_domain%beg = z%cb(-1) z_domain%end = z%cb(p) @@ -354,8 +354,8 @@ contains x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) x%cc(0:m) = (x%cb(0:m) + x%cb(-1:(m - 1)))/2._wp - dx = minval(x%cb(0:m) - x%cb(-1:(m - 1))) - if (num_procs > 1) call s_mpi_reduce_min(dx) + x%min_spacing = minval(x%cb(0:m) - x%cb(-1:(m - 1))) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) x_domain%beg = x%cb(-1) x_domain%end = x%cb(m) @@ -374,8 +374,8 @@ contains y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) y%cc(0:n) = (y%cb(0:n) + y%cb(-1:(n - 1)))/2._wp - dy = minval(y%cb(0:n) - y%cb(-1:(n - 1))) - if (num_procs > 1) call s_mpi_reduce_min(dy) + y%min_spacing = minval(y%cb(0:n) - y%cb(-1:(n - 1))) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) y_domain%beg = y%cb(-1) y_domain%end = y%cb(n) @@ -394,8 +394,8 @@ contains z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) z%cc(0:p) = (z%cb(0:p) + z%cb(-1:(p - 1)))/2._wp - dz = minval(z%cb(0:p) - z%cb(-1:(p - 1))) - if (num_procs > 1) call s_mpi_reduce_min(dz) + z%min_spacing = minval(z%cb(0:p) - z%cb(-1:(p - 1))) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) z_domain%beg = z%cb(-1) z_domain%end = z%cb(p) end if From 3c387d1bcbd013b1780bec2cbb9c4f44f73437ff Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 19:58:16 -0500 Subject: [PATCH 10/20] refactor: populate grid_axis%min_spacing in simulation and post_process After reading grid data from files, compute and store min_spacing on each axis in both serial and parallel paths. Matches the pre_process pattern so min_spacing is consistent across all three executables. --- src/post_process/m_data_input.f90 | 12 ++++++++++++ src/simulation/m_start_up.fpp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/post_process/m_data_input.f90 b/src/post_process/m_data_input.f90 index f6bee854f6..8b2c372e52 100644 --- a/src/post_process/m_data_input.f90 +++ b/src/post_process/m_data_input.f90 @@ -216,12 +216,18 @@ impure subroutine s_read_serial_data_files(t_step) ! assumed-shape re-mapping shifts the read by that many slots and leaves the last interior cells uninitialized - corrupting ! downstream ghost-cell extrapolation. call s_read_grid_data_direction(t_step_dir, 'x', x%cb(-1:m), x%spacing(0:m), x%cc(0:m), m) + x%min_spacing = minval(x%spacing(0:m)) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) if (n > 0) then call s_read_grid_data_direction(t_step_dir, 'y', y%cb(-1:n), y%spacing(0:n), y%cc(0:n), n) + y%min_spacing = minval(y%spacing(0:n)) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) if (p > 0) then call s_read_grid_data_direction(t_step_dir, 'z', z%cb(-1:p), z%spacing(0:p), z%cc(0:p), p) + z%min_spacing = minval(z%spacing(0:p)) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) end if end if @@ -299,6 +305,8 @@ impure subroutine s_read_parallel_data_files(t_step) x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp + x%min_spacing = minval(x%spacing(0:m)) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) if (n > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'y_cb.dat' @@ -323,6 +331,8 @@ impure subroutine s_read_parallel_data_files(t_step) y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp + y%min_spacing = minval(y%spacing(0:n)) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) if (p > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat' @@ -347,6 +357,8 @@ impure subroutine s_read_parallel_data_files(t_step) z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp + z%min_spacing = minval(z%spacing(0:p)) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) end if end if diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 3e8c99e84d..efda5afc35 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -210,6 +210,8 @@ contains x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp + x%min_spacing = minval(x%spacing(0:m)) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) if (ib) then do i = 1, num_ibs @@ -234,6 +236,8 @@ contains y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp + y%min_spacing = minval(y%spacing(0:n)) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) end if if (p > 0) then @@ -250,6 +254,8 @@ contains z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp + z%min_spacing = minval(z%spacing(0:p)) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) end if do i = 1, sys_size @@ -347,6 +353,8 @@ contains x%cb(-1:m) = x_cb_glb((start_idx(1) - 1):(start_idx(1) + m)) x%spacing(0:m) = x%cb(0:m) - x%cb(-1:m - 1) x%cc(0:m) = x%cb(-1:m - 1) + x%spacing(0:m)/2._wp + x%min_spacing = minval(x%spacing(0:m)) + if (num_procs > 1) call s_mpi_reduce_min(x%min_spacing) if (ib) then do i = 1, num_ibs @@ -374,6 +382,8 @@ contains y%cb(-1:n) = y_cb_glb((start_idx(2) - 1):(start_idx(2) + n)) y%spacing(0:n) = y%cb(0:n) - y%cb(-1:n - 1) y%cc(0:n) = y%cb(-1:n - 1) + y%spacing(0:n)/2._wp + y%min_spacing = minval(y%spacing(0:n)) + if (num_procs > 1) call s_mpi_reduce_min(y%min_spacing) if (p > 0) then file_loc = trim(case_dir) // '/restart_data' // trim(mpiiofs) // 'z_cb.dat' @@ -391,6 +401,8 @@ contains z%cb(-1:p) = z_cb_glb((start_idx(3) - 1):(start_idx(3) + p)) z%spacing(0:p) = z%cb(0:p) - z%cb(-1:p - 1) z%cc(0:p) = z%cb(-1:p - 1) + z%spacing(0:p)/2._wp + z%min_spacing = minval(z%spacing(0:p)) + if (num_procs > 1) call s_mpi_reduce_min(z%min_spacing) end if end if From f448f338be96b26171a921f9ce1b92a10fa35714 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 21:00:13 -0500 Subject: [PATCH 11/20] refactor: rename bc_x/bc_y/bc_z to bc%x/bc%y/bc%z via bc_xyz_info struct Group the three directional boundary condition variables (bc_x, bc_y, bc_z of type bc_dir_t) into a single bc_xyz_info struct accessed as bc%x, bc%y, bc%z. Updates all Fortran source, Fypp macros, Python toolchain, example cases, and documentation. --- docs/documentation/case.md | 62 ++-- docs/documentation/equations.md | 2 +- examples/0D_bubblecollapse_adap/case.py | 4 +- examples/1D_acoustic_dipole/case.py | 4 +- examples/1D_acoustic_gauss_sigmadist/case.py | 4 +- examples/1D_acoustic_gauss_sigmatime/case.py | 4 +- examples/1D_acoustic_sine_frequency/case.py | 4 +- examples/1D_acoustic_sine_wavelength/case.py | 4 +- examples/1D_advection_convergence/case.py | 4 +- examples/1D_brio_wu/case.py | 4 +- examples/1D_brio_wu_hlld/case.py | 4 +- examples/1D_brio_wu_rmhd/case.py | 4 +- examples/1D_bubblescreen/case.py | 4 +- examples/1D_cont_damage/case.py | 4 +- examples/1D_convergence/case.py | 4 +- examples/1D_dai_woodward/case.py | 4 +- examples/1D_dai_woodward_hlld/case.py | 4 +- examples/1D_euler_convergence/case.py | 4 +- examples/1D_exp_bubscreen/case.py | 4 +- examples/1D_exp_tube_phasechange/case.py | 4 +- examples/1D_hypo_2materials/case.py | 4 +- examples/1D_impact/case.py | 4 +- examples/1D_inert_shocktube/case.py | 4 +- examples/1D_kapilashocktube/case.py | 4 +- examples/1D_laxshocktube/case.py | 4 +- examples/1D_mhd_smooth_alfven_wave/case.py | 4 +- examples/1D_multispecies_diffusion/case.py | 4 +- examples/1D_poly_bubscreen/case.py | 4 +- examples/1D_qbmm/case.py | 4 +- examples/1D_reactive_shocktube/case.py | 4 +- examples/1D_shuosher_analytical/case.py | 4 +- examples/1D_shuosher_old/case.py | 4 +- examples/1D_shuosher_teno5/case.py | 4 +- examples/1D_shuosher_teno7/case.py | 4 +- examples/1D_shuosher_wenojs5/case.py | 4 +- examples/1D_shuosher_wenom5/case.py | 4 +- examples/1D_shuosher_wenoz5/case.py | 4 +- examples/1D_sodHypo/case.py | 4 +- examples/1D_sod_convergence/case.py | 4 +- examples/1D_sodshocktube/case.py | 4 +- examples/1D_sodshocktube_muscl/case.py | 4 +- examples/1D_titarevtorro/case.py | 4 +- examples/1D_titarevtorro_analytical/case.py | 4 +- examples/1D_vacuum/case.py | 4 +- examples/1D_vacuum_restart/case.py | 4 +- examples/1D_vacuum_restart/restart_case.py | 4 +- examples/2D_5wave_quasi1D/case.py | 8 +- examples/2D_GreshoVortex/case.py | 8 +- examples/2D_IGR_2fluid/case.py | 8 +- examples/2D_IGR_triple_point/case.py | 8 +- examples/2D_TaylorGreenVortex/case.py | 8 +- examples/2D_Thermal_Flatplate/case.py | 12 +- examples/2D_acoustic_broadband/case.py | 8 +- examples/2D_acoustic_pulse/case.py | 24 +- examples/2D_acoustic_pulse_analytical/case.py | 24 +- examples/2D_acoustic_support10_axisym/case.py | 8 +- examples/2D_acoustic_support2/case.py | 8 +- examples/2D_acoustic_support5/case.py | 8 +- examples/2D_acoustic_support6_axisym/case.py | 8 +- examples/2D_acoustic_support9/case.py | 8 +- examples/2D_advection/case.py | 8 +- examples/2D_advection_convergence/case.py | 8 +- examples/2D_advection_muscl/case.py | 8 +- examples/2D_axisym_hypoelasticity/case.py | 8 +- examples/2D_axisym_shockbubble/case.py | 8 +- examples/2D_axisym_shockwatercavity/case.py | 8 +- examples/2D_backward_facing_step/case.py | 8 +- examples/2D_bubbly_steady_shock/case.py | 8 +- examples/2D_cont_damage/case.py | 8 +- examples/2D_forward_facing_step/case.py | 8 +- examples/2D_hardcoded_ic/case.py | 8 +- examples/2D_ibm/case.py | 8 +- examples/2D_ibm_airfoil/case.py | 8 +- examples/2D_ibm_cfl_dt/case.py | 8 +- examples/2D_ibm_ellipse/case.py | 8 +- examples/2D_ibm_multiphase/case.py | 8 +- examples/2D_ibm_steady_shock/case.py | 34 +- examples/2D_ibm_stl_MFCCharacter/case.py | 8 +- examples/2D_ibm_stl_test/case.py | 8 +- examples/2D_ibm_stl_wedge/case.py | 8 +- examples/2D_isentropicvortex/case.py | 8 +- .../2D_isentropicvortex_analytical/case.py | 8 +- examples/2D_jet/case.py | 8 +- examples/2D_jet_in_crossflow/case_2D_jicf.py | 8 +- examples/2D_kelvin_helmholtz/case.py | 8 +- examples/2D_lagrange_bubblescreen/case.py | 8 +- examples/2D_laplace_pressure_jump/case.py | 8 +- examples/2D_lid_driven_cavity/case.py | 10 +- examples/2D_lungwave/case.py | 8 +- examples/2D_lungwave_horizontal/case.py | 8 +- examples/2D_mhd_magnetic_vortex/case.py | 8 +- examples/2D_mhd_rotor/case.py | 8 +- .../2D_mibm_cylinder_in_cross_flow/case.py | 8 +- examples/2D_mibm_shock_cylinder/case.py | 8 +- examples/2D_mixing_artificial_Ma/case.py | 8 +- examples/2D_orszag_tang/case.py | 8 +- .../2D_orszag_tang_hyper_cleaning/case.py | 8 +- examples/2D_patch_modal_shape/case.py | 24 +- examples/2D_patch_modal_shape_exp/case.py | 24 +- examples/2D_phasechange_bubble/case.py | 8 +- examples/2D_rayleigh_taylor/case.py | 8 +- examples/2D_richtmyer_meshkov/case.py | 8 +- examples/2D_riemann_test/case.py | 8 +- examples/2D_riemann_test_muscl/case.py | 8 +- examples/2D_shearlayer/case.py | 8 +- examples/2D_shock_cloud_rmhd/case.py | 8 +- examples/2D_shockbubble/case.py | 8 +- examples/2D_shockdroplet/case.py | 8 +- examples/2D_shockdroplet_muscl/case.py | 8 +- examples/2D_shocktube_phasechange/case.py | 8 +- examples/2D_triple_point/case.py | 8 +- examples/2D_tumbling_rectangle/case.py | 8 +- examples/2D_viscous/case.py | 8 +- examples/2D_viscous_shock_tube/case.py | 8 +- examples/2D_whale_bubble_annulus/case.py | 8 +- examples/2D_zero_circ_vortex/case.py | 34 +- .../2D_zero_circ_vortex_analytical/case.py | 34 +- examples/3D_IGR_33jet/case.py | 12 +- examples/3D_IGR_TaylorGreenVortex/case.py | 12 +- .../3D_IGR_TaylorGreenVortex_nvidia/case.py | 12 +- examples/3D_IGR_jet/case.py | 12 +- examples/3D_IGR_jet_1fluid/case.py | 12 +- examples/3D_TaylorGreenVortex/case.py | 12 +- .../3D_TaylorGreenVortex_analytical/case.py | 12 +- examples/3D_acoustic_support11/case.py | 12 +- examples/3D_acoustic_support3/case.py | 12 +- examples/3D_acoustic_support7/case.py | 12 +- examples/3D_advection_convergence/case.py | 12 +- examples/3D_brio_wu/case.py | 12 +- examples/3D_ibm_bowshock/case.py | 12 +- examples/3D_ibm_stl_ellipsoid/case.py | 12 +- examples/3D_ibm_stl_pyramid/case.py | 12 +- examples/3D_ibm_stl_test/case.py | 12 +- examples/3D_lagrange_bubblescreen/case.py | 12 +- examples/3D_lagrange_shbubcollapse/case.py | 12 +- .../3D_mibm_sphere_head_on_collision/case.py | 12 +- examples/3D_patch_spherical_harmonic/case.py | 36 +- examples/3D_performance_test/case.py | 12 +- examples/3D_phasechange_bubble/case.py | 12 +- examples/3D_rayleigh_taylor/case.py | 12 +- examples/3D_rayleigh_taylor_muscl/case.py | 12 +- examples/3D_recovering_sphere/case.py | 12 +- examples/3D_rotating_sphere/case.py | 12 +- examples/3D_shockdroplet/case.py | 12 +- examples/3D_shockdroplet_muscl/case.py | 12 +- examples/3D_sphbubcollapse/case.py | 12 +- examples/3D_turb_mixing/case.py | 12 +- examples/nD_perfect_reactor/case.py | 12 +- examples/scaling/benchmark.py | 12 +- src/common/m_boundary_common.fpp | 324 +++++++++--------- src/common/m_mpi_common.fpp | 82 ++--- src/post_process/m_global_parameters.fpp | 20 +- src/post_process/m_mpi_proxy.fpp | 12 +- src/post_process/m_start_up.fpp | 20 +- src/pre_process/m_boundary_conditions.fpp | 16 +- src/pre_process/m_global_parameters.fpp | 20 +- src/pre_process/m_initial_condition.fpp | 12 +- src/pre_process/m_mpi_proxy.fpp | 14 +- src/pre_process/m_start_up.fpp | 20 +- src/simulation/m_bubbles_EL.fpp | 24 +- src/simulation/m_bubbles_EL_kernels.fpp | 14 +- src/simulation/m_cbc.fpp | 90 ++--- src/simulation/m_fftw.fpp | 2 +- src/simulation/m_global_parameters.fpp | 36 +- src/simulation/m_mpi_proxy.fpp | 34 +- src/simulation/m_rhs.fpp | 16 +- src/simulation/m_riemann_solvers.fpp | 12 +- src/simulation/m_start_up.fpp | 44 +-- src/simulation/m_surface_tension.fpp | 2 +- src/simulation/m_viscous.fpp | 12 +- src/simulation/m_weno.fpp | 6 +- tests/failed_uuids.txt | 1 + toolchain/mfc/case_validator.py | 58 ++-- toolchain/mfc/fp_stability.py | 8 +- toolchain/mfc/gen_physics_docs.py | 2 +- toolchain/mfc/init.py | 24 +- toolchain/mfc/lint_param_docs.py | 15 +- toolchain/mfc/params/definitions.py | 10 +- toolchain/mfc/params/descriptions.py | 12 +- toolchain/mfc/params/generators/docs_gen.py | 6 +- toolchain/mfc/params/namelist_parser.py | 12 +- toolchain/mfc/params_cmd.py | 2 +- toolchain/mfc/params_tests/mutation_tests.py | 8 +- toolchain/mfc/params_tests/negative_tests.py | 20 +- .../mfc/params_tests/test_definitions.py | 4 +- toolchain/mfc/test/cases.py | 306 ++++++++--------- 186 files changed, 1344 insertions(+), 1340 deletions(-) create mode 100644 tests/failed_uuids.txt diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 187bab00c7..199a5d015c 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -421,9 +421,9 @@ See @ref equations "Equations" for the mathematical models these parameters cont | Parameter | Type | Description | | ---: | :----: | :--- | -| `bc_[x,y,z]%%beg[end]` | Integer | Beginning [ending] boundary condition in the $[x,y,z]$-direction (negative integer, see table [Boundary Conditions](#boundary-conditions)) | -| `bc_[x,y,z]%%vb[1,2,3]`‡ | Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc_[x,y,z]%%beg` | -| `bc_[x,y,z]%%ve[1,2,3]`‡ | Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc_[x,y,z]%%end` | +| `bc%%[x,y,z]%%beg[end]` | Integer | Beginning [ending] boundary condition in the $[x,y,z]$-direction (negative integer, see table [Boundary Conditions](#boundary-conditions)) | +| `bc%%[x,y,z]%%vb[1,2,3]`‡ | Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc%%[x,y,z]%%beg` | +| `bc%%[x,y,z]%%ve[1,2,3]`‡ | Real | Velocity in the (x,1), (y, 2), (z,3) direction applied to `bc%%[x,y,z]%%end` | | `model_eqns` | Integer | Multicomponent model: [1] \f$\Gamma/\Pi_\infty\f$; [2] 5-equation; [3] 6-equation; [4] 4-equation | | `alt_soundspeed` * | Logical | Alternate sound speed and \f$K \nabla \cdot u\f$ for 5-equation model | | `adv_n` | Logical | Solving directly for the number density (in the method of classes) and compute void fraction from the number density | @@ -482,23 +482,23 @@ See @ref equations "Equations" for the mathematical models these parameters cont - \* Options that work only with `model_eqns = 2`. - † Options that work only with ``cyl_coord = 'F'``. -- ‡ Options that work only with `bc_[x,y,z]%[beg,end] = -15` and/or `bc_[x,y,z]%[beg,end] = -16`. +- ‡ Options that work only with `bc%[x,y,z]%[beg,end] = -15` and/or `bc%[x,y,z]%[beg,end] = -16`. The table lists simulation algorithm parameters. The parameters are used to specify options in algorithms that are used to integrate the governing equations of the multi-component flow based on the initial condition. Models and assumptions that are used to formulate and discretize the governing equations are described in \cite Wilfong26 and \cite Bryngelson21. Details of the simulation algorithms and implementation of the WENO scheme can be found in \cite Coralic15. -- `bc_[x,y,z]%[beg,end]` specifies the boundary conditions at the beginning and the end of domain boundaries in each coordinate direction by a negative integer from -1 through -16. +- `bc%[x,y,z]%[beg,end]` specifies the boundary conditions at the beginning and the end of domain boundaries in each coordinate direction by a negative integer from -1 through -16. See table [Boundary Conditions](#boundary-conditions) for details. Boundary condition patches can be used with non-characteristic boundary conditions. Their use is detailed in [Boundary Condition Patches](#boundary-condition-patches). -- `bc_[x,y,z]%%vb[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc_[x,y,z]%%beg` when using `bc_[x,y,z]%%beg = -16`. -Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%beg = -16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `bc_[x,y,z]%%end = -16` to work properly. +- `bc%%[x,y,z]%%vb[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc%%[x,y,z]%%beg` when using `bc%%[x,y,z]%%beg = -16`. +Tangential velocities require viscosity, `weno_avg = T`, and `bc%%[x,y,z]%%beg = -16` to work properly. Normal velocities require `bc%%[x,y,z]%%end = -15` or `bc%%[x,y,z]%%end = -16` to work properly. -- `bc_[x,y,z]%%ve[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc_[x,y,z]%%beg` when using `bc_[x,y,z]%%end = -16`. -Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%end = 16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `bc_[x,y,z]%%end = -16` to work properly. +- `bc%%[x,y,z]%%ve[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc%%[x,y,z]%%beg` when using `bc%%[x,y,z]%%end = -16`. +Tangential velocities require viscosity, `weno_avg = T`, and `bc%%[x,y,z]%%end = 16` to work properly. Normal velocities require `bc%%[x,y,z]%%end = -15` or `bc%%[x,y,z]%%end = -16` to work properly. - `model_eqns` specifies the choice of the multi-component model that is used to formulate the dynamics of the flow using integers from 1 through 3. `model_eqns = 1`, `2`, and `3` correspond to \f$\Gamma\f$-\f$\Pi_\infty\f$ model (\cite Johnsen08), 5-equation model (\cite Allaire02), and 6-equation model (\cite Saurel09), respectively. @@ -534,7 +534,7 @@ It is recommended to set `weno_eps` to $10^{-6}$ for WENO-JS, and to $10^{-40}$ - `teno_CT` specifies the threshold for the TENO scheme. This dimensionless constant, also known as $C_T$, sets a threshold to identify smooth and non-smooth stencils. Larger values make the scheme more robust but also more dissipative. A recommended value for teno_CT is `1e-6`. When adjusting this parameter, it is recommended to try values like `1e-5` or `1e-7` for TENO5. A smaller value can be used for TENO7. -- `null_weights` activates nullification of the nonlinear WENO weights at the buffer regions outside the domain boundaries when the Riemann extrapolation boundary condition is specified (`bc_[x,y,z]%%beg[end]} = -4`). +- `null_weights` activates nullification of the nonlinear WENO weights at the buffer regions outside the domain boundaries when the Riemann extrapolation boundary condition is specified (`bc%%[x,y,z]%%beg[end]} = -4`). - `mp_weno` activates monotonicity preservation in the WENO reconstruction (MPWENO) such that the values of reconstructed variables do not reside outside the range spanned by WENO stencil (\cite Balsara00; \cite Suresh97). @@ -1046,9 +1046,9 @@ Note: For relativistic flow, the conservative and primitive densities are differ When ``cyl_coord = 'T'`` is set in 3D the following constraints must be met: -- `bc_y%%beg = -14` enables the axis boundary condition +- `bc%%y%%beg = -14` enables the axis boundary condition -- `bc_z%%beg = bc_z%%end = -1` enables periodic boundary conditions in the azimuthal direction +- `bc%%z%%beg = bc%%z%%end = -1` enables periodic boundary conditions in the azimuthal direction - `z_domain%%beg = 0` sets the azimuthal starting point to 0 @@ -1056,7 +1056,7 @@ When ``cyl_coord = 'T'`` is set in 3D the following constraints must be met: When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met: -- `bc_y%%beg = -2` to enable reflective boundary conditions +- `bc%%y%%beg = -2` to enable reflective boundary conditions ### 17. Chemistry @@ -1077,12 +1077,12 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met: | Parameter | Type | Description | | ---: | :----: | :--- | -| `bc_[x,y,z]%%isothermal_in` | Logical | Enable isothermal wall at the domain entrance (minimum coordinate). | -| `bc_[x,y,z]%%isothermal_out` | Logical | Enable isothermal wall at the domain exit (maximum coordinate). | -| `bc_[x,y,z]%%Twall_in` | Real | Temperature [K] of the entrance isothermal wall. | -| `bc_[x,y,z]%%Twall_out` | Real | Temperature [K] of the exit isothermal wall. | +| `bc%%[x,y,z]%%isothermal_in` | Logical | Enable isothermal wall at the domain entrance (minimum coordinate). | +| `bc%%[x,y,z]%%isothermal_out` | Logical | Enable isothermal wall at the domain exit (maximum coordinate). | +| `bc%%[x,y,z]%%Twall_in` | Real | Temperature [K] of the entrance isothermal wall. | +| `bc%%[x,y,z]%%Twall_out` | Real | Temperature [K] of the exit isothermal wall. | -This boundary condition can be used for fixed-temperature (isothermal) walls at the domain extremities. It is exclusively available for reacting flows and requires chemistry to be enabled. It properly evaluates heat and species fluxes at the interface when ``chemistry = 'T'``, ``chem_params%%diffusion = 'T'``, and the corresponding domain boundary is set to a slip wall (`bc_[x,y,z]%%[beg,end]` = -15) or a no-slip wall (`bc_[x,y,z]%%[beg,end]` = -16). +This boundary condition can be used for fixed-temperature (isothermal) walls at the domain extremities. It is exclusively available for reacting flows and requires chemistry to be enabled. It properly evaluates heat and species fluxes at the interface when ``chemistry = 'T'``, ``chem_params%%diffusion = 'T'``, and the corresponding domain boundary is set to a slip wall (`bc%%[x,y,z]%%[beg,end]` = -15) or a no-slip wall (`bc%%[x,y,z]%%[beg,end]` = -16). @@ -1118,27 +1118,27 @@ This boundary condition can be used for fixed-temperature (isothermal) walls at | -15 | Normal | Slip wall | | -16 | Normal | No-slip wall | -*: This boundary condition is only used for `bc_y%%beg` when using cylindrical coordinates (``cyl_coord = 'T'`` and 3D). For axisymmetric problems, use `bc_y%%beg = -2` with ``cyl_coord = 'T'`` in 2D. +*: This boundary condition is only used for `bc%%y%%beg` when using cylindrical coordinates (``cyl_coord = 'T'`` and 3D). For axisymmetric problems, use `bc%%y%%beg = -2` with ``cyl_coord = 'T'`` in 2D. The boundary condition supported by the MFC are listed in table [Boundary Conditions](#boundary-conditions). -Their number (`#`) corresponds to the input value in `input.py` labeled `bc_[x,y,z]%[beg,end]` (see table [Simulation Algorithm Parameters](#sec-simulation-algorithm)). +Their number (`#`) corresponds to the input value in `input.py` labeled `bc%[x,y,z]%[beg,end]` (see table [Simulation Algorithm Parameters](#sec-simulation-algorithm)). The entries labeled "Characteristic." are characteristic boundary conditions based on \cite Thompson87 and \cite Thompson90. ### Generalized Characteristic Boundary conditions | Parameter | Type | Description | | ---: | :----: | :--- | -| `bc_[x,y,z]%%grcbc_in` | Logical | Enable grcbc for subsonic inflow | -| `bc_[x,y,z]%%grcbc_out` | Logical | Enable grcbc for subsonic outflow (pressure)| -| `bc_[x,y,z]%%grcbc_vel_out` | Logical | Enable grcbc for subsonic outflow (pressure + normal velocity) | -| `bc_[x,y,z]%%vel_in` | Real Array | Inflow velocities in x, y and z directions | -| `bc_[x,y,z]%%vel_out` | Real Array | Outflow velocities in x, y and z directions | -| `bc_[x,y,z]%%pres_in` | Real | Inflow pressure | -| `bc_[x,y,z]%%pres_out` | Real | Outflow pressure | -| `bc_[x,y,z]%%alpha_rho_in` | Real Array | Inflow density | -| `bc_[x,y,z]%%alpha_in` | Real Array | Inflow void fraction | - -This boundary condition can be used for subsonic inflow (`bc_[x,y,z]%[beg,end]` = -7) and subsonic outflow (`bc_[x,y,z]%[beg,end]` = -8) characteristic boundary conditions. These are based on \cite Pirozzoli13. This enables to provide inflow and outflow conditions outside the computational domain. +| `bc%%[x,y,z]%%grcbc_in` | Logical | Enable grcbc for subsonic inflow | +| `bc%%[x,y,z]%%grcbc_out` | Logical | Enable grcbc for subsonic outflow (pressure)| +| `bc%%[x,y,z]%%grcbc_vel_out` | Logical | Enable grcbc for subsonic outflow (pressure + normal velocity) | +| `bc%%[x,y,z]%%vel_in` | Real Array | Inflow velocities in x, y and z directions | +| `bc%%[x,y,z]%%vel_out` | Real Array | Outflow velocities in x, y and z directions | +| `bc%%[x,y,z]%%pres_in` | Real | Inflow pressure | +| `bc%%[x,y,z]%%pres_out` | Real | Outflow pressure | +| `bc%%[x,y,z]%%alpha_rho_in` | Real Array | Inflow density | +| `bc%%[x,y,z]%%alpha_in` | Real Array | Inflow void fraction | + +This boundary condition can be used for subsonic inflow (`bc%[x,y,z]%[beg,end]` = -7) and subsonic outflow (`bc%[x,y,z]%[beg,end]` = -8) characteristic boundary conditions. These are based on \cite Pirozzoli13. This enables to provide inflow and outflow conditions outside the computational domain. ### Patch types {#patch-types} diff --git a/docs/documentation/equations.md b/docs/documentation/equations.md index 6bb17aa9de..73037c6aa0 100644 --- a/docs/documentation/equations.md +++ b/docs/documentation/equations.md @@ -979,7 +979,7 @@ Used for viscous fluxes and velocity gradients. | `-15` | Slip wall | | `-16` | No-slip wall | -### 16.2 Characteristic BCs (\cite Thompson87, \cite Thompson90; `bc_x%%beg = -5` to `-12`) +### 16.2 Characteristic BCs (\cite Thompson87, \cite Thompson90; `bc%%x%%beg = -5` to `-12`) **Characteristic decomposition:** diff --git a/examples/0D_bubblecollapse_adap/case.py b/examples/0D_bubblecollapse_adap/case.py index ac79d69275..aff574a388 100644 --- a/examples/0D_bubblecollapse_adap/case.py +++ b/examples/0D_bubblecollapse_adap/case.py @@ -83,8 +83,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_acoustic_dipole/case.py b/examples/1D_acoustic_dipole/case.py index 793b4aa0eb..0d6bac6756 100644 --- a/examples/1D_acoustic_dipole/case.py +++ b/examples/1D_acoustic_dipole/case.py @@ -34,8 +34,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_acoustic_gauss_sigmadist/case.py b/examples/1D_acoustic_gauss_sigmadist/case.py index 1c258638a8..7341f04fdb 100644 --- a/examples/1D_acoustic_gauss_sigmadist/case.py +++ b/examples/1D_acoustic_gauss_sigmadist/case.py @@ -34,8 +34,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_acoustic_gauss_sigmatime/case.py b/examples/1D_acoustic_gauss_sigmatime/case.py index 11520f5b44..66d6c3d7eb 100644 --- a/examples/1D_acoustic_gauss_sigmatime/case.py +++ b/examples/1D_acoustic_gauss_sigmatime/case.py @@ -34,8 +34,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_acoustic_sine_frequency/case.py b/examples/1D_acoustic_sine_frequency/case.py index f53e743369..f20e163b97 100644 --- a/examples/1D_acoustic_sine_frequency/case.py +++ b/examples/1D_acoustic_sine_frequency/case.py @@ -34,8 +34,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_acoustic_sine_wavelength/case.py b/examples/1D_acoustic_sine_wavelength/case.py index 9a57b159a9..1556e2ecd5 100644 --- a/examples/1D_acoustic_sine_wavelength/case.py +++ b/examples/1D_acoustic_sine_wavelength/case.py @@ -34,8 +34,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_advection_convergence/case.py b/examples/1D_advection_convergence/case.py index f8fbef41f1..4de5716134 100644 --- a/examples/1D_advection_convergence/case.py +++ b/examples/1D_advection_convergence/case.py @@ -78,8 +78,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/1D_brio_wu/case.py b/examples/1D_brio_wu/case.py index 6c59dc238d..d25da0924a 100644 --- a/examples/1D_brio_wu/case.py +++ b/examples/1D_brio_wu/case.py @@ -36,8 +36,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_brio_wu_hlld/case.py b/examples/1D_brio_wu_hlld/case.py index 19f94a32a5..05bbff51a4 100644 --- a/examples/1D_brio_wu_hlld/case.py +++ b/examples/1D_brio_wu_hlld/case.py @@ -37,8 +37,8 @@ "riemann_solver": 4, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_brio_wu_rmhd/case.py b/examples/1D_brio_wu_rmhd/case.py index f35a10a2d8..4dbaa08a73 100644 --- a/examples/1D_brio_wu_rmhd/case.py +++ b/examples/1D_brio_wu_rmhd/case.py @@ -37,8 +37,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_bubblescreen/case.py b/examples/1D_bubblescreen/case.py index f5d6011946..b108b4a462 100755 --- a/examples/1D_bubblescreen/case.py +++ b/examples/1D_bubblescreen/case.py @@ -104,8 +104,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_cont_damage/case.py b/examples/1D_cont_damage/case.py index aad89e4247..4846032d9f 100644 --- a/examples/1D_cont_damage/case.py +++ b/examples/1D_cont_damage/case.py @@ -35,8 +35,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/1D_convergence/case.py b/examples/1D_convergence/case.py index 7c5858bed4..3c6cca3a73 100755 --- a/examples/1D_convergence/case.py +++ b/examples/1D_convergence/case.py @@ -54,8 +54,8 @@ "riemann_solver": args.rs, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_dai_woodward/case.py b/examples/1D_dai_woodward/case.py index 175cd953bb..32b5747ad4 100644 --- a/examples/1D_dai_woodward/case.py +++ b/examples/1D_dai_woodward/case.py @@ -45,8 +45,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_dai_woodward_hlld/case.py b/examples/1D_dai_woodward_hlld/case.py index 5a03c24f0d..721c15234d 100644 --- a/examples/1D_dai_woodward_hlld/case.py +++ b/examples/1D_dai_woodward_hlld/case.py @@ -46,8 +46,8 @@ "riemann_solver": 4, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_euler_convergence/case.py b/examples/1D_euler_convergence/case.py index d67091328e..028a0d2dfb 100644 --- a/examples/1D_euler_convergence/case.py +++ b/examples/1D_euler_convergence/case.py @@ -85,8 +85,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/1D_exp_bubscreen/case.py b/examples/1D_exp_bubscreen/case.py index 212e18611d..cc93e54b6b 100755 --- a/examples/1D_exp_bubscreen/case.py +++ b/examples/1D_exp_bubscreen/case.py @@ -106,8 +106,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_exp_tube_phasechange/case.py b/examples/1D_exp_tube_phasechange/case.py index 03808cd78d..8733fcab8a 100644 --- a/examples/1D_exp_tube_phasechange/case.py +++ b/examples/1D_exp_tube_phasechange/case.py @@ -147,8 +147,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_hypo_2materials/case.py b/examples/1D_hypo_2materials/case.py index cd4316fc41..a38345b0ad 100755 --- a/examples/1D_hypo_2materials/case.py +++ b/examples/1D_hypo_2materials/case.py @@ -44,8 +44,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/1D_impact/case.py b/examples/1D_impact/case.py index 7f434741f8..76aedd20b5 100755 --- a/examples/1D_impact/case.py +++ b/examples/1D_impact/case.py @@ -44,8 +44,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/1D_inert_shocktube/case.py b/examples/1D_inert_shocktube/case.py index 26f45f1658..f2a02b11a7 100644 --- a/examples/1D_inert_shocktube/case.py +++ b/examples/1D_inert_shocktube/case.py @@ -72,8 +72,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, # Chemistry "chemistry": "F" if not args.chemistry else "T", "chem_params%diffusion": "F", diff --git a/examples/1D_kapilashocktube/case.py b/examples/1D_kapilashocktube/case.py index b6efbbec88..41467f3bbd 100755 --- a/examples/1D_kapilashocktube/case.py +++ b/examples/1D_kapilashocktube/case.py @@ -35,8 +35,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_laxshocktube/case.py b/examples/1D_laxshocktube/case.py index 15445f792c..a7affe39b0 100644 --- a/examples/1D_laxshocktube/case.py +++ b/examples/1D_laxshocktube/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_mhd_smooth_alfven_wave/case.py b/examples/1D_mhd_smooth_alfven_wave/case.py index 95f39e3c24..069b94b410 100644 --- a/examples/1D_mhd_smooth_alfven_wave/case.py +++ b/examples/1D_mhd_smooth_alfven_wave/case.py @@ -36,8 +36,8 @@ "riemann_solver": 4, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_multispecies_diffusion/case.py b/examples/1D_multispecies_diffusion/case.py index b4f52ae438..753fdd0617 100644 --- a/examples/1D_multispecies_diffusion/case.py +++ b/examples/1D_multispecies_diffusion/case.py @@ -48,8 +48,8 @@ "riemann_solver": 2, "wave_speeds": 2, "avg_state": 1, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "viscous": "F", "chemistry": "T", "chem_params%diffusion": "T", diff --git a/examples/1D_poly_bubscreen/case.py b/examples/1D_poly_bubscreen/case.py index 9006f72f31..ef7b29d555 100644 --- a/examples/1D_poly_bubscreen/case.py +++ b/examples/1D_poly_bubscreen/case.py @@ -100,8 +100,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_qbmm/case.py b/examples/1D_qbmm/case.py index 426e1460b5..8e1142d355 100644 --- a/examples/1D_qbmm/case.py +++ b/examples/1D_qbmm/case.py @@ -103,8 +103,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_reactive_shocktube/case.py b/examples/1D_reactive_shocktube/case.py index d14c20c2ea..5f61f38221 100644 --- a/examples/1D_reactive_shocktube/case.py +++ b/examples/1D_reactive_shocktube/case.py @@ -78,8 +78,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, # Chemistry "chemistry": "F" if not args.chemistry else "T", "chem_params%diffusion": "F", diff --git a/examples/1D_shuosher_analytical/case.py b/examples/1D_shuosher_analytical/case.py index 4f9ceaff56..5719606c74 100644 --- a/examples/1D_shuosher_analytical/case.py +++ b/examples/1D_shuosher_analytical/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_old/case.py b/examples/1D_shuosher_old/case.py index 7169f664b2..65432a631c 100644 --- a/examples/1D_shuosher_old/case.py +++ b/examples/1D_shuosher_old/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_teno5/case.py b/examples/1D_shuosher_teno5/case.py index 8132ed2067..ba4d2c5816 100644 --- a/examples/1D_shuosher_teno5/case.py +++ b/examples/1D_shuosher_teno5/case.py @@ -42,8 +42,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_teno7/case.py b/examples/1D_shuosher_teno7/case.py index 6c7963ced1..20ff81e6e7 100644 --- a/examples/1D_shuosher_teno7/case.py +++ b/examples/1D_shuosher_teno7/case.py @@ -42,8 +42,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_wenojs5/case.py b/examples/1D_shuosher_wenojs5/case.py index 94a9564552..79f091f16c 100644 --- a/examples/1D_shuosher_wenojs5/case.py +++ b/examples/1D_shuosher_wenojs5/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_wenom5/case.py b/examples/1D_shuosher_wenom5/case.py index fd479db63c..0d678431c5 100644 --- a/examples/1D_shuosher_wenom5/case.py +++ b/examples/1D_shuosher_wenom5/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_shuosher_wenoz5/case.py b/examples/1D_shuosher_wenoz5/case.py index 4bc4789a6d..8072e75084 100644 --- a/examples/1D_shuosher_wenoz5/case.py +++ b/examples/1D_shuosher_wenoz5/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_sodHypo/case.py b/examples/1D_sodHypo/case.py index 2339e02026..3daa5aafea 100755 --- a/examples/1D_sodHypo/case.py +++ b/examples/1D_sodHypo/case.py @@ -44,8 +44,8 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", # Formatted Database Files Structure Parameters diff --git a/examples/1D_sod_convergence/case.py b/examples/1D_sod_convergence/case.py index cf726519e9..255ea0dbcf 100644 --- a/examples/1D_sod_convergence/case.py +++ b/examples/1D_sod_convergence/case.py @@ -77,8 +77,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/1D_sodshocktube/case.py b/examples/1D_sodshocktube/case.py index ea0be00820..0acd894d1d 100755 --- a/examples/1D_sodshocktube/case.py +++ b/examples/1D_sodshocktube/case.py @@ -43,8 +43,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_sodshocktube_muscl/case.py b/examples/1D_sodshocktube_muscl/case.py index 9a21bbecb9..aa578e5bdd 100755 --- a/examples/1D_sodshocktube_muscl/case.py +++ b/examples/1D_sodshocktube_muscl/case.py @@ -39,8 +39,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_titarevtorro/case.py b/examples/1D_titarevtorro/case.py index 2d058d1746..137783ed5c 100644 --- a/examples/1D_titarevtorro/case.py +++ b/examples/1D_titarevtorro/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_titarevtorro_analytical/case.py b/examples/1D_titarevtorro_analytical/case.py index 73f012225f..139c8bcc8b 100644 --- a/examples/1D_titarevtorro_analytical/case.py +++ b/examples/1D_titarevtorro_analytical/case.py @@ -41,8 +41,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_vacuum/case.py b/examples/1D_vacuum/case.py index c86a08af1c..5fa638a5fe 100644 --- a/examples/1D_vacuum/case.py +++ b/examples/1D_vacuum/case.py @@ -35,8 +35,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_vacuum_restart/case.py b/examples/1D_vacuum_restart/case.py index 94e40c5ec0..8733533d67 100644 --- a/examples/1D_vacuum_restart/case.py +++ b/examples/1D_vacuum_restart/case.py @@ -35,8 +35,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/1D_vacuum_restart/restart_case.py b/examples/1D_vacuum_restart/restart_case.py index f2e10e71c3..aeda0187f6 100644 --- a/examples/1D_vacuum_restart/restart_case.py +++ b/examples/1D_vacuum_restart/restart_case.py @@ -36,8 +36,8 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_5wave_quasi1D/case.py b/examples/2D_5wave_quasi1D/case.py index 0f5d6ba4a7..5949c35fde 100755 --- a/examples/2D_5wave_quasi1D/case.py +++ b/examples/2D_5wave_quasi1D/case.py @@ -49,10 +49,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/2D_GreshoVortex/case.py b/examples/2D_GreshoVortex/case.py index ada31b2dd7..9b00da2eb6 100644 --- a/examples/2D_GreshoVortex/case.py +++ b/examples/2D_GreshoVortex/case.py @@ -54,10 +54,10 @@ "low_Mach": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_IGR_2fluid/case.py b/examples/2D_IGR_2fluid/case.py index 774930a0ad..ea33111890 100644 --- a/examples/2D_IGR_2fluid/case.py +++ b/examples/2D_IGR_2fluid/case.py @@ -46,10 +46,10 @@ "mpp_lim": "F", "time_stepper": 3, "riemann_solver": 5, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, "num_patches": 2, "num_fluids": 2, "elliptic_smoothing": "T", diff --git a/examples/2D_IGR_triple_point/case.py b/examples/2D_IGR_triple_point/case.py index 441365b579..329194a9e8 100755 --- a/examples/2D_IGR_triple_point/case.py +++ b/examples/2D_IGR_triple_point/case.py @@ -39,10 +39,10 @@ "num_igr_iters": 3, "num_igr_warm_start_iters": 30, "alf_factor": 10, - "bc_x%beg": -3, # 11, - "bc_x%end": -3, # 12 - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, # 11, + "bc%x%end": -3, # 12 + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_TaylorGreenVortex/case.py b/examples/2D_TaylorGreenVortex/case.py index 4a419d38e6..ae49b3fcc9 100644 --- a/examples/2D_TaylorGreenVortex/case.py +++ b/examples/2D_TaylorGreenVortex/case.py @@ -45,10 +45,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_Thermal_Flatplate/case.py b/examples/2D_Thermal_Flatplate/case.py index 9523e50f2a..438f1f022e 100644 --- a/examples/2D_Thermal_Flatplate/case.py +++ b/examples/2D_Thermal_Flatplate/case.py @@ -37,12 +37,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -7, - "bc_x%end": -3, - "bc_y%beg": -16, - "bc_y%end": -3, - "bc_y%isothermal_in": "T", - "bc_y%Twall_in": 600.0, + "bc%x%beg": -7, + "bc%x%end": -3, + "bc%y%beg": -16, + "bc%y%end": -3, + "bc%y%isothermal_in": "T", + "bc%y%Twall_in": 600.0, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/2D_acoustic_broadband/case.py b/examples/2D_acoustic_broadband/case.py index c3255333ad..97b4edef72 100644 --- a/examples/2D_acoustic_broadband/case.py +++ b/examples/2D_acoustic_broadband/case.py @@ -36,10 +36,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_acoustic_pulse/case.py b/examples/2D_acoustic_pulse/case.py index be11755d9b..1c497502a0 100644 --- a/examples/2D_acoustic_pulse/case.py +++ b/examples/2D_acoustic_pulse/case.py @@ -52,10 +52,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, - "bc_y%beg": -8, - "bc_y%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, + "bc%y%beg": -8, + "bc%y%end": -8, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, @@ -87,14 +87,14 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc_x%grcbc_in": "F", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "F", - "bc_x%pres_out": p_inf, - "bc_y%grcbc_in": "F", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "F", - "bc_y%pres_out": p_inf, + "bc%x%grcbc_in": "F", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "F", + "bc%x%pres_out": p_inf, + "bc%y%grcbc_in": "F", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "F", + "bc%y%pres_out": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_acoustic_pulse_analytical/case.py b/examples/2D_acoustic_pulse_analytical/case.py index 76192fd0e4..a07f46f45e 100644 --- a/examples/2D_acoustic_pulse_analytical/case.py +++ b/examples/2D_acoustic_pulse_analytical/case.py @@ -52,10 +52,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, - "bc_y%beg": -8, - "bc_y%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, + "bc%y%beg": -8, + "bc%y%end": -8, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, @@ -86,14 +86,14 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc_x%grcbc_in": "F", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "F", - "bc_x%pres_out": p_inf, - "bc_y%grcbc_in": "F", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "F", - "bc_y%pres_out": p_inf, + "bc%x%grcbc_in": "F", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "F", + "bc%x%pres_out": p_inf, + "bc%y%grcbc_in": "F", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "F", + "bc%y%pres_out": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_acoustic_support10_axisym/case.py b/examples/2D_acoustic_support10_axisym/case.py index 37f8dfbf33..a2e5f26459 100644 --- a/examples/2D_acoustic_support10_axisym/case.py +++ b/examples/2D_acoustic_support10_axisym/case.py @@ -38,10 +38,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_acoustic_support2/case.py b/examples/2D_acoustic_support2/case.py index 07ab20336f..cef87f1a63 100644 --- a/examples/2D_acoustic_support2/case.py +++ b/examples/2D_acoustic_support2/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_acoustic_support5/case.py b/examples/2D_acoustic_support5/case.py index 167a6a2aef..d803b58da3 100644 --- a/examples/2D_acoustic_support5/case.py +++ b/examples/2D_acoustic_support5/case.py @@ -36,10 +36,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_acoustic_support6_axisym/case.py b/examples/2D_acoustic_support6_axisym/case.py index 934ccc84d8..fc9d951703 100644 --- a/examples/2D_acoustic_support6_axisym/case.py +++ b/examples/2D_acoustic_support6_axisym/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_acoustic_support9/case.py b/examples/2D_acoustic_support9/case.py index de7972aad8..220d295a79 100644 --- a/examples/2D_acoustic_support9/case.py +++ b/examples/2D_acoustic_support9/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_advection/case.py b/examples/2D_advection/case.py index 693c7e9089..b1a10499a0 100644 --- a/examples/2D_advection/case.py +++ b/examples/2D_advection/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_advection_convergence/case.py b/examples/2D_advection_convergence/case.py index 39ce6f1c1e..1ce71c77c1 100644 --- a/examples/2D_advection_convergence/case.py +++ b/examples/2D_advection_convergence/case.py @@ -91,10 +91,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/2D_advection_muscl/case.py b/examples/2D_advection_muscl/case.py index 96d3d0a48b..404e4cbfa7 100644 --- a/examples/2D_advection_muscl/case.py +++ b/examples/2D_advection_muscl/case.py @@ -35,10 +35,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_axisym_hypoelasticity/case.py b/examples/2D_axisym_hypoelasticity/case.py index 54b6ca50f4..29823a8c04 100644 --- a/examples/2D_axisym_hypoelasticity/case.py +++ b/examples/2D_axisym_hypoelasticity/case.py @@ -36,10 +36,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/2D_axisym_shockbubble/case.py b/examples/2D_axisym_shockbubble/case.py index 86bacd5a83..fd9932cc2a 100644 --- a/examples/2D_axisym_shockbubble/case.py +++ b/examples/2D_axisym_shockbubble/case.py @@ -60,10 +60,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_axisym_shockwatercavity/case.py b/examples/2D_axisym_shockwatercavity/case.py index 38d2cd2aa5..14e3b55a96 100644 --- a/examples/2D_axisym_shockwatercavity/case.py +++ b/examples/2D_axisym_shockwatercavity/case.py @@ -191,10 +191,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_backward_facing_step/case.py b/examples/2D_backward_facing_step/case.py index 1955acca76..75647bc4ed 100644 --- a/examples/2D_backward_facing_step/case.py +++ b/examples/2D_backward_facing_step/case.py @@ -48,10 +48,10 @@ "mp_weno": "T", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -11, - "bc_x%end": -3, - "bc_y%beg": -16, - "bc_y%end": -3, + "bc%x%beg": -11, + "bc%x%end": -3, + "bc%y%beg": -16, + "bc%y%end": -3, "ib": "T", "num_ibs": 1, "viscous": "T", diff --git a/examples/2D_bubbly_steady_shock/case.py b/examples/2D_bubbly_steady_shock/case.py index e03df1a47d..815b00808b 100644 --- a/examples/2D_bubbly_steady_shock/case.py +++ b/examples/2D_bubbly_steady_shock/case.py @@ -97,10 +97,10 @@ "mp_weno": "F", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -6, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -6, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_cont_damage/case.py b/examples/2D_cont_damage/case.py index fe6e3d09ee..06246fe238 100644 --- a/examples/2D_cont_damage/case.py +++ b/examples/2D_cont_damage/case.py @@ -36,10 +36,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/examples/2D_forward_facing_step/case.py b/examples/2D_forward_facing_step/case.py index f55656c933..35499d1206 100644 --- a/examples/2D_forward_facing_step/case.py +++ b/examples/2D_forward_facing_step/case.py @@ -46,10 +46,10 @@ "mp_weno": "T", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -2, - "bc_y%end": -2, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -2, + "bc%y%end": -2, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/2D_hardcoded_ic/case.py b/examples/2D_hardcoded_ic/case.py index 7e1fd1eb6e..d965430a2a 100644 --- a/examples/2D_hardcoded_ic/case.py +++ b/examples/2D_hardcoded_ic/case.py @@ -45,10 +45,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -7, - "bc_y%beg": -2, - "bc_y%end": -7, + "bc%x%beg": -2, + "bc%x%end": -7, + "bc%y%beg": -2, + "bc%y%end": -7, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_ibm/case.py b/examples/2D_ibm/case.py index 016d749cdd..01f07c5d53 100644 --- a/examples/2D_ibm/case.py +++ b/examples/2D_ibm/case.py @@ -53,10 +53,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_ibm_airfoil/case.py b/examples/2D_ibm_airfoil/case.py index 10eea5a4d6..37ec141227 100644 --- a/examples/2D_ibm_airfoil/case.py +++ b/examples/2D_ibm_airfoil/case.py @@ -57,10 +57,10 @@ "wave_speeds": 1, # We use reflective boundary conditions at octant edges and # non-reflective boundary conditions at the domain edges - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_ibm_cfl_dt/case.py b/examples/2D_ibm_cfl_dt/case.py index 9f106d15f7..a5d8068fe2 100644 --- a/examples/2D_ibm_cfl_dt/case.py +++ b/examples/2D_ibm_cfl_dt/case.py @@ -55,10 +55,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -2, - "bc_y%end": -2, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -2, + "bc%y%end": -2, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_ibm_ellipse/case.py b/examples/2D_ibm_ellipse/case.py index ceb9fda4b6..d7a865ec34 100644 --- a/examples/2D_ibm_ellipse/case.py +++ b/examples/2D_ibm_ellipse/case.py @@ -53,10 +53,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_ibm_multiphase/case.py b/examples/2D_ibm_multiphase/case.py index 2223534f92..863500b8a6 100644 --- a/examples/2D_ibm_multiphase/case.py +++ b/examples/2D_ibm_multiphase/case.py @@ -52,10 +52,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell extrapolation at every side - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_ibm_steady_shock/case.py b/examples/2D_ibm_steady_shock/case.py index 9062ea754b..a09cddc90f 100644 --- a/examples/2D_ibm_steady_shock/case.py +++ b/examples/2D_ibm_steady_shock/case.py @@ -84,10 +84,10 @@ # Use the HLLC Riemann solver "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, @@ -128,19 +128,19 @@ "patch_icpp(2)%v0": 0.0e00, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "F", - "bc_x%grcbc_vel_out": "F", - "bc_x%vel_in(1)": vel, - "bc_x%vel_in(2)": 0, - "bc_x%vel_in(3)": 0, - "bc_x%pres_in": delta * patm, - "bc_x%alpha_rho_in(1)": beta * rhoatm, - "bc_x%alpha_in(1)": 1, - "bc_x%vel_out(1)": vel, - "bc_x%vel_out(2)": 0, - "bc_x%vel_out(3)": 0, - "bc_x%pres_out": 1.0, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "F", + "bc%x%grcbc_vel_out": "F", + "bc%x%vel_in(1)": vel, + "bc%x%vel_in(2)": 0, + "bc%x%vel_in(3)": 0, + "bc%x%pres_in": delta * patm, + "bc%x%alpha_rho_in(1)": beta * rhoatm, + "bc%x%alpha_in(1)": 1, + "bc%x%vel_out(1)": vel, + "bc%x%vel_out(2)": 0, + "bc%x%vel_out(3)": 0, + "bc%x%pres_out": 1.0, # Patch: Cylinder Immersed Boundary "patch_ib(1)%geometry": 4, "patch_ib(1)%x_centroid": 1.5e-03 / x0, diff --git a/examples/2D_ibm_stl_MFCCharacter/case.py b/examples/2D_ibm_stl_MFCCharacter/case.py index a5f8466c4d..f882341fc7 100644 --- a/examples/2D_ibm_stl_MFCCharacter/case.py +++ b/examples/2D_ibm_stl_MFCCharacter/case.py @@ -44,10 +44,10 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "T", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/2D_ibm_stl_test/case.py b/examples/2D_ibm_stl_test/case.py index d3055a66a5..965c0ceefd 100644 --- a/examples/2D_ibm_stl_test/case.py +++ b/examples/2D_ibm_stl_test/case.py @@ -45,10 +45,10 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "F", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/2D_ibm_stl_wedge/case.py b/examples/2D_ibm_stl_wedge/case.py index a43267ac0d..c1b51cb7ef 100644 --- a/examples/2D_ibm_stl_wedge/case.py +++ b/examples/2D_ibm_stl_wedge/case.py @@ -45,10 +45,10 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "T", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/2D_isentropicvortex/case.py b/examples/2D_isentropicvortex/case.py index c1d80a63b1..282bdc8024 100644 --- a/examples/2D_isentropicvortex/case.py +++ b/examples/2D_isentropicvortex/case.py @@ -84,10 +84,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -4, - "bc_x%end": -4, - "bc_y%beg": -4, - "bc_y%end": -4, + "bc%x%beg": -4, + "bc%x%end": -4, + "bc%y%beg": -4, + "bc%y%end": -4, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_isentropicvortex_analytical/case.py b/examples/2D_isentropicvortex_analytical/case.py index 84e8bddb2a..f2f4788250 100644 --- a/examples/2D_isentropicvortex_analytical/case.py +++ b/examples/2D_isentropicvortex_analytical/case.py @@ -84,10 +84,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -4, - "bc_x%end": -4, - "bc_y%beg": -4, - "bc_y%end": -4, + "bc%x%beg": -4, + "bc%x%end": -4, + "bc%y%beg": -4, + "bc%y%end": -4, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_jet/case.py b/examples/2D_jet/case.py index 7da489c055..4e3ad58418 100644 --- a/examples/2D_jet/case.py +++ b/examples/2D_jet/case.py @@ -64,10 +64,10 @@ "avg_state": 2, "elliptic_smoothing": "T", "elliptic_smoothing_iters": 50, - "bc_x%beg": -2, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "num_bc_patches": 1, "patch_bc(1)%dir": 1, "patch_bc(1)%loc": -1, diff --git a/examples/2D_jet_in_crossflow/case_2D_jicf.py b/examples/2D_jet_in_crossflow/case_2D_jicf.py index 5a698de0d4..41d18ece02 100644 --- a/examples/2D_jet_in_crossflow/case_2D_jicf.py +++ b/examples/2D_jet_in_crossflow/case_2D_jicf.py @@ -61,10 +61,10 @@ "avg_state": 2, "elliptic_smoothing": "T", "elliptic_smoothing_iters": 10, # 50, - "bc_x%beg": -17, - "bc_x%end": -12, - "bc_y%beg": -17, - "bc_y%end": -3, + "bc%x%beg": -17, + "bc%x%end": -12, + "bc%y%beg": -17, + "bc%y%end": -3, "num_bc_patches": 0, # Formatted Database File Structures "format": 1, diff --git a/examples/2D_kelvin_helmholtz/case.py b/examples/2D_kelvin_helmholtz/case.py index e6873f8145..d1a58dcb78 100644 --- a/examples/2D_kelvin_helmholtz/case.py +++ b/examples/2D_kelvin_helmholtz/case.py @@ -40,10 +40,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_lagrange_bubblescreen/case.py b/examples/2D_lagrange_bubblescreen/case.py index eba8edb699..7a1ed33664 100644 --- a/examples/2D_lagrange_bubblescreen/case.py +++ b/examples/2D_lagrange_bubblescreen/case.py @@ -89,10 +89,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -1, + "bc%y%end": -1, # Acoustic source "acoustic_source": "T", "num_source": 1, diff --git a/examples/2D_laplace_pressure_jump/case.py b/examples/2D_laplace_pressure_jump/case.py index ec1b2a32a8..c86c86a0f2 100644 --- a/examples/2D_laplace_pressure_jump/case.py +++ b/examples/2D_laplace_pressure_jump/case.py @@ -55,10 +55,10 @@ "weno_Re_flux": "F", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -3, - "bc_y%beg": -2, - "bc_y%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, + "bc%y%beg": -2, + "bc%y%end": -3, "num_patches": 2, "num_fluids": 2, "weno_avg": "T", diff --git a/examples/2D_lid_driven_cavity/case.py b/examples/2D_lid_driven_cavity/case.py index 657d6b00b9..1548f68f9b 100644 --- a/examples/2D_lid_driven_cavity/case.py +++ b/examples/2D_lid_driven_cavity/case.py @@ -37,11 +37,11 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -16, - "bc_x%end": -16, - "bc_y%beg": -16, - "bc_y%end": -16, - "bc_y%ve1": 0.5, + "bc%x%beg": -16, + "bc%x%end": -16, + "bc%y%beg": -16, + "bc%y%end": -16, + "bc%y%ve1": 0.5, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_lungwave/case.py b/examples/2D_lungwave/case.py index badea226f7..c4e325a9b3 100644 --- a/examples/2D_lungwave/case.py +++ b/examples/2D_lungwave/case.py @@ -118,10 +118,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_lungwave_horizontal/case.py b/examples/2D_lungwave_horizontal/case.py index 0c9d2632a3..d1911cf547 100644 --- a/examples/2D_lungwave_horizontal/case.py +++ b/examples/2D_lungwave_horizontal/case.py @@ -114,10 +114,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_mhd_magnetic_vortex/case.py b/examples/2D_mhd_magnetic_vortex/case.py index 7297472089..1c0bd2d4d4 100644 --- a/examples/2D_mhd_magnetic_vortex/case.py +++ b/examples/2D_mhd_magnetic_vortex/case.py @@ -42,10 +42,10 @@ "riemann_solver": 4, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_mhd_rotor/case.py b/examples/2D_mhd_rotor/case.py index e05000ddad..d112112ce6 100644 --- a/examples/2D_mhd_rotor/case.py +++ b/examples/2D_mhd_rotor/case.py @@ -36,10 +36,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_mibm_cylinder_in_cross_flow/case.py b/examples/2D_mibm_cylinder_in_cross_flow/case.py index 07adb3b491..1cfb05d13e 100644 --- a/examples/2D_mibm_cylinder_in_cross_flow/case.py +++ b/examples/2D_mibm_cylinder_in_cross_flow/case.py @@ -53,10 +53,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_mibm_shock_cylinder/case.py b/examples/2D_mibm_shock_cylinder/case.py index 69aca0cc9b..65f808eb1e 100644 --- a/examples/2D_mibm_shock_cylinder/case.py +++ b/examples/2D_mibm_shock_cylinder/case.py @@ -74,10 +74,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -17, - "bc_x%end": -8, - "bc_y%beg": -15, - "bc_y%end": -15, + "bc%x%beg": -17, + "bc%x%end": -8, + "bc%y%beg": -15, + "bc%y%end": -15, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_mixing_artificial_Ma/case.py b/examples/2D_mixing_artificial_Ma/case.py index c14b7b8f16..b8e3ea45ea 100644 --- a/examples/2D_mixing_artificial_Ma/case.py +++ b/examples/2D_mixing_artificial_Ma/case.py @@ -81,10 +81,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -6, + "bc%y%end": -6, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_orszag_tang/case.py b/examples/2D_orszag_tang/case.py index f01a4828ba..6c2409340c 100644 --- a/examples/2D_orszag_tang/case.py +++ b/examples/2D_orszag_tang/case.py @@ -35,10 +35,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_orszag_tang_hyper_cleaning/case.py b/examples/2D_orszag_tang_hyper_cleaning/case.py index f062c344c0..6c2c049152 100644 --- a/examples/2D_orszag_tang_hyper_cleaning/case.py +++ b/examples/2D_orszag_tang_hyper_cleaning/case.py @@ -36,10 +36,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_patch_modal_shape/case.py b/examples/2D_patch_modal_shape/case.py index c1be303320..a82b5b2387 100644 --- a/examples/2D_patch_modal_shape/case.py +++ b/examples/2D_patch_modal_shape/case.py @@ -56,10 +56,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, - "bc_y%beg": -8, - "bc_y%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, + "bc%y%beg": -8, + "bc%y%end": -8, "format": 1, "precision": 2, "prim_vars_wrt": "T", @@ -96,14 +96,14 @@ "patch_icpp(2)%alpha(1)": 0.0, "patch_icpp(2)%alpha(2)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", - "bc_x%grcbc_in": "F", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "F", - "bc_x%pres_out": p_inf, - "bc_y%grcbc_in": "F", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "F", - "bc_y%pres_out": p_inf, + "bc%x%grcbc_in": "F", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "F", + "bc%x%pres_out": p_inf, + "bc%y%grcbc_in": "F", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "F", + "bc%y%pres_out": p_inf, "fluid_pp(1)%gamma": 1.0 / (gam - 1.0), "fluid_pp(1)%pi_inf": 0.0, "fluid_pp(2)%gamma": 1.0 / (gam - 1.0), diff --git a/examples/2D_patch_modal_shape_exp/case.py b/examples/2D_patch_modal_shape_exp/case.py index 9d1873e4d5..310b2fe9e1 100644 --- a/examples/2D_patch_modal_shape_exp/case.py +++ b/examples/2D_patch_modal_shape_exp/case.py @@ -58,10 +58,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, - "bc_y%beg": -8, - "bc_y%end": -8, + "bc%x%beg": -8, + "bc%x%end": -8, + "bc%y%beg": -8, + "bc%y%end": -8, "format": 1, "precision": 2, "prim_vars_wrt": "T", @@ -98,14 +98,14 @@ "patch_icpp(2)%alpha(1)": 0.0, "patch_icpp(2)%alpha(2)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", - "bc_x%grcbc_in": "F", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "F", - "bc_x%pres_out": p_inf, - "bc_y%grcbc_in": "F", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "F", - "bc_y%pres_out": p_inf, + "bc%x%grcbc_in": "F", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "F", + "bc%x%pres_out": p_inf, + "bc%y%grcbc_in": "F", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "F", + "bc%y%pres_out": p_inf, "fluid_pp(1)%gamma": 1.0 / (gam - 1.0), "fluid_pp(1)%pi_inf": 0.0, "fluid_pp(2)%gamma": 1.0 / (gam - 1.0), diff --git a/examples/2D_phasechange_bubble/case.py b/examples/2D_phasechange_bubble/case.py index 4ec49144fe..93c57f6867 100644 --- a/examples/2D_phasechange_bubble/case.py +++ b/examples/2D_phasechange_bubble/case.py @@ -227,10 +227,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -2, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_rayleigh_taylor/case.py b/examples/2D_rayleigh_taylor/case.py index 498daadbcd..db9078f7af 100644 --- a/examples/2D_rayleigh_taylor/case.py +++ b/examples/2D_rayleigh_taylor/case.py @@ -58,10 +58,10 @@ "weno_Re_flux": "T", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -2, - "bc_y%beg": -16, - "bc_y%end": -16, + "bc%x%beg": -2, + "bc%x%end": -2, + "bc%y%beg": -16, + "bc%y%end": -16, "num_patches": 1, "num_fluids": 2, "viscous": "T", diff --git a/examples/2D_richtmyer_meshkov/case.py b/examples/2D_richtmyer_meshkov/case.py index fed6529c55..e65b74f641 100644 --- a/examples/2D_richtmyer_meshkov/case.py +++ b/examples/2D_richtmyer_meshkov/case.py @@ -44,10 +44,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -17, - "bc_x%end": -17, - "bc_y%beg": -15, - "bc_y%end": -15, + "bc%x%beg": -17, + "bc%x%end": -17, + "bc%y%beg": -15, + "bc%y%end": -15, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_riemann_test/case.py b/examples/2D_riemann_test/case.py index 8680984f23..3084aafcd0 100644 --- a/examples/2D_riemann_test/case.py +++ b/examples/2D_riemann_test/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_riemann_test_muscl/case.py b/examples/2D_riemann_test_muscl/case.py index f21bbea559..26f5755a61 100644 --- a/examples/2D_riemann_test_muscl/case.py +++ b/examples/2D_riemann_test_muscl/case.py @@ -37,10 +37,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_shearlayer/case.py b/examples/2D_shearlayer/case.py index 40edaf48b2..bb548f4f64 100644 --- a/examples/2D_shearlayer/case.py +++ b/examples/2D_shearlayer/case.py @@ -38,10 +38,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -5, - "bc_y%end": -5, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -5, + "bc%y%end": -5, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_shock_cloud_rmhd/case.py b/examples/2D_shock_cloud_rmhd/case.py index 3898b970a7..8f9f78701a 100644 --- a/examples/2D_shock_cloud_rmhd/case.py +++ b/examples/2D_shock_cloud_rmhd/case.py @@ -39,10 +39,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -2, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -2, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_shockbubble/case.py b/examples/2D_shockbubble/case.py index 6a195c7a2f..f8ba247904 100644 --- a/examples/2D_shockbubble/case.py +++ b/examples/2D_shockbubble/case.py @@ -55,10 +55,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_shockdroplet/case.py b/examples/2D_shockdroplet/case.py index f75e2296df..c21f36b92b 100755 --- a/examples/2D_shockdroplet/case.py +++ b/examples/2D_shockdroplet/case.py @@ -66,10 +66,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, # 11, - "bc_x%end": -6, # 12 - "bc_y%beg": -2, - "bc_y%end": -3, + "bc%x%beg": -6, # 11, + "bc%x%end": -6, # 12 + "bc%y%beg": -2, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_shockdroplet_muscl/case.py b/examples/2D_shockdroplet_muscl/case.py index 0de30d0529..9f979517e1 100755 --- a/examples/2D_shockdroplet_muscl/case.py +++ b/examples/2D_shockdroplet_muscl/case.py @@ -64,10 +64,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, # 11, - "bc_x%end": -6, # 12 - "bc_y%beg": -2, - "bc_y%end": -3, + "bc%x%beg": -6, # 11, + "bc%x%end": -6, # 12 + "bc%y%beg": -2, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_shocktube_phasechange/case.py b/examples/2D_shocktube_phasechange/case.py index fe4614316e..0f5825f2cb 100644 --- a/examples/2D_shocktube_phasechange/case.py +++ b/examples/2D_shocktube_phasechange/case.py @@ -197,10 +197,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_triple_point/case.py b/examples/2D_triple_point/case.py index a67ebe8cce..45c8c3cb49 100755 --- a/examples/2D_triple_point/case.py +++ b/examples/2D_triple_point/case.py @@ -42,10 +42,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, # 11, - "bc_x%end": -3, # 12 - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, # 11, + "bc%x%end": -3, # 12 + "bc%y%beg": -3, + "bc%y%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_tumbling_rectangle/case.py b/examples/2D_tumbling_rectangle/case.py index 8e71160f0f..6bd211c76a 100644 --- a/examples/2D_tumbling_rectangle/case.py +++ b/examples/2D_tumbling_rectangle/case.py @@ -53,10 +53,10 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/2D_viscous/case.py b/examples/2D_viscous/case.py index f525067b29..20f7285171 100644 --- a/examples/2D_viscous/case.py +++ b/examples/2D_viscous/case.py @@ -50,10 +50,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -6, + "bc%y%end": -6, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_viscous_shock_tube/case.py b/examples/2D_viscous_shock_tube/case.py index 7c760e696b..8b6a9bde84 100644 --- a/examples/2D_viscous_shock_tube/case.py +++ b/examples/2D_viscous_shock_tube/case.py @@ -42,10 +42,10 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 1, - "bc_x%beg": -8, - "bc_x%end": -15, - "bc_y%beg": -16, - "bc_y%end": -5, + "bc%x%beg": -8, + "bc%x%end": -15, + "bc%y%beg": -16, + "bc%y%end": -5, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_whale_bubble_annulus/case.py b/examples/2D_whale_bubble_annulus/case.py index e6de0dca20..28cd605196 100755 --- a/examples/2D_whale_bubble_annulus/case.py +++ b/examples/2D_whale_bubble_annulus/case.py @@ -73,10 +73,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/2D_zero_circ_vortex/case.py b/examples/2D_zero_circ_vortex/case.py index a400cb02e5..1fef44faa5 100644 --- a/examples/2D_zero_circ_vortex/case.py +++ b/examples/2D_zero_circ_vortex/case.py @@ -54,10 +54,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, @@ -87,19 +87,19 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "T", - "bc_x%vel_in(1)": u_inf, - "bc_x%vel_in(2)": 0, - "bc_x%vel_in(3)": 0, - "bc_x%pres_in": p_inf, - "bc_x%alpha_rho_in(1)": rho_inf, - "bc_x%alpha_in(1)": 1, - "bc_x%vel_out(1)": u_inf, - "bc_x%vel_out(2)": 0, - "bc_x%vel_out(3)": 0, - "bc_x%pres_out": p_inf, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "T", + "bc%x%vel_in(1)": u_inf, + "bc%x%vel_in(2)": 0, + "bc%x%vel_in(3)": 0, + "bc%x%pres_in": p_inf, + "bc%x%alpha_rho_in(1)": rho_inf, + "bc%x%alpha_in(1)": 1, + "bc%x%vel_out(1)": u_inf, + "bc%x%vel_out(2)": 0, + "bc%x%vel_out(3)": 0, + "bc%x%pres_out": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_zero_circ_vortex_analytical/case.py b/examples/2D_zero_circ_vortex_analytical/case.py index da28a8c43e..23491a8742 100644 --- a/examples/2D_zero_circ_vortex_analytical/case.py +++ b/examples/2D_zero_circ_vortex_analytical/case.py @@ -54,10 +54,10 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%y%beg": -6, + "bc%y%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, @@ -88,19 +88,19 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "T", - "bc_x%vel_in(1)": u_inf, - "bc_x%vel_in(2)": 0, - "bc_x%vel_in(3)": 0, - "bc_x%pres_in": p_inf, - "bc_x%alpha_rho_in(1)": rho_inf, - "bc_x%alpha_in(1)": 1, - "bc_x%vel_out(1)": u_inf, - "bc_x%vel_out(2)": 0, - "bc_x%vel_out(3)": 0, - "bc_x%pres_out": p_inf, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "T", + "bc%x%vel_in(1)": u_inf, + "bc%x%vel_in(2)": 0, + "bc%x%vel_in(3)": 0, + "bc%x%pres_in": p_inf, + "bc%x%alpha_rho_in(1)": rho_inf, + "bc%x%alpha_in(1)": 1, + "bc%x%vel_out(1)": u_inf, + "bc%x%vel_out(2)": 0, + "bc%x%vel_out(3)": 0, + "bc%x%pres_out": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/3D_IGR_33jet/case.py b/examples/3D_IGR_33jet/case.py index f999ad4494..b497a4b499 100644 --- a/examples/3D_IGR_33jet/case.py +++ b/examples/3D_IGR_33jet/case.py @@ -60,12 +60,12 @@ "num_igr_iters": igrIters, "num_igr_warm_start_iters": 10 * igrIters, "alf_factor": 10, - "bc_x%beg": -17, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -17, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 1, diff --git a/examples/3D_IGR_TaylorGreenVortex/case.py b/examples/3D_IGR_TaylorGreenVortex/case.py index 79553de313..4ae5b92aa2 100644 --- a/examples/3D_IGR_TaylorGreenVortex/case.py +++ b/examples/3D_IGR_TaylorGreenVortex/case.py @@ -50,12 +50,12 @@ "num_fluids": 1, "time_stepper": 3, "riemann_solver": 5, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "igr": "T", "igr_order": 5, "igr_iter_solver": 1, diff --git a/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py b/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py index df1c2d202f..72ef919db0 100644 --- a/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py +++ b/examples/3D_IGR_TaylorGreenVortex_nvidia/case.py @@ -55,12 +55,12 @@ "num_fluids": 1, "time_stepper": 3, "riemann_solver": 5, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "igr": "T", "igr_order": 5, "igr_iter_solver": 1, diff --git a/examples/3D_IGR_jet/case.py b/examples/3D_IGR_jet/case.py index 9529615996..fbac9aab95 100644 --- a/examples/3D_IGR_jet/case.py +++ b/examples/3D_IGR_jet/case.py @@ -86,12 +86,12 @@ "num_igr_iters": igrIters, "num_igr_warm_start_iters": 10 * igrIters, "alf_factor": 10, - "bc_x%beg": -17, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -17, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_IGR_jet_1fluid/case.py b/examples/3D_IGR_jet_1fluid/case.py index 6837a5deec..251bf0ebd3 100644 --- a/examples/3D_IGR_jet_1fluid/case.py +++ b/examples/3D_IGR_jet_1fluid/case.py @@ -61,12 +61,12 @@ "num_igr_iters": igrIters, "num_igr_warm_start_iters": igrIters, "alf_factor": 10, - "bc_x%beg": -17, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -17, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_TaylorGreenVortex/case.py b/examples/3D_TaylorGreenVortex/case.py index e6df484570..a563ee1143 100644 --- a/examples/3D_TaylorGreenVortex/case.py +++ b/examples/3D_TaylorGreenVortex/case.py @@ -59,12 +59,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/3D_TaylorGreenVortex_analytical/case.py b/examples/3D_TaylorGreenVortex_analytical/case.py index 11cab03bdb..54d4870d4a 100644 --- a/examples/3D_TaylorGreenVortex_analytical/case.py +++ b/examples/3D_TaylorGreenVortex_analytical/case.py @@ -59,12 +59,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/3D_acoustic_support11/case.py b/examples/3D_acoustic_support11/case.py index 19625bbce6..5ea0680780 100644 --- a/examples/3D_acoustic_support11/case.py +++ b/examples/3D_acoustic_support11/case.py @@ -39,12 +39,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -6, - "bc_z%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, + "bc%z%beg": -6, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_acoustic_support3/case.py b/examples/3D_acoustic_support3/case.py index 5548ce8399..bee313cbc9 100644 --- a/examples/3D_acoustic_support3/case.py +++ b/examples/3D_acoustic_support3/case.py @@ -39,12 +39,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -6, - "bc_z%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, + "bc%z%beg": -6, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_acoustic_support7/case.py b/examples/3D_acoustic_support7/case.py index 1a3333ae13..23738f886b 100644 --- a/examples/3D_acoustic_support7/case.py +++ b/examples/3D_acoustic_support7/case.py @@ -38,12 +38,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -6, - "bc_z%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, + "bc%z%beg": -6, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_advection_convergence/case.py b/examples/3D_advection_convergence/case.py index eeb33b071b..f0a3953a01 100644 --- a/examples/3D_advection_convergence/case.py +++ b/examples/3D_advection_convergence/case.py @@ -88,12 +88,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/3D_brio_wu/case.py b/examples/3D_brio_wu/case.py index 08e3e7ca3c..2a4fe5e19e 100644 --- a/examples/3D_brio_wu/case.py +++ b/examples/3D_brio_wu/case.py @@ -39,12 +39,12 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_ibm_bowshock/case.py b/examples/3D_ibm_bowshock/case.py index bd54f07f05..a5d91121f2 100644 --- a/examples/3D_ibm_bowshock/case.py +++ b/examples/3D_ibm_bowshock/case.py @@ -58,12 +58,12 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell extrapolation - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/3D_ibm_stl_ellipsoid/case.py b/examples/3D_ibm_stl_ellipsoid/case.py index 408ffe4ec7..0f41bf7ffe 100644 --- a/examples/3D_ibm_stl_ellipsoid/case.py +++ b/examples/3D_ibm_stl_ellipsoid/case.py @@ -48,12 +48,12 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "T", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/3D_ibm_stl_pyramid/case.py b/examples/3D_ibm_stl_pyramid/case.py index 220f6c88e6..a10f7e5f3a 100644 --- a/examples/3D_ibm_stl_pyramid/case.py +++ b/examples/3D_ibm_stl_pyramid/case.py @@ -48,12 +48,12 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "T", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/3D_ibm_stl_test/case.py b/examples/3D_ibm_stl_test/case.py index 8ae6334e10..7301486a9b 100644 --- a/examples/3D_ibm_stl_test/case.py +++ b/examples/3D_ibm_stl_test/case.py @@ -48,12 +48,12 @@ "riemann_solver": 2, "wave_speeds": 1, "viscous": "F", - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, "ib": "T", "num_ibs": 1, # Formatted Database Files Structure Parameters diff --git a/examples/3D_lagrange_bubblescreen/case.py b/examples/3D_lagrange_bubblescreen/case.py index ab61ffbe42..f3f68b1344 100644 --- a/examples/3D_lagrange_bubblescreen/case.py +++ b/examples/3D_lagrange_bubblescreen/case.py @@ -94,12 +94,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, # Acoustic source "acoustic_source": "T", "num_source": 1, diff --git a/examples/3D_lagrange_shbubcollapse/case.py b/examples/3D_lagrange_shbubcollapse/case.py index 73e0b88f69..9c8304512f 100644 --- a/examples/3D_lagrange_shbubcollapse/case.py +++ b/examples/3D_lagrange_shbubcollapse/case.py @@ -97,12 +97,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -6, - "bc_z%end": -6, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, + "bc%z%beg": -6, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_mibm_sphere_head_on_collision/case.py b/examples/3D_mibm_sphere_head_on_collision/case.py index 0a2fe3ba67..a23c68e495 100644 --- a/examples/3D_mibm_sphere_head_on_collision/case.py +++ b/examples/3D_mibm_sphere_head_on_collision/case.py @@ -74,12 +74,12 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -15, - "bc_y%end": -15, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -15, + "bc%y%end": -15, + "bc%z%beg": -3, + "bc%z%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/3D_patch_spherical_harmonic/case.py b/examples/3D_patch_spherical_harmonic/case.py index dc0314a869..2348830545 100644 --- a/examples/3D_patch_spherical_harmonic/case.py +++ b/examples/3D_patch_spherical_harmonic/case.py @@ -58,24 +58,24 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -8, - "bc_x%end": -8, - "bc_y%beg": -8, - "bc_y%end": -8, - "bc_z%beg": -8, - "bc_z%end": -8, - "bc_x%grcbc_in": "F", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "F", - "bc_x%pres_out": p_inf, - "bc_y%grcbc_in": "F", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "F", - "bc_y%pres_out": p_inf, - "bc_z%grcbc_in": "F", - "bc_z%grcbc_out": "T", - "bc_z%grcbc_vel_out": "F", - "bc_z%pres_out": p_inf, + "bc%x%beg": -8, + "bc%x%end": -8, + "bc%y%beg": -8, + "bc%y%end": -8, + "bc%z%beg": -8, + "bc%z%end": -8, + "bc%x%grcbc_in": "F", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "F", + "bc%x%pres_out": p_inf, + "bc%y%grcbc_in": "F", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "F", + "bc%y%pres_out": p_inf, + "bc%z%grcbc_in": "F", + "bc%z%grcbc_out": "T", + "bc%z%grcbc_vel_out": "F", + "bc%z%pres_out": p_inf, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/3D_performance_test/case.py b/examples/3D_performance_test/case.py index f851865759..602da8eb4f 100644 --- a/examples/3D_performance_test/case.py +++ b/examples/3D_performance_test/case.py @@ -52,12 +52,12 @@ "mp_weno": "F", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, - "bc_z%beg": -2, - "bc_z%end": -6, + "bc%x%beg": -2, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, + "bc%z%beg": -2, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_phasechange_bubble/case.py b/examples/3D_phasechange_bubble/case.py index 9d9fbf6d34..672d9a9504 100644 --- a/examples/3D_phasechange_bubble/case.py +++ b/examples/3D_phasechange_bubble/case.py @@ -234,12 +234,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, - "bc_z%beg": -2, - "bc_z%end": -6, + "bc%x%beg": -2, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, + "bc%z%beg": -2, + "bc%z%end": -6, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_rayleigh_taylor/case.py b/examples/3D_rayleigh_taylor/case.py index 74d1e838a7..a476a5ffba 100644 --- a/examples/3D_rayleigh_taylor/case.py +++ b/examples/3D_rayleigh_taylor/case.py @@ -63,12 +63,12 @@ "weno_Re_flux": "T", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -3, - "bc_y%beg": -16, - "bc_y%end": -16, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, + "bc%y%beg": -16, + "bc%y%end": -16, + "bc%z%beg": -2, + "bc%z%end": -3, "num_patches": 1, "num_fluids": 2, "viscous": "T", diff --git a/examples/3D_rayleigh_taylor_muscl/case.py b/examples/3D_rayleigh_taylor_muscl/case.py index e9f2ce8b32..7133886a28 100644 --- a/examples/3D_rayleigh_taylor_muscl/case.py +++ b/examples/3D_rayleigh_taylor_muscl/case.py @@ -61,12 +61,12 @@ "avg_state": 2, "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -3, - "bc_y%beg": -16, - "bc_y%end": -16, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, + "bc%y%beg": -16, + "bc%y%end": -16, + "bc%z%beg": -2, + "bc%z%end": -3, "num_patches": 1, "num_fluids": 2, "viscous": "T", diff --git a/examples/3D_recovering_sphere/case.py b/examples/3D_recovering_sphere/case.py index 9a92c654a2..bad5cb94fa 100644 --- a/examples/3D_recovering_sphere/case.py +++ b/examples/3D_recovering_sphere/case.py @@ -61,12 +61,12 @@ "weno_Re_flux": "F", "riemann_solver": 2, "wave_speeds": 1, - "bc_x%beg": -2, - "bc_x%end": -3, - "bc_y%beg": -2, - "bc_y%end": -3, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -2, + "bc%x%end": -3, + "bc%y%beg": -2, + "bc%y%end": -3, + "bc%z%beg": -2, + "bc%z%end": -3, "num_patches": 2, "num_fluids": 2, "weno_avg": "T", diff --git a/examples/3D_rotating_sphere/case.py b/examples/3D_rotating_sphere/case.py index 59282de860..e218c2f491 100644 --- a/examples/3D_rotating_sphere/case.py +++ b/examples/3D_rotating_sphere/case.py @@ -53,12 +53,12 @@ "riemann_solver": 2, "wave_speeds": 1, # We use ghost-cell - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Set IB to True and add 1 patch "ib": "T", "num_ibs": 1, diff --git a/examples/3D_shockdroplet/case.py b/examples/3D_shockdroplet/case.py index bd1c663e67..f50954447a 100644 --- a/examples/3D_shockdroplet/case.py +++ b/examples/3D_shockdroplet/case.py @@ -207,12 +207,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -3, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -3, + "bc%z%beg": -2, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_shockdroplet_muscl/case.py b/examples/3D_shockdroplet_muscl/case.py index e478f65046..32ce0a1a0f 100644 --- a/examples/3D_shockdroplet_muscl/case.py +++ b/examples/3D_shockdroplet_muscl/case.py @@ -206,12 +206,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -3, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -3, + "bc%z%beg": -2, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/3D_sphbubcollapse/case.py b/examples/3D_sphbubcollapse/case.py index 95b92135d2..831004694a 100644 --- a/examples/3D_sphbubcollapse/case.py +++ b/examples/3D_sphbubcollapse/case.py @@ -72,12 +72,12 @@ "wave_speeds": 1, # We use reflective boundary conditions at octant edges and # non-reflective boundary conditions at the domain edges - "bc_x%beg": -2, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -6, - "bc_z%beg": -2, - "bc_z%end": -6, + "bc%x%beg": -2, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -6, + "bc%z%beg": -2, + "bc%z%end": -6, # Formatted Database Files Structure Parameters # Export primitive variables in double precision with parallel # I/O to minimize I/O computational time during large simulations diff --git a/examples/3D_turb_mixing/case.py b/examples/3D_turb_mixing/case.py index 5ef0adc43b..390974cb3d 100644 --- a/examples/3D_turb_mixing/case.py +++ b/examples/3D_turb_mixing/case.py @@ -78,12 +78,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -6, - "bc_y%end": -6, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -6, + "bc%y%end": -6, + "bc%z%beg": -1, + "bc%z%end": -1, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/nD_perfect_reactor/case.py b/examples/nD_perfect_reactor/case.py index d0000deb89..589f64fe42 100644 --- a/examples/nD_perfect_reactor/case.py +++ b/examples/nD_perfect_reactor/case.py @@ -77,12 +77,12 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/examples/scaling/benchmark.py b/examples/scaling/benchmark.py index a3d2620555..2744cce034 100644 --- a/examples/scaling/benchmark.py +++ b/examples/scaling/benchmark.py @@ -187,12 +187,12 @@ def nxyz_from_ncells_strong(ncells: float) -> typing.Tuple[int, int, int]: "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/src/common/m_boundary_common.fpp b/src/common/m_boundary_common.fpp index 5bb805469a..f5e2a415bf 100644 --- a/src/common/m_boundary_common.fpp +++ b/src/common/m_boundary_common.fpp @@ -84,7 +84,7 @@ contains ! BC type codes defined in m_constants.fpp; non-negative values are MPI boundaries - if (bc_x%beg >= 0) then + if (bc%x%beg >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 1, -1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -114,7 +114,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_x%end >= 0) then + if (bc%x%end >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 1, 1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -149,7 +149,7 @@ contains if (n == 0) return #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 - if (bc_y%beg >= 0) then + if (bc%y%beg >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 2, -1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -181,7 +181,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_y%end >= 0) then + if (bc%y%end >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 2, 1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -217,7 +217,7 @@ contains if (p == 0) return #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 - if (bc_z%beg >= 0) then + if (bc%z%beg >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 3, -1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -247,7 +247,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_z%end >= 0) then + if (bc%z%end >= 0) then call s_mpi_sendrecv_variables_buffers(q_prim_vf, 3, 1, sys_size, pb_in, mv_in, q_T_sf) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -291,7 +291,7 @@ contains type(scalar_field), optional, intent(inout) :: q_T_sf if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(0, k, l) @@ -302,7 +302,7 @@ contains q_T_sf%sf(-j, k, l) = q_T_sf%sf(0, k, l) end do end if - else !< bc_x%end + else !< bc%x%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m, k, l) @@ -315,7 +315,7 @@ contains end if end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, 0, l) @@ -327,7 +327,7 @@ contains q_T_sf%sf(k, -j, l) = q_T_sf%sf(k, 0, l) end do end if - else !< bc_y%end + else !< bc%y%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n, l) @@ -340,7 +340,7 @@ contains end if end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, 0) @@ -351,7 +351,7 @@ contains q_T_sf%sf(k, l, -j) = q_T_sf%sf(k, l, 0) end do end if - else !< bc_z%end + else !< bc%z%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p) @@ -379,7 +379,7 @@ contains type(scalar_field), optional, intent(inout) :: q_T_sf if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then !< bc_x%beg + if (bc_loc == -1) then !< bc%x%beg do j = 1, buff_size do i = 1, eqn_idx%cont%end q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(j - 1, k, l) @@ -417,7 +417,7 @@ contains end do end do end if - else !< bc_x%end + else !< bc%x%end do j = 1, buff_size do i = 1, eqn_idx%cont%end q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m - (j - 1), k, l) @@ -456,7 +456,7 @@ contains end if end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do j = 1, buff_size do i = 1, eqn_idx%mom%beg q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, j - 1, l) @@ -494,7 +494,7 @@ contains end do end do end if - else !< bc_y%end + else !< bc%y%end do j = 1, buff_size do i = 1, eqn_idx%mom%beg q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n - (j - 1), l) @@ -534,7 +534,7 @@ contains end if end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do j = 1, buff_size do i = 1, eqn_idx%mom%beg + 1 q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, j - 1) @@ -572,7 +572,7 @@ contains end do end do end if - else !< bc_z%end + else !< bc%z%end do j = 1, buff_size do i = 1, eqn_idx%mom%beg + 1 q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p - (j - 1)) @@ -627,7 +627,7 @@ contains type(scalar_field), optional, intent(inout) :: q_T_sf if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then !< bc_x%beg + if (bc_loc == -1) then !< bc%x%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(m - (j - 1), k, l) @@ -650,7 +650,7 @@ contains end do end do end if - else !< bc_x%end + else !< bc%x%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(j - 1, k, l) @@ -675,7 +675,7 @@ contains end if end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, n - (j - 1), l) @@ -698,7 +698,7 @@ contains end do end do end if - else !< bc_y%end + else !< bc%y%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, j - 1, l) @@ -723,7 +723,7 @@ contains end if end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, p - (j - 1)) @@ -746,7 +746,7 @@ contains end do end do end if - else !< bc_z%end + else !< bc%z%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, j - 1) @@ -840,11 +840,11 @@ contains type(scalar_field), optional, intent(inout) :: q_T_sf if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then !< bc_x%beg + if (bc_loc == -1) then !< bc%x%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb1 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb1 else q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(0, k, l) end if @@ -852,9 +852,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_x%isothermal_in) then + if (bc%x%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(-j, k, l) = 2._wp*bc_x%Twall_in - q_T_sf%sf(j - 1, k, l) + q_T_sf%sf(-j, k, l) = 2._wp*bc%x%Twall_in - q_T_sf%sf(j - 1, k, l) end do else do j = 1, buff_size @@ -862,11 +862,11 @@ contains end do end if end if - else !< bc_x%end + else !< bc%x%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve1 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve1 else q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m, k, l) end if @@ -874,9 +874,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_x%isothermal_out) then + if (bc%x%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(m + j, k, l) = 2._wp*bc_x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) + q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) end do else do j = 1, buff_size @@ -886,11 +886,11 @@ contains end if end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg + 1) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc_y%vb2 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb2 else q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, 0, l) end if @@ -898,9 +898,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_y%isothermal_in) then + if (bc%y%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(k, -j, l) = 2._wp*bc_y%Twall_in - q_T_sf%sf(k, j - 1, l) + q_T_sf%sf(k, -j, l) = 2._wp*bc%y%Twall_in - q_T_sf%sf(k, j - 1, l) end do else do j = 1, buff_size @@ -908,11 +908,11 @@ contains end do end if end if - else !< bc_y%end + else !< bc%y%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg + 1) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc_y%ve2 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve2 else q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n, l) end if @@ -920,9 +920,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_y%isothermal_out) then + if (bc%y%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(k, n + j, l) = 2._wp*bc_y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) + q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) end do else do j = 1, buff_size @@ -932,11 +932,11 @@ contains end if end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%end) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb3 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb3 else q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, 0) end if @@ -944,9 +944,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_z%isothermal_in) then + if (bc%z%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(k, l, -j) = 2._wp*bc_z%Twall_in - q_T_sf%sf(k, l, j - 1) + q_T_sf%sf(k, l, -j) = 2._wp*bc%z%Twall_in - q_T_sf%sf(k, l, j - 1) end do else do j = 1, buff_size @@ -954,11 +954,11 @@ contains end do end if end if - else !< bc_z%end + else !< bc%z%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%end) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve3 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve3 else q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p) end if @@ -966,9 +966,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_z%isothermal_out) then + if (bc%z%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(k, l, p + j) = 2._wp*bc_z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) + q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) end do else do j = 1, buff_size @@ -993,15 +993,15 @@ contains type(scalar_field), optional, intent(inout) :: q_T_sf if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then !< bc_x%beg + if (bc_loc == -1) then !< bc%x%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb1 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb2 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc_x%vb3 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb3 else q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(0, k, l) end if @@ -1009,9 +1009,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_x%isothermal_in) then + if (bc%x%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(-j, k, l) = 2._wp*bc_x%Twall_in - q_T_sf%sf(j - 1, k, l) + q_T_sf%sf(-j, k, l) = 2._wp*bc%x%Twall_in - q_T_sf%sf(j - 1, k, l) end do else do j = 1, buff_size @@ -1019,15 +1019,15 @@ contains end do end if end if - else !< bc_x%end + else !< bc%x%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve1 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve2 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc_x%ve3 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve3 else q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m, k, l) end if @@ -1035,9 +1035,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc_x%isothermal_out) then + if (bc%x%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(m + j, k, l) = 2._wp*bc_x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) + q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) end do else do j = 1, buff_size @@ -1047,24 +1047,24 @@ contains end if end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc_y%vb1 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc_y%vb2 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc_y%vb3 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb3 else q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, 0, l) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc_y%isothermal_in) then + if (bc%y%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(k, -j, l) = 2._wp*bc_y%Twall_in - q_T_sf%sf(k, j - 1, l) + q_T_sf%sf(k, -j, l) = 2._wp*bc%y%Twall_in - q_T_sf%sf(k, j - 1, l) end do else do j = 1, buff_size @@ -1072,24 +1072,24 @@ contains end do end if end if - else !< bc_y%end + else !< bc%y%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc_y%ve1 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc_y%ve2 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc_y%ve3 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve3 else q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n, l) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc_y%isothermal_out) then + if (bc%y%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(k, n + j, l) = 2._wp*bc_y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) + q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) end do else do j = 1, buff_size @@ -1099,24 +1099,24 @@ contains end if end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb1 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb2 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc_z%vb3 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb3 else q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, 0) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc_z%isothermal_in) then + if (bc%z%isothermal_in) then do j = 1, buff_size - q_T_sf%sf(k, l, -j) = 2._wp*bc_z%Twall_in - q_T_sf%sf(k, l, j - 1) + q_T_sf%sf(k, l, -j) = 2._wp*bc%z%Twall_in - q_T_sf%sf(k, l, j - 1) end do else do j = 1, buff_size @@ -1124,24 +1124,24 @@ contains end do end if end if - else !< bc_z%end + else !< bc%z%end do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve1 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve1 else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve2 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve2 else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc_z%ve3 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve3 else q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc_z%isothermal_out) then + if (bc%z%isothermal_out) then do j = 1, buff_size - q_T_sf%sf(k, l, p + j) = 2._wp*bc_z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) + q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) end do else do j = 1, buff_size @@ -1166,7 +1166,7 @@ contains #ifdef MFC_SIMULATION if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(-j, k, l) = bc_buffers(1, 1)%sf(i, k, l) @@ -1177,7 +1177,7 @@ contains q_T_sf%sf(-j, k, l) = bc_buffers(1, 1)%sf(sys_size + 1, k, l) end do end if - else !< bc_x%end + else !< bc%x%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(m + j, k, l) = bc_buffers(1, 2)%sf(i, k, l) @@ -1191,7 +1191,7 @@ contains end if else if (bc_dir == 2) then !< y-direction #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, -j, l) = bc_buffers(2, 1)%sf(k, i, l) @@ -1202,7 +1202,7 @@ contains q_T_sf%sf(k, -j, l) = bc_buffers(2, 1)%sf(k, sys_size + 1, l) end do end if - else !< bc_y%end + else !< bc%y%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, n + j, l) = bc_buffers(2, 2)%sf(k, i, l) @@ -1217,7 +1217,7 @@ contains #:endif else if (bc_dir == 3) then !< z-direction #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, -j) = bc_buffers(3, 1)%sf(k, l, i) @@ -1228,7 +1228,7 @@ contains q_T_sf%sf(k, l, -j) = bc_buffers(3, 1)%sf(k, l, sys_size + 1) end do end if - else !< bc_z%end + else !< bc%z%end do i = 1, sys_size do j = 1, buff_size q_prim_vf(i)%sf(k, l, p + j) = bc_buffers(3, 2)%sf(k, l, i) @@ -1258,7 +1258,7 @@ contains integer :: j, q, i if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1267,7 +1267,7 @@ contains end do end do end do - else !< bc_x%end + else !< bc%x%end do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1278,7 +1278,7 @@ contains end do end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1287,7 +1287,7 @@ contains end do end do end do - else !< bc_y%end + else !< bc%y%end do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1298,7 +1298,7 @@ contains end do end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1307,7 +1307,7 @@ contains end do end do end do - else !< bc_z%end + else !< bc%z%end do i = 1, nb do q = 1, nnode do j = 1, buff_size @@ -1467,13 +1467,13 @@ contains integer :: j, i if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(-j, k, l) = c_divs(i)%sf(m - (j - 1), k, l) end do end do - else !< bc_x%end + else !< bc%x%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(m + j, k, l) = c_divs(i)%sf(j - 1, k, l) @@ -1481,13 +1481,13 @@ contains end do end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, -j, l) = c_divs(i)%sf(k, n - (j - 1), l) end do end do - else !< bc_y%end + else !< bc%y%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, n + j, l) = c_divs(i)%sf(k, j - 1, l) @@ -1495,13 +1495,13 @@ contains end do end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, l, -j) = c_divs(i)%sf(k, l, p - (j - 1)) end do end do - else !< bc_z%end + else !< bc%z%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, l, p + j) = c_divs(i)%sf(k, l, j - 1) @@ -1522,7 +1522,7 @@ contains integer :: j, i if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1532,7 +1532,7 @@ contains end if end do end do - else !< bc_x%end + else !< bc%x%end do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1544,7 +1544,7 @@ contains end do end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1554,7 +1554,7 @@ contains end if end do end do - else !< bc_y%end + else !< bc%y%end do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1566,7 +1566,7 @@ contains end do end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1576,7 +1576,7 @@ contains end if end do end do - else !< bc_z%end + else !< bc%z%end do i = 1, num_dims + 1 do j = 1, buff_size if (i == bc_dir) then @@ -1601,13 +1601,13 @@ contains integer :: j, i if (bc_dir == 1) then !< x-direction - if (bc_loc == -1) then ! bc_x%beg + if (bc_loc == -1) then ! bc%x%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(-j, k, l) = c_divs(i)%sf(0, k, l) end do end do - else !< bc_x%end + else !< bc%x%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(m + j, k, l) = c_divs(i)%sf(m, k, l) @@ -1615,13 +1615,13 @@ contains end do end if else if (bc_dir == 2) then !< y-direction - if (bc_loc == -1) then !< bc_y%beg + if (bc_loc == -1) then !< bc%y%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, -j, l) = c_divs(i)%sf(k, 0, l) end do end do - else !< bc_y%end + else !< bc%y%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, n + j, l) = c_divs(i)%sf(k, n, l) @@ -1629,13 +1629,13 @@ contains end do end if else if (bc_dir == 3) then !< z-direction - if (bc_loc == -1) then !< bc_z%beg + if (bc_loc == -1) then !< bc%z%beg do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, l, -j) = c_divs(i)%sf(k, l, 0) end do end do - else !< bc_z%end + else !< bc%z%end do i = 1, num_dims + 1 do j = 1, buff_size c_divs(i)%sf(k, l, p + j) = c_divs(i)%sf(k, l, p) @@ -1653,7 +1653,7 @@ contains type(scalar_field), dimension(1:), intent(inout) :: jac_sf integer :: j, k, l - if (bc_x%beg >= 0) then + if (bc%x%beg >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 1, -1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -1678,7 +1678,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_x%end >= 0) then + if (bc%x%end >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 1, 1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -1706,7 +1706,7 @@ contains #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (n == 0) then return - else if (bc_y%beg >= 0) then + else if (bc%y%beg >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 2, -1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -1731,7 +1731,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_y%end >= 0) then + if (bc%y%end >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 2, 1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -1760,7 +1760,7 @@ contains #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (p == 0) then return - else if (bc_z%beg >= 0) then + else if (bc%z%beg >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 3, -1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -1785,7 +1785,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bc_z%end >= 0) then + if (bc%z%end >= 0) then call s_mpi_sendrecv_variables_buffers(jac_sf, 3, 1, 1) else $:GPU_PARALLEL_LOOP(private='[l, k]', collapse=2) @@ -2122,19 +2122,19 @@ contains type(integer_field), dimension(1:num_dims,1:2), intent(in) :: bc_type - bc_type(1, 1)%sf(:,:,:) = int(min(bc_x%beg, 0), kind=1) - bc_type(1, 2)%sf(:,:,:) = int(min(bc_x%end, 0), kind=1) + bc_type(1, 1)%sf(:,:,:) = int(min(bc%x%beg, 0), kind=1) + bc_type(1, 2)%sf(:,:,:) = int(min(bc%x%end, 0), kind=1) $:GPU_UPDATE(device='[bc_type(1, 1)%sf, bc_type(1, 2)%sf]') #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (n > 0) then - bc_type(2, 1)%sf(:,:,:) = int(min(bc_y%beg, 0), kind=1) - bc_type(2, 2)%sf(:,:,:) = int(min(bc_y%end, 0), kind=1) + bc_type(2, 1)%sf(:,:,:) = int(min(bc%y%beg, 0), kind=1) + bc_type(2, 2)%sf(:,:,:) = int(min(bc%y%end, 0), kind=1) $:GPU_UPDATE(device='[bc_type(2, 1)%sf, bc_type(2, 2)%sf]') #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (p > 0) then - bc_type(3, 1)%sf(:,:,:) = int(min(bc_z%beg, 0), kind=1) - bc_type(3, 2)%sf(:,:,:) = int(min(bc_z%end, 0), kind=1) + bc_type(3, 1)%sf(:,:,:) = int(min(bc%z%beg, 0), kind=1) + bc_type(3, 2)%sf(:,:,:) = int(min(bc%z%end, 0), kind=1) $:GPU_UPDATE(device='[bc_type(3, 1)%sf, bc_type(3, 2)%sf]') end if #:endif @@ -2161,24 +2161,24 @@ contains #ifndef MFC_PRE_PROCESS ! Population of Buffers in x-direction - ! Populating cell-width distribution buffer at bc_x%beg - if (bc_x%beg >= 0) then + ! Populating cell-width distribution buffer at bc%x%beg + if (bc%x%beg >= 0) then call s_mpi_sendrecv_grid_variables_buffers(1, -1) - else if (bc_x%beg <= BC_GHOST_EXTRAP) then + else if (bc%x%beg <= BC_GHOST_EXTRAP) then do i = 1, buff_size x%spacing(-i) = x%spacing(0) end do - else if (bc_x%beg == BC_REFLECTIVE) then + else if (bc%x%beg == BC_REFLECTIVE) then do i = 1, buff_size x%spacing(-i) = x%spacing(i - 1) end do - else if (bc_x%beg == BC_PERIODIC) then + else if (bc%x%beg == BC_PERIODIC) then do i = 1, buff_size x%spacing(-i) = x%spacing(m - (i - 1)) end do end if - ! Computing the cell-boundary and center locations buffer at bc_x%beg + ! Computing the cell-boundary and center locations buffer at bc%x%beg do i = 1, offset_x%beg x%cb(-1 - i) = x%cb(-i) - x%spacing(-i) end do @@ -2187,24 +2187,24 @@ contains x%cc(-i) = x%cc(1 - i) - (x%spacing(1 - i) + x%spacing(-i))/2._wp end do - ! Populating the cell-width distribution buffer at bc_x%end - if (bc_x%end >= 0) then + ! Populating the cell-width distribution buffer at bc%x%end + if (bc%x%end >= 0) then call s_mpi_sendrecv_grid_variables_buffers(1, 1) - else if (bc_x%end <= BC_GHOST_EXTRAP) then + else if (bc%x%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size x%spacing(m + i) = x%spacing(m) end do - else if (bc_x%end == BC_REFLECTIVE) then + else if (bc%x%end == BC_REFLECTIVE) then do i = 1, buff_size x%spacing(m + i) = x%spacing(m - (i - 1)) end do - else if (bc_x%end == BC_PERIODIC) then + else if (bc%x%end == BC_PERIODIC) then do i = 1, buff_size x%spacing(m + i) = x%spacing(i - 1) end do end if - ! Populating the cell-boundary and center locations buffer at bc_x%end + ! Populating the cell-boundary and center locations buffer at bc%x%end do i = 1, offset_x%end x%cb(m + i) = x%cb(m + (i - 1)) + x%spacing(m + i) end do @@ -2215,26 +2215,26 @@ contains ! Population of Buffers in y-direction - ! Populating cell-width distribution buffer at bc_y%beg + ! Populating cell-width distribution buffer at bc%y%beg if (n == 0) then return - else if (bc_y%beg >= 0) then + else if (bc%y%beg >= 0) then call s_mpi_sendrecv_grid_variables_buffers(2, -1) - else if (bc_y%beg <= BC_GHOST_EXTRAP .and. bc_y%beg /= BC_AXIS) then + else if (bc%y%beg <= BC_GHOST_EXTRAP .and. bc%y%beg /= BC_AXIS) then do i = 1, buff_size y%spacing(-i) = y%spacing(0) end do - else if (bc_y%beg == BC_REFLECTIVE .or. bc_y%beg == BC_AXIS) then + else if (bc%y%beg == BC_REFLECTIVE .or. bc%y%beg == BC_AXIS) then do i = 1, buff_size y%spacing(-i) = y%spacing(i - 1) end do - else if (bc_y%beg == BC_PERIODIC) then + else if (bc%y%beg == BC_PERIODIC) then do i = 1, buff_size y%spacing(-i) = y%spacing(n - (i - 1)) end do end if - ! Computing the cell-boundary and center locations buffer at bc_y%beg + ! Computing the cell-boundary and center locations buffer at bc%y%beg do i = 1, offset_y%beg y%cb(-1 - i) = y%cb(-i) - y%spacing(-i) end do @@ -2243,24 +2243,24 @@ contains y%cc(-i) = y%cc(1 - i) - (y%spacing(1 - i) + y%spacing(-i))/2._wp end do - ! Populating the cell-width distribution buffer at bc_y%end - if (bc_y%end >= 0) then + ! Populating the cell-width distribution buffer at bc%y%end + if (bc%y%end >= 0) then call s_mpi_sendrecv_grid_variables_buffers(2, 1) - else if (bc_y%end <= BC_GHOST_EXTRAP) then + else if (bc%y%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size y%spacing(n + i) = y%spacing(n) end do - else if (bc_y%end == BC_REFLECTIVE) then + else if (bc%y%end == BC_REFLECTIVE) then do i = 1, buff_size y%spacing(n + i) = y%spacing(n - (i - 1)) end do - else if (bc_y%end == BC_PERIODIC) then + else if (bc%y%end == BC_PERIODIC) then do i = 1, buff_size y%spacing(n + i) = y%spacing(i - 1) end do end if - ! Populating the cell-boundary and center locations buffer at bc_y%end + ! Populating the cell-boundary and center locations buffer at bc%y%end do i = 1, offset_y%end y%cb(n + i) = y%cb(n + (i - 1)) + y%spacing(n + i) end do @@ -2271,26 +2271,26 @@ contains ! Population of Buffers in z-direction - ! Populating cell-width distribution buffer at bc_z%beg + ! Populating cell-width distribution buffer at bc%z%beg if (p == 0) then return - else if (Bc_z%beg >= 0) then + else if (bc%z%beg >= 0) then call s_mpi_sendrecv_grid_variables_buffers(3, -1) - else if (bc_z%beg <= BC_GHOST_EXTRAP) then + else if (bc%z%beg <= BC_GHOST_EXTRAP) then do i = 1, buff_size z%spacing(-i) = z%spacing(0) end do - else if (bc_z%beg == BC_REFLECTIVE) then + else if (bc%z%beg == BC_REFLECTIVE) then do i = 1, buff_size z%spacing(-i) = z%spacing(i - 1) end do - else if (bc_z%beg == BC_PERIODIC) then + else if (bc%z%beg == BC_PERIODIC) then do i = 1, buff_size z%spacing(-i) = z%spacing(p - (i - 1)) end do end if - ! Computing the cell-boundary and center locations buffer at bc_z%beg + ! Computing the cell-boundary and center locations buffer at bc%z%beg do i = 1, offset_z%beg z%cb(-1 - i) = z%cb(-i) - z%spacing(-i) end do @@ -2299,24 +2299,24 @@ contains z%cc(-i) = z%cc(1 - i) - (z%spacing(1 - i) + z%spacing(-i))/2._wp end do - ! Populating the cell-width distribution buffer at bc_z%end - if (bc_z%end >= 0) then + ! Populating the cell-width distribution buffer at bc%z%end + if (bc%z%end >= 0) then call s_mpi_sendrecv_grid_variables_buffers(3, 1) - else if (bc_z%end <= BC_GHOST_EXTRAP) then + else if (bc%z%end <= BC_GHOST_EXTRAP) then do i = 1, buff_size z%spacing(p + i) = z%spacing(p) end do - else if (bc_z%end == BC_REFLECTIVE) then + else if (bc%z%end == BC_REFLECTIVE) then do i = 1, buff_size z%spacing(p + i) = z%spacing(p - (i - 1)) end do - else if (bc_z%end == BC_PERIODIC) then + else if (bc%z%end == BC_PERIODIC) then do i = 1, buff_size z%spacing(p + i) = z%spacing(i - 1) end do end if - ! Populating the cell-boundary and center locations buffer at bc_z%end + ! Populating the cell-boundary and center locations buffer at bc%z%end do i = 1, offset_z%end z%cb(p + i) = z%cb(p + (i - 1)) + z%spacing(p + i) end do diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index b66321dcce..79a294d76f 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -537,11 +537,11 @@ contains $:GPU_UPDATE(device='[v_size]') buffer_count = buffer_counts(mpi_dir) - boundary_conditions = (/bc_x, bc_y, bc_z/) + boundary_conditions = (/bc%x, bc%y, bc%z/) beg_end = (/boundary_conditions(mpi_dir)%beg, boundary_conditions(mpi_dir)%end/) beg_end_geq_0 = beg_end(max(pbc_loc, 0) - pbc_loc + 1) >= 0 - ! Implements: pbc_loc bc_x >= 0 -> [send/recv]_tag [dst/src]_proc -1 (=0) 0 -> [1,0] [0,0] | 0 0 [1,0] [beg,beg] -1 (=0) 1 + ! Implements: pbc_loc bc%x >= 0 -> [send/recv]_tag [dst/src]_proc -1 (=0) 0 -> [1,0] [0,0] | 0 0 [1,0] [beg,beg] -1 (=0) 1 ! -> [0,0] [1,0] | 0 1 [0,0] [end,beg] +1 (=1) 0 -> [0,1] [1,1] | 1 0 [0,1] [end,end] +1 (=1) 1 -> [1,1] [0,1] | 1 1 [1,1] ! [beg,end] @@ -1180,16 +1180,16 @@ contains end do ! Boundary condition at the beginning - if (proc_coords(3) > 0 .or. (bc_z%beg == BC_PERIODIC .and. num_procs_z > 1)) then + if (proc_coords(3) > 0 .or. (bc%z%beg == BC_PERIODIC .and. num_procs_z > 1)) then proc_coords(3) = proc_coords(3) - 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_z%beg, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%z%beg, ierr) proc_coords(3) = proc_coords(3) + 1 end if ! Boundary condition at the end - if (proc_coords(3) < num_procs_z - 1 .or. (bc_z%end == BC_PERIODIC .and. num_procs_z > 1)) then + if (proc_coords(3) < num_procs_z - 1 .or. (bc%z%end == BC_PERIODIC .and. num_procs_z > 1)) then proc_coords(3) = proc_coords(3) + 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_z%end, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%z%end, ierr) proc_coords(3) = proc_coords(3) - 1 end if @@ -1292,16 +1292,16 @@ contains end do ! Boundary condition at the beginning - if (proc_coords(2) > 0 .or. (bc_y%beg == BC_PERIODIC .and. num_procs_y > 1)) then + if (proc_coords(2) > 0 .or. (bc%y%beg == BC_PERIODIC .and. num_procs_y > 1)) then proc_coords(2) = proc_coords(2) - 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_y%beg, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%y%beg, ierr) proc_coords(2) = proc_coords(2) + 1 end if ! Boundary condition at the end - if (proc_coords(2) < num_procs_y - 1 .or. (bc_y%end == BC_PERIODIC .and. num_procs_y > 1)) then + if (proc_coords(2) < num_procs_y - 1 .or. (bc%y%end == BC_PERIODIC .and. num_procs_y > 1)) then proc_coords(2) = proc_coords(2) + 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_y%end, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%y%end, ierr) proc_coords(2) = proc_coords(2) - 1 end if @@ -1375,16 +1375,16 @@ contains call s_update_cell_bounds(cells_bounds, m, n, p) ! Boundary condition at the beginning - if (proc_coords(1) > 0 .or. (bc_x%beg == BC_PERIODIC .and. num_procs_x > 1)) then + if (proc_coords(1) > 0 .or. (bc%x%beg == BC_PERIODIC .and. num_procs_x > 1)) then proc_coords(1) = proc_coords(1) - 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_x%beg, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%x%beg, ierr) proc_coords(1) = proc_coords(1) + 1 end if ! Boundary condition at the end - if (proc_coords(1) < num_procs_x - 1 .or. (bc_x%end == BC_PERIODIC .and. num_procs_x > 1)) then + if (proc_coords(1) < num_procs_x - 1 .or. (bc%x%end == BC_PERIODIC .and. num_procs_x > 1)) then proc_coords(1) = proc_coords(1) + 1 - call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc_x%end, ierr) + call MPI_CART_RANK(MPI_COMM_CART, proc_coords, bc%x%end, ierr) proc_coords(1) = proc_coords(1) - 1 end if @@ -1445,58 +1445,58 @@ contains if (mpi_dir == 1) then if (pbc_loc == -1) then ! PBC at the beginning - if (bc_x%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, x%spacing(-buff_size), & - & buff_size, mpi_p, bc_x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + if (bc%x%end >= 0) then ! PBC at the beginning and end + call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc%x%end, 0, x%spacing(-buff_size), & + & buff_size, mpi_p, bc%x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc_x%beg, 1, x%spacing(-buff_size), buff_size, mpi_p, & - & bc_x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc%x%beg, 1, x%spacing(-buff_size), buff_size, mpi_p, & + & bc%x%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end - if (bc_x%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc_x%beg, 1, x%spacing(m + 1), buff_size, mpi_p, bc_x%end, & + if (bc%x%beg >= 0) then ! PBC at the end and beginning + call MPI_SENDRECV(x%spacing(0), buff_size, mpi_p, bc%x%beg, 1, x%spacing(m + 1), buff_size, mpi_p, bc%x%end, & & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc_x%end, 0, x%spacing(m + 1), buff_size, & - & mpi_p, bc_x%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(x%spacing(m - buff_size + 1), buff_size, mpi_p, bc%x%end, 0, x%spacing(m + 1), buff_size, & + & mpi_p, bc%x%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if else if (mpi_dir == 2) then if (pbc_loc == -1) then ! PBC at the beginning - if (bc_y%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, y%spacing(-buff_size), & - & buff_size, mpi_p, bc_y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + if (bc%y%end >= 0) then ! PBC at the beginning and end + call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc%y%end, 0, y%spacing(-buff_size), & + & buff_size, mpi_p, bc%y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc_y%beg, 1, y%spacing(-buff_size), buff_size, mpi_p, & - & bc_y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc%y%beg, 1, y%spacing(-buff_size), buff_size, mpi_p, & + & bc%y%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end - if (bc_y%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc_y%beg, 1, y%spacing(n + 1), buff_size, mpi_p, bc_y%end, & + if (bc%y%beg >= 0) then ! PBC at the end and beginning + call MPI_SENDRECV(y%spacing(0), buff_size, mpi_p, bc%y%beg, 1, y%spacing(n + 1), buff_size, mpi_p, bc%y%end, & & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc_y%end, 0, y%spacing(n + 1), buff_size, & - & mpi_p, bc_y%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(y%spacing(n - buff_size + 1), buff_size, mpi_p, bc%y%end, 0, y%spacing(n + 1), buff_size, & + & mpi_p, bc%y%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if else if (pbc_loc == -1) then ! PBC at the beginning - if (bc_z%end >= 0) then ! PBC at the beginning and end - call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, z%spacing(-buff_size), & - & buff_size, mpi_p, bc_z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + if (bc%z%end >= 0) then ! PBC at the beginning and end + call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc%z%end, 0, z%spacing(-buff_size), & + & buff_size, mpi_p, bc%z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the beginning only - call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc_z%beg, 1, z%spacing(-buff_size), buff_size, mpi_p, & - & bc_z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc%z%beg, 1, z%spacing(-buff_size), buff_size, mpi_p, & + & bc%z%beg, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if else ! PBC at the end - if (bc_z%beg >= 0) then ! PBC at the end and beginning - call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc_z%beg, 1, z%spacing(p + 1), buff_size, mpi_p, bc_z%end, & + if (bc%z%beg >= 0) then ! PBC at the end and beginning + call MPI_SENDRECV(z%spacing(0), buff_size, mpi_p, bc%z%beg, 1, z%spacing(p + 1), buff_size, mpi_p, bc%z%end, & & 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) else ! PBC at the end only - call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc_z%end, 0, z%spacing(p + 1), buff_size, & - & mpi_p, bc_z%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) + call MPI_SENDRECV(z%spacing(p - buff_size + 1), buff_size, mpi_p, bc%z%end, 0, z%spacing(p + 1), buff_size, & + & mpi_p, bc%z%end, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr) end if end if end if diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index ff1d31d633..7441180ba0 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -117,7 +117,7 @@ module m_global_parameters logical :: bc_io !> @name Boundary conditions in the x-, y- and z-coordinate directions !> @{ - type(bc_dir_t) :: bc_x, bc_y, bc_z + type(bc_xyz_info) :: bc !> @} integer :: shear_num !< Number of shear stress components @@ -314,24 +314,24 @@ contains hyper_cleaning = .false. igr = .false. - bc_x%beg = dflt_int; bc_x%end = dflt_int - bc_y%beg = dflt_int; bc_y%end = dflt_int - bc_z%beg = dflt_int; bc_z%end = dflt_int + bc%x%beg = dflt_int; bc%x%end = dflt_int + bc%y%beg = dflt_int; bc%y%end = dflt_int + bc%z%beg = dflt_int; bc%z%end = dflt_int bc_io = .false. num_bc_patches = dflt_int #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0._wp - bc_${DIM}$%ve${DIR}$ = 0._wp + bc%${DIM}$%vb${DIR}$ = 0._wp + bc%${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor #:for dir in {'x', 'y', 'z'} - bc_${dir}$%isothermal_in = .false. - bc_${dir}$%isothermal_out = .false. - bc_${dir}$%Twall_in = dflt_real - bc_${dir}$%Twall_out = dflt_real + bc%${dir}$%isothermal_in = .false. + bc%${dir}$%isothermal_out = .false. + bc%${dir}$%Twall_in = dflt_real + bc%${dir}$%Twall_out = dflt_real #:endfor chem_params%gamma_method = 1 diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index ab32967cc2..efb6bb3daf 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -70,8 +70,8 @@ contains #:for VAR in [ 'm', 'n', 'p', 'm_glb', 'n_glb', 'p_glb', & & 't_step_start', 't_step_stop', 't_step_save', 'weno_order', & - & 'model_eqns', 'num_fluids', 'bc_x%beg', 'bc_x%end', 'bc_y%beg', & - & 'bc_y%end', 'bc_z%beg', 'bc_z%end', 'flux_lim', 'format', & + & 'model_eqns', 'num_fluids', 'bc%x%beg', 'bc%x%end', 'bc%y%beg', & + & 'bc%y%end', 'bc%z%beg', 'bc%z%end', 'flux_lim', 'format', & & 'precision', 'fd_order', 'thermal', 'nb', 'relax_model', & & 'n_start', 'num_ibs', 'muscl_order' ] call MPI_BCAST(${VAR}$, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) @@ -84,8 +84,8 @@ contains & 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt','chem_wrt_T', & & 'bubbles_euler', 'qbmm', 'polytropic', 'polydisperse', & & 'file_per_process', 'relax', 'cf_wrt', 'igr', 'liutex_wrt', & - & 'bc_x%isothermal_in', 'bc_y%isothermal_in', 'bc_z%isothermal_in', & - & 'bc_x%isothermal_out', 'bc_y%isothermal_out', 'bc_z%isothermal_out',& + & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & + & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out',& & 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', & & 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', & & 'output_partial_domain', 'relativity', 'cont_damage', 'bc_io', & @@ -133,8 +133,8 @@ contains & 'Re_inv', 'Bx0', 'sigma', 't_save', 't_stop', & & 'x_output%beg', 'x_output%end', 'y_output%beg', & & 'y_output%end', 'z_output%beg', 'z_output%end', & - & 'bc_x%Twall_in', 'bc_x%Twall_out', 'bc_y%Twall_in',& - & 'bc_y%Twall_out','bc_z%Twall_in', 'bc_z%Twall_out' ] + & 'bc%x%Twall_in', 'bc%x%Twall_out', 'bc%y%Twall_in',& + & 'bc%y%Twall_out','bc%z%Twall_in', 'bc%z%Twall_out' ] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(schlieren_alpha(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr) diff --git a/src/post_process/m_start_up.fpp b/src/post_process/m_start_up.fpp index 8f18e621c0..0590b84914 100644 --- a/src/post_process/m_start_up.fpp +++ b/src/post_process/m_start_up.fpp @@ -60,15 +60,15 @@ contains character(len=1000) :: line namelist /user_inputs/ case_dir, m, n, p, t_step_start, t_step_stop, t_step_save, model_eqns, num_fluids, mpp_lim, & - & weno_order, bc_x, bc_y, bc_z, fluid_pp, bub_pp, format, precision, output_partial_domain, x_output, y_output, & - & z_output, hypoelasticity, G, mhd, chem_wrt_Y, chem_wrt_T, avg_state, alpha_rho_wrt, rho_wrt, mom_wrt, vel_wrt, & - & E_wrt, fft_wrt, pres_wrt, alpha_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, pres_inf_wrt, cons_vars_wrt, & - & prim_vars_wrt, c_wrt, omega_wrt, qm_wrt, liutex_wrt, schlieren_wrt, schlieren_alpha, fd_order, mixture_err, & - & alt_soundspeed, flux_lim, flux_wrt, cyl_coord, parallel_io, rhoref, pref, bubbles_euler, qbmm, sigR, R0ref, nb, & - & polytropic, thermal, Ca, Web, Re_inv, polydisperse, poly_sigma, file_per_process, relax, relax_model, cf_wrt, & - & sigma, adv_n, ib, num_ibs, cfl_adap_dt, cfl_const_dt, t_save, t_stop, n_start, cfl_target, surface_tension, & - & bubbles_lagrange, sim_data, hyperelasticity, Bx0, relativity, cont_damage, hyper_cleaning, num_bc_patches, igr, & - & igr_order, down_sample, recon_type, muscl_order, lag_header, lag_txt_wrt, lag_db_wrt, lag_id_wrt, lag_pos_wrt, & + & weno_order, bc, fluid_pp, bub_pp, format, precision, output_partial_domain, x_output, y_output, z_output, & + & hypoelasticity, G, mhd, chem_wrt_Y, chem_wrt_T, avg_state, alpha_rho_wrt, rho_wrt, mom_wrt, vel_wrt, E_wrt, & + & fft_wrt, pres_wrt, alpha_wrt, gamma_wrt, heat_ratio_wrt, pi_inf_wrt, pres_inf_wrt, cons_vars_wrt, prim_vars_wrt, & + & c_wrt, omega_wrt, qm_wrt, liutex_wrt, schlieren_wrt, schlieren_alpha, fd_order, mixture_err, alt_soundspeed, & + & flux_lim, flux_wrt, cyl_coord, parallel_io, rhoref, pref, bubbles_euler, qbmm, sigR, R0ref, nb, polytropic, & + & thermal, Ca, Web, Re_inv, polydisperse, poly_sigma, file_per_process, relax, relax_model, cf_wrt, sigma, adv_n, ib, & + & num_ibs, cfl_adap_dt, cfl_const_dt, t_save, t_stop, n_start, cfl_target, surface_tension, bubbles_lagrange, & + & sim_data, hyperelasticity, Bx0, relativity, cont_damage, hyper_cleaning, num_bc_patches, igr, igr_order, & + & down_sample, recon_type, muscl_order, lag_header, lag_txt_wrt, lag_db_wrt, lag_id_wrt, lag_pos_wrt, & & lag_pos_prev_wrt, lag_vel_wrt, lag_rad_wrt, lag_rvel_wrt, lag_r0_wrt, lag_rmax_wrt, lag_rmin_wrt, lag_dphidt_wrt, & & lag_pres_wrt, lag_mv_wrt, lag_mg_wrt, lag_betaT_wrt, lag_betaC_wrt, alpha_rho_e_wrt, ib_state_wrt @@ -104,7 +104,7 @@ contains if (cfl_adap_dt .or. cfl_const_dt) cfl_dt = .true. - if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -17) .or. num_bc_patches > 0) then + if (any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end/) == -17) .or. num_bc_patches > 0) then bc_io = .true. end if else diff --git a/src/pre_process/m_boundary_conditions.fpp b/src/pre_process/m_boundary_conditions.fpp index b1352c2319..3e4bd982b9 100644 --- a/src/pre_process/m_boundary_conditions.fpp +++ b/src/pre_process/m_boundary_conditions.fpp @@ -41,7 +41,7 @@ contains ! Apply patch if x boundary is a domain boundary #:for BOUND, X, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'm+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%x%${BOUND}$ < 0) then do j = 0, n if (y%cc(j) > y_boundary%beg .and. y%cc(j) < y_boundary%end) then bc_type(1, ${IDX}$)%sf(0, j, 0) = patch_bc(patch_id)%type @@ -61,7 +61,7 @@ contains ! Apply patch if y boundary is a domain boundary #:for BOUND, Y, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'n+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%y%${BOUND}$ < 0) then do j = 0, m if (x%cc(j) > x_boundary%beg .and. x%cc(j) < x_boundary%end) then bc_type(2, ${IDX}$)%sf(j, 0, 0) = patch_bc(patch_id)%type @@ -86,7 +86,7 @@ contains radius = patch_bc(patch_id)%radius ! Patch is a circle at x_beg and x_beg is a domain boundary #:for BOUND, X, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'm+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%x%${BOUND}$ < 0) then do k = 0, p do j = 0, n if ((z%cc(k) - z_centroid)**2._wp + (y%cc(j) - y_centroid)**2._wp <= radius**2._wp) then @@ -103,7 +103,7 @@ contains radius = patch_bc(patch_id)%radius ! Patch is a circle at y_beg and y_beg is a domain boundary #:for BOUND, Y, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'n+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%y%${BOUND}$ < 0) then do k = 0, p do j = 0, m if ((z%cc(k) - z_centroid)**2._wp + (x%cc(j) - x_centroid)**2._wp <= radius**2._wp) then @@ -119,7 +119,7 @@ contains y_centroid = patch_bc(patch_id)%centroid(2) radius = patch_bc(patch_id)%radius #:for BOUND, Z, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'p+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_z%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%z%${BOUND}$ < 0) then do k = 0, n do j = 0, m if ((y%cc(k) - y_centroid)**2._wp + (x%cc(j) - x_centroid)**2._wp <= radius**2._wp) then @@ -153,7 +153,7 @@ contains z_boundary%end = z_centroid + 0.5_wp*length_z ! Patch is a rectangle on the x-boundary face #:for BOUND, X, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'm+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_x%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%x%${BOUND}$ < 0) then do k = 0, p do j = 0, n if (y_boundary%beg <= y%cc(j) .and. y_boundary%end >= y%cc(j) .and. z_boundary%beg <= z%cc(k) & @@ -178,7 +178,7 @@ contains z_boundary%end = z_centroid + 0.5_wp*length_z ! Patch is a rectangle on the y-boundary face #:for BOUND, Y, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'n+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_y%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%y%${BOUND}$ < 0) then do k = 0, p do j = 0, m if (x_boundary%beg <= x%cc(j) .and. x_boundary%end >= x%cc(j) .and. z_boundary%beg <= z%cc(k) & @@ -202,7 +202,7 @@ contains y_boundary%beg = y_centroid - 0.5_wp*length_y y_boundary%end = y_centroid + 0.5_wp*length_y #:for BOUND, Z, LOC, IDX in [('beg', '-i', -1, 1), ('end', 'p+i', 1, 2)] - if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc_z%${BOUND}$ < 0) then + if (patch_bc(patch_id)%loc == ${LOC}$ .and. bc%z%${BOUND}$ < 0) then do k = 0, n do j = 0, m if (x_boundary%beg <= x%cc(j) .and. x_boundary%end >= x%cc(j) .and. y_boundary%beg <= y%cc(k) & diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index 4e2ae66306..e30a6ad9fd 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -85,7 +85,7 @@ module m_global_parameters ! Cell indices (InDices With BUFFer): includes buffer except in pre_process type(int_bounds_info) :: idwbuff(1:3) - type(bc_dir_t) :: bc_x, bc_y, bc_z !< Boundary conditions in the x-, y- and z-coordinate directions + type(bc_xyz_info) :: bc !< Boundary conditions in the x-, y- and z-coordinate directions integer :: shear_num !< Number of shear stress components integer, dimension(3) :: shear_indices !< Indices of the stress components that represent shear stress integer :: shear_BC_flip_num !< Number of shear stress components to reflect for boundary conditions @@ -260,22 +260,22 @@ contains mhd = .false. relativity = .false. - bc_x%beg = dflt_int; bc_x%end = dflt_int - bc_y%beg = dflt_int; bc_y%end = dflt_int - bc_z%beg = dflt_int; bc_z%end = dflt_int + bc%x%beg = dflt_int; bc%x%end = dflt_int + bc%y%beg = dflt_int; bc%y%end = dflt_int + bc%z%beg = dflt_int; bc%z%end = dflt_int #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0._wp - bc_${DIM}$%ve${DIR}$ = 0._wp + bc%${DIM}$%vb${DIR}$ = 0._wp + bc%${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor #:for dir in {'x', 'y', 'z'} - bc_${dir}$%isothermal_in = .false. - bc_${dir}$%isothermal_out = .false. - bc_${dir}$%Twall_in = dflt_real - bc_${dir}$%Twall_out = dflt_real + bc%${dir}$%isothermal_in = .false. + bc%${dir}$%isothermal_out = .false. + bc%${dir}$%Twall_in = dflt_real + bc%${dir}$%Twall_out = dflt_real #:endfor parallel_io = .false. diff --git a/src/pre_process/m_initial_condition.fpp b/src/pre_process/m_initial_condition.fpp index 187507ce23..bfaaa69a36 100644 --- a/src/pre_process/m_initial_condition.fpp +++ b/src/pre_process/m_initial_condition.fpp @@ -71,8 +71,8 @@ contains do l = 0, p do k = 0, n - bc_type(1, 1)%sf(0, k, l) = int(min(bc_x%beg, 0), kind=1) - bc_type(1, 2)%sf(0, k, l) = int(min(bc_x%end, 0), kind=1) + bc_type(1, 1)%sf(0, k, l) = int(min(bc%x%beg, 0), kind=1) + bc_type(1, 2)%sf(0, k, l) = int(min(bc%x%end, 0), kind=1) end do end do @@ -82,8 +82,8 @@ contains do l = 0, p do j = -buff_size, m + buff_size - bc_type(2, 1)%sf(j, 0, l) = int(min(bc_y%beg, 0), kind=1) - bc_type(2, 2)%sf(j, 0, l) = int(min(bc_y%end, 0), kind=1) + bc_type(2, 1)%sf(j, 0, l) = int(min(bc%y%beg, 0), kind=1) + bc_type(2, 2)%sf(j, 0, l) = int(min(bc%y%end, 0), kind=1) end do end do @@ -93,8 +93,8 @@ contains do k = -buff_size, n + buff_size do j = -buff_size, m + buff_size - bc_type(3, 1)%sf(j, k, 0) = int(min(bc_z%beg, 0), kind=1) - bc_type(3, 2)%sf(j, k, 0) = int(min(bc_z%end, 0), kind=1) + bc_type(3, 1)%sf(j, k, 0) = int(min(bc%z%beg, 0), kind=1) + bc_type(3, 2)%sf(j, k, 0) = int(min(bc%z%end, 0), kind=1) end do end do end if diff --git a/src/pre_process/m_mpi_proxy.fpp b/src/pre_process/m_mpi_proxy.fpp index 4893855e71..434b549d52 100644 --- a/src/pre_process/m_mpi_proxy.fpp +++ b/src/pre_process/m_mpi_proxy.fpp @@ -43,8 +43,8 @@ contains & 'mixlayer_perturb', 'bubbles_euler', 'polytropic', 'polydisperse', & & 'qbmm', 'file_per_process', 'adv_n', 'ib' , 'cfl_adap_dt', & & 'cfl_const_dt', 'cfl_dt', 'surface_tension', & - & 'bc_x%isothermal_in', 'bc_y%isothermal_in', 'bc_z%isothermal_in', & - & 'bc_x%isothermal_out', 'bc_y%isothermal_out', 'bc_z%isothermal_out',& + & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & + & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out',& & 'hyperelasticity', 'pre_stress', 'elliptic_smoothing', 'viscous', & & 'bubbles_lagrange', 'bc_io', 'mhd', 'relativity', 'cont_damage', & & 'igr', 'down_sample', 'simplex_perturb','fft_wrt', 'hyper_cleaning' ] @@ -55,14 +55,14 @@ contains #:for VAR in [ 'x_domain%beg', 'x_domain%end', 'y_domain%beg', & & 'y_domain%end', 'z_domain%beg', 'z_domain%end', 'a_x', 'a_y', & & 'a_z', 'x_stretch%beg', 'x_stretch%end', 'y_stretch%beg', 'y_stretch%end', & - & 'z_stretch%beg', 'z_stretch%end', 'bc_x%beg', & - & 'bc_x%end', 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', & + & 'z_stretch%beg', 'z_stretch%end', 'bc%x%beg', & + & 'bc%x%end', 'bc%y%beg', 'bc%y%end', 'bc%z%beg', 'bc%z%end', & & 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', & & 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV', 'palpha_eps', & & 'ptgalpha_eps', 'sigma', 'pi_fac', 'mixlayer_vel_coef', 'Bx0', & - & 'mixlayer_perturb_k0', 'bc_x%Twall_in', 'bc_x%Twall_out', & - & 'bc_y%Twall_in', 'bc_y%Twall_out', 'bc_z%Twall_in', & - & 'bc_z%Twall_out'] + & 'mixlayer_perturb_k0', 'bc%x%Twall_in', 'bc%x%Twall_out', & + & 'bc%y%Twall_in', 'bc%y%Twall_out', 'bc%z%Twall_in', & + & 'bc%z%Twall_out'] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index 590e771c3c..3d43d65bc8 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -76,15 +76,15 @@ contains namelist /user_inputs/ case_dir, old_grid, old_ic, t_step_old, t_step_start, m, n, p, x_domain, y_domain, z_domain, & & stretch_x, stretch_y, stretch_z, a_x, a_y, a_z, x_stretch, y_stretch, z_stretch, model_eqns, num_fluids, mpp_lim, & - & weno_order, bc_x, bc_y, bc_z, num_patches, hypoelasticity, mhd, patch_icpp, fluid_pp, bub_pp, precision, & - & parallel_io, mixlayer_vel_profile, mixlayer_vel_coef, mixlayer_perturb, mixlayer_perturb_nk, mixlayer_perturb_k0, & - & pi_fac, perturb_flow, perturb_flow_fluid, perturb_flow_mag, perturb_sph, perturb_sph_fluid, fluid_rho, cyl_coord, & - & loops_x, loops_y, loops_z, rhoref, pref, bubbles_euler, R0ref, nb, polytropic, thermal, Ca, Web, Re_inv, & - & polydisperse, poly_sigma, qbmm, sigR, sigV, dist_type, rhoRV, file_per_process, relax, relax_model, palpha_eps, & - & ptgalpha_eps, ib, num_ibs, patch_ib, sigma, adv_n, cfl_adap_dt, cfl_const_dt, n_start, n_start_old, & - & surface_tension, hyperelasticity, pre_stress, elliptic_smoothing, elliptic_smoothing_iters, viscous, & - & bubbles_lagrange, num_bc_patches, patch_bc, Bx0, relativity, cont_damage, igr, igr_order, down_sample, recon_type, & - & muscl_order, hyper_cleaning, simplex_perturb, simplex_params, fft_wrt + & weno_order, bc, num_patches, hypoelasticity, mhd, patch_icpp, fluid_pp, bub_pp, precision, parallel_io, & + & mixlayer_vel_profile, mixlayer_vel_coef, mixlayer_perturb, mixlayer_perturb_nk, mixlayer_perturb_k0, pi_fac, & + & perturb_flow, perturb_flow_fluid, perturb_flow_mag, perturb_sph, perturb_sph_fluid, fluid_rho, cyl_coord, loops_x, & + & loops_y, loops_z, rhoref, pref, bubbles_euler, R0ref, nb, polytropic, thermal, Ca, Web, Re_inv, polydisperse, & + & poly_sigma, qbmm, sigR, sigV, dist_type, rhoRV, file_per_process, relax, relax_model, palpha_eps, ptgalpha_eps, ib, & + & num_ibs, patch_ib, sigma, adv_n, cfl_adap_dt, cfl_const_dt, n_start, n_start_old, surface_tension, hyperelasticity, & + & pre_stress, elliptic_smoothing, elliptic_smoothing_iters, viscous, bubbles_lagrange, num_bc_patches, patch_bc, Bx0, & + & relativity, cont_damage, igr, igr_order, down_sample, recon_type, muscl_order, hyper_cleaning, simplex_perturb, & + & simplex_params, fft_wrt file_loc = 'pre_process.inp' inquire (FILE=trim(file_loc), EXIST=file_check) @@ -110,7 +110,7 @@ contains if (cfl_adap_dt .or. cfl_const_dt) cfl_dt = .true. - if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == BC_DIRICHLET) .or. num_bc_patches > 0) then + if (any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end/) == BC_DIRICHLET) .or. num_bc_patches > 0) then bc_io = .true. end if else diff --git a/src/simulation/m_bubbles_EL.fpp b/src/simulation/m_bubbles_EL.fpp index e2d44a1e72..79e6cde8f4 100644 --- a/src/simulation/m_bubbles_EL.fpp +++ b/src/simulation/m_bubbles_EL.fpp @@ -260,17 +260,17 @@ contains call s_locate_cell(mtn_pos(bub_id,1:3,1), cell, mtn_s(bub_id,1:3,1)) ! Check if the bubble is located in the ghost cell of a symmetric, or wall boundary - if ((any(bc_x%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & - & BC_NO_SLIP_WALL/)) .and. cell(1) < 0) .or. (any(bc_x%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & - & BC_NO_SLIP_WALL/)) .and. cell(1) > m) .or. (any(bc_y%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & - & BC_NO_SLIP_WALL/)) .and. cell(2) < 0) .or. (any(bc_y%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + if ((any(bc%x%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + & BC_NO_SLIP_WALL/)) .and. cell(1) < 0) .or. (any(bc%x%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + & BC_NO_SLIP_WALL/)) .and. cell(1) > m) .or. (any(bc%y%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + & BC_NO_SLIP_WALL/)) .and. cell(2) < 0) .or. (any(bc%y%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & & BC_NO_SLIP_WALL/)) .and. cell(2) > n)) then call s_mpi_abort("Lagrange bubble is in the ghost cells of a symmetric or wall boundary.") end if if (p > 0) then - if ((any(bc_z%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & - & BC_NO_SLIP_WALL/)) .and. cell(3) < 0) .or. (any(bc_z%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + if ((any(bc%z%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & + & BC_NO_SLIP_WALL/)) .and. cell(3) < 0) .or. (any(bc%z%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, & & BC_NO_SLIP_WALL/)) .and. cell(3) > p)) then call s_mpi_abort("Lagrange bubble is in the ghost cells of a symmetric or wall boundary.") end if @@ -1178,23 +1178,23 @@ contains end if ! For symmetric and wall boundary condition - if (any(bc_x%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then + if (any(bc%x%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then particle_in_domain = (particle_in_domain .and. (pos_part(1) >= x%cb(-1))) end if - if (any(bc_x%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then + if (any(bc%x%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then particle_in_domain = (particle_in_domain .and. (pos_part(1) < x%cb(m))) end if - if (any(bc_y%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then + if (any(bc%y%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then particle_in_domain = (particle_in_domain .and. (pos_part(2) >= y%cb(-1))) end if - if (any(bc_y%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then + if (any(bc%y%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/)) .and. (.not. cyl_coord)) then particle_in_domain = (particle_in_domain .and. (pos_part(2) < y%cb(n))) end if if (p > 0) then - if (any(bc_z%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then + if (any(bc%z%beg == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then particle_in_domain = (particle_in_domain .and. (pos_part(3) >= z%cb(-1))) end if - if (any(bc_z%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then + if (any(bc%z%end == (/BC_REFLECTIVE, BC_CHAR_SLIP_WALL, BC_SLIP_WALL, BC_NO_SLIP_WALL/))) then particle_in_domain = (particle_in_domain .and. (pos_part(3) < z%cb(p))) end if end if diff --git a/src/simulation/m_bubbles_EL_kernels.fpp b/src/simulation/m_bubbles_EL_kernels.fpp index 1f754e990f..027dae3825 100644 --- a/src/simulation/m_bubbles_EL_kernels.fpp +++ b/src/simulation/m_bubbles_EL_kernels.fpp @@ -140,7 +140,7 @@ contains if (lag_params%cluster_type >= 4) call s_applygaussian(center, cellaux, nodecoord, stddsv, 1._wp, func2) ! Relocate cells for bubbles intersecting symmetric boundaries - if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == BC_REFLECTIVE)) then + if (any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end/) == BC_REFLECTIVE)) then call s_shift_cell_symmetric_bc(cellaux, cell) end if else @@ -284,27 +284,27 @@ contains integer, dimension(3), intent(in) :: cell ! x-dir - if (bc_x%beg == BC_REFLECTIVE .and. (cell(1) <= mapCells - 1)) then + if (bc%x%beg == BC_REFLECTIVE .and. (cell(1) <= mapCells - 1)) then cellaux(1) = abs(cellaux(1)) - 1 end if - if (bc_x%end == BC_REFLECTIVE .and. (cell(1) >= m + 1 - mapCells)) then + if (bc%x%end == BC_REFLECTIVE .and. (cell(1) >= m + 1 - mapCells)) then cellaux(1) = cellaux(1) - (2*(cellaux(1) - m) - 1) end if ! y-dir - if (bc_y%beg == BC_REFLECTIVE .and. (cell(2) <= mapCells - 1)) then + if (bc%y%beg == BC_REFLECTIVE .and. (cell(2) <= mapCells - 1)) then cellaux(2) = abs(cellaux(2)) - 1 end if - if (bc_y%end == BC_REFLECTIVE .and. (cell(2) >= n + 1 - mapCells)) then + if (bc%y%end == BC_REFLECTIVE .and. (cell(2) >= n + 1 - mapCells)) then cellaux(2) = cellaux(2) - (2*(cellaux(2) - n) - 1) end if if (p > 0) then ! z-dir - if (bc_z%beg == BC_REFLECTIVE .and. (cell(3) <= mapCells - 1)) then + if (bc%z%beg == BC_REFLECTIVE .and. (cell(3) <= mapCells - 1)) then cellaux(3) = abs(cellaux(3)) - 1 end if - if (bc_z%end == BC_REFLECTIVE .and. (cell(3) >= p + 1 - mapCells)) then + if (bc%z%end == BC_REFLECTIVE .and. (cell(3) >= p + 1 - mapCells)) then cellaux(3) = cellaux(3) - (2*(cellaux(3) - p) - 1) end if end if diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index 565ca6c9b6..8eadee9083 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -204,7 +204,7 @@ contains idx2%end = muscl_order - 1 end if ! Allocating/Computing CBC Coefficients in x-direction - if (all((/bc_x%beg, bc_x%end/) <= -5) .and. all((/bc_x%beg, bc_x%end/) >= -13)) then + if (all((/bc%x%beg, bc%x%end/) <= -5) .and. all((/bc%x%beg, bc%x%end/) >= -13)) then @:ALLOCATE(fd_coef_x(0:buff_size, -1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -213,7 +213,7 @@ contains call s_compute_cbc_coefficients(1, -1) call s_compute_cbc_coefficients(1, 1) - else if (bc_x%beg <= -5 .and. bc_x%beg >= -13) then + else if (bc%x%beg <= -5 .and. bc%x%beg >= -13) then @:ALLOCATE(fd_coef_x(0:buff_size, -1:-1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -221,7 +221,7 @@ contains end if call s_compute_cbc_coefficients(1, -1) - else if (bc_x%end <= -5 .and. bc_x%end >= -13) then + else if (bc%x%end <= -5 .and. bc%x%end >= -13) then @:ALLOCATE(fd_coef_x(0:buff_size, 1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -233,7 +233,7 @@ contains ! Allocating/Computing CBC Coefficients in y-direction if (n > 0) then - if (all((/bc_y%beg, bc_y%end/) <= -5) .and. all((/bc_y%beg, bc_y%end/) >= -13)) then + if (all((/bc%y%beg, bc%y%end/) <= -5) .and. all((/bc%y%beg, bc%y%end/) >= -13)) then @:ALLOCATE(fd_coef_y(0:buff_size, -1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -242,7 +242,7 @@ contains call s_compute_cbc_coefficients(2, -1) call s_compute_cbc_coefficients(2, 1) - else if (bc_y%beg <= -5 .and. bc_y%beg >= -13) then + else if (bc%y%beg <= -5 .and. bc%y%beg >= -13) then @:ALLOCATE(fd_coef_y(0:buff_size, -1:-1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -250,7 +250,7 @@ contains end if call s_compute_cbc_coefficients(2, -1) - else if (bc_y%end <= -5 .and. bc_y%end >= -13) then + else if (bc%y%end <= -5 .and. bc%y%end >= -13) then @:ALLOCATE(fd_coef_y(0:buff_size, 1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -263,7 +263,7 @@ contains ! Allocating/Computing CBC Coefficients in z-direction if (p > 0) then - if (all((/bc_z%beg, bc_z%end/) <= -5) .and. all((/bc_z%beg, bc_z%end/) >= -13)) then + if (all((/bc%z%beg, bc%z%end/) <= -5) .and. all((/bc%z%beg, bc%z%end/) >= -13)) then @:ALLOCATE(fd_coef_z(0:buff_size, -1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -272,7 +272,7 @@ contains call s_compute_cbc_coefficients(3, -1) call s_compute_cbc_coefficients(3, 1) - else if (bc_z%beg <= -5 .and. bc_z%beg >= -13) then + else if (bc%z%beg <= -5 .and. bc%z%beg >= -13) then @:ALLOCATE(fd_coef_z(0:buff_size, -1:-1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -280,7 +280,7 @@ contains end if call s_compute_cbc_coefficients(3, -1) - else if (bc_z%end <= -5 .and. bc_z%end >= -13) then + else if (bc%z%end <= -5 .and. bc%z%end >= -13) then @:ALLOCATE(fd_coef_z(0:buff_size, 1:1)) if (weno_order > 1 .or. muscl_order > 1) then @@ -302,23 +302,23 @@ contains ! Assign and update GRCBC inputs #:for CBC_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] if (${CBC_DIR}$ <= num_dims) then - vel_in(${CBC_DIR}$, 1) = bc_${XYZ}$%vel_in(1) - vel_out(${CBC_DIR}$, 1) = bc_${XYZ}$%vel_out(1) + vel_in(${CBC_DIR}$, 1) = bc%${XYZ}$%vel_in(1) + vel_out(${CBC_DIR}$, 1) = bc%${XYZ}$%vel_out(1) if (n > 0) then - vel_in(${CBC_DIR}$, 2) = bc_${XYZ}$%vel_in(2) - vel_out(${CBC_DIR}$, 2) = bc_${XYZ}$%vel_out(2) + vel_in(${CBC_DIR}$, 2) = bc%${XYZ}$%vel_in(2) + vel_out(${CBC_DIR}$, 2) = bc%${XYZ}$%vel_out(2) if (p > 0) then - vel_in(${CBC_DIR}$, 3) = bc_${XYZ}$%vel_in(3) - vel_out(${CBC_DIR}$, 3) = bc_${XYZ}$%vel_out(3) + vel_in(${CBC_DIR}$, 3) = bc%${XYZ}$%vel_in(3) + vel_out(${CBC_DIR}$, 3) = bc%${XYZ}$%vel_out(3) end if end if Del_in(${CBC_DIR}$) = maxval(${XYZ}$%spacing) Del_out(${CBC_DIR}$) = maxval(${XYZ}$%spacing) - pres_in(${CBC_DIR}$) = bc_${XYZ}$%pres_in - pres_out(${CBC_DIR}$) = bc_${XYZ}$%pres_out + pres_in(${CBC_DIR}$) = bc%${XYZ}$%pres_in + pres_out(${CBC_DIR}$) = bc%${XYZ}$%pres_out do i = 1, num_fluids - alpha_rho_in(i, ${CBC_DIR}$) = bc_${XYZ}$%alpha_rho_in(i) - alpha_in(i, ${CBC_DIR}$) = bc_${XYZ}$%alpha_in(i) + alpha_rho_in(i, ${CBC_DIR}$) = bc%${XYZ}$%alpha_rho_in(i) + alpha_in(i, ${CBC_DIR}$) = bc%${XYZ}$%alpha_in(i) end do end if #:endfor @@ -725,18 +725,18 @@ contains Ma = vel(dir_idx(1))/c - if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SLIP_WALL) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SLIP_WALL)) then + if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_SLIP_WALL) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_SLIP_WALL)) then call s_compute_slip_wall_L(lambda, L, rho, c, dpres_ds, dvel_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_NR_SUB_BUFFER) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_NR_SUB_BUFFER)) then call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_NR_SUB_INFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, dpres_ds, dvel_ds) ! Add GRCBC for Subsonic Inflow - if (bc_${XYZ}$%grcbc_in) then + if (bc%${XYZ}$%grcbc_in) then $:GPU_LOOP(parallelism='[seq]') do i = 2, eqn_idx%mom%beg L(i) = c**3._wp*Ma*(alpha_rho(i - 1) - alpha_rho_in(i - 1, & @@ -759,33 +759,33 @@ contains & dir_idx(1))*sign(1, & & cbc_loc))/Del_in(${CBC_DIR}$) + c*(1._wp + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$) end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_NR_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_NR_SUB_OUTFLOW)) then call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) ! Add GRCBC for Subsonic Outflow (Pressure) - if (bc_${XYZ}$%grcbc_out) then + if (bc%${XYZ}$%grcbc_out) then L(eqn_idx%adv%end) = c*(1._wp - Ma)*(pres - pres_out(${CBC_DIR}$))/Del_out(${CBC_DIR}$) ! Add GRCBC for Subsonic Outflow (Normal Velocity) - if (bc_${XYZ}$%grcbc_vel_out) then + if (bc%${XYZ}$%grcbc_vel_out) then L(eqn_idx%adv%end) = L(eqn_idx%adv%end) + rho*c**2._wp*(1._wp - Ma)*(vel(dir_idx(1)) & & + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) end if end if - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_FF_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_FF_SUB_OUTFLOW)) then call s_compute_force_free_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, & & dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_CP_SUB_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_CP_SUB_OUTFLOW)) then call s_compute_constant_pressure_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_INFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_SUP_INFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_SUP_INFLOW)) then call s_compute_supersonic_inflow_L(L) - else if ((cbc_loc == -1 .and. bc_${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) .or. (cbc_loc == 1 & - & .and. bc_${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then + else if ((cbc_loc == -1 .and. bc%${XYZ}$%beg == BC_CHAR_SUP_OUTFLOW) .or. (cbc_loc == 1 & + & .and. bc%${XYZ}$%end == BC_CHAR_SUP_OUTFLOW)) then call s_compute_supersonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, & & dYs_ds) end if @@ -1359,7 +1359,7 @@ contains toggle = .false. #:for BC in {-5, -6, -7, -8, -9, -10, -11, -12, -13} - if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == ${BC}$)) then + if (any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end/) == ${BC}$)) then toggle = .true. end if #:endfor @@ -1404,8 +1404,8 @@ contains @:DEALLOCATE(vel_in, vel_out, pres_in, pres_out, Del_in, Del_out, alpha_rho_in, alpha_in) ! Deallocating CBC Coefficients in x-direction - if (all((/bc_x%beg, bc_x%end/) <= -5) .and. all((/bc_x%beg, & - & bc_x%end/) >= -13) .or. bc_x%beg <= -5 .and. bc_x%beg >= -13 .or. bc_x%end <= -5 .and. bc_x%end >= -13) then + if (all((/bc%x%beg, bc%x%end/) <= -5) .and. all((/bc%x%beg, & + & bc%x%end/) >= -13) .or. bc%x%beg <= -5 .and. bc%x%beg >= -13 .or. bc%x%end <= -5 .and. bc%x%end >= -13) then @:DEALLOCATE(fd_coef_x) if (weno_order > 1 .or. muscl_order > 1) then @:DEALLOCATE(pi_coef_x) @@ -1414,8 +1414,8 @@ contains ! Deallocating CBC Coefficients in y-direction if (n > 0) then - if (all((/bc_y%beg, bc_y%end/) <= -5) .and. all((/bc_y%beg, & - & bc_y%end/) >= -13) .or. bc_y%beg <= -5 .and. bc_y%beg >= -13 .or. bc_y%end <= -5 .and. bc_y%end >= -13) then + if (all((/bc%y%beg, bc%y%end/) <= -5) .and. all((/bc%y%beg, & + & bc%y%end/) >= -13) .or. bc%y%beg <= -5 .and. bc%y%beg >= -13 .or. bc%y%end <= -5 .and. bc%y%end >= -13) then @:DEALLOCATE(fd_coef_y) if (weno_order > 1) then @:DEALLOCATE(pi_coef_y) @@ -1425,8 +1425,8 @@ contains ! Deallocating CBC Coefficients in z-direction if (p > 0) then - if (all((/bc_z%beg, bc_z%end/) <= -5) .and. all((/bc_z%beg, & - & bc_z%end/) >= -13) .or. bc_z%beg <= -5 .and. bc_z%beg >= -13 .or. bc_z%end <= -5 .and. bc_z%end >= -13) then + if (all((/bc%z%beg, bc%z%end/) <= -5) .and. all((/bc%z%beg, & + & bc%z%end/) >= -13) .or. bc%z%beg <= -5 .and. bc%z%beg >= -13 .or. bc%z%end <= -5 .and. bc%z%end >= -13) then @:DEALLOCATE(fd_coef_z) if (weno_order > 1) then @:DEALLOCATE(pi_coef_z) diff --git a/src/simulation/m_fftw.fpp b/src/simulation/m_fftw.fpp index ff94f3a138..0b10f77bae 100644 --- a/src/simulation/m_fftw.fpp +++ b/src/simulation/m_fftw.fpp @@ -123,7 +123,7 @@ contains integer :: ierr !< Generic flag used to identify and report GPU errors ! Restrict filter to processors that have cells adjacent to axis - if (bc_y%beg >= 0) return + if (bc%y%beg >= 0) return #if defined(MFC_GPU) $:GPU_PARALLEL_LOOP(collapse=3) do k = 1, sys_size diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index e04baf392c..e0f2cfcb59 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -202,20 +202,20 @@ module m_global_parameters logical :: bc_io !> @name Boundary conditions (BC) in the x-, y- and z-directions, respectively !> @{ - type(bc_dir_t) :: bc_x, bc_y, bc_z + type(bc_xyz_info) :: bc !> @} !> @name Original boundary conditions preserved for immersed boundary code - !> (bc_x/y/z get overwritten with MPI neighbor ranks during decomposition) + !> (bc%x/y/z get overwritten with MPI neighbor ranks during decomposition) !> @{ type(bc_dir_t) :: ib_bc_x, ib_bc_y, ib_bc_z !> @} #if defined(MFC_OpenACC) - $:GPU_DECLARE(create='[bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3]') - $:GPU_DECLARE(create='[bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3]') - $:GPU_DECLARE(create='[bc_z%vb1, bc_z%vb2, bc_z%vb3, bc_z%ve1, bc_z%ve2, bc_z%ve3]') + $:GPU_DECLARE(create='[bc%x%vb1, bc%x%vb2, bc%x%vb3, bc%x%ve1, bc%x%ve2, bc%x%ve3]') + $:GPU_DECLARE(create='[bc%y%vb1, bc%y%vb2, bc%y%vb3, bc%y%ve1, bc%y%ve2, bc%y%ve3]') + $:GPU_DECLARE(create='[bc%z%vb1, bc%z%vb2, bc%z%vb3, bc%z%ve1, bc%z%ve2, bc%z%ve3]') $:GPU_DECLARE(create='[ib_bc_x%beg, ib_bc_y%beg, ib_bc_z%beg]') #elif defined(MFC_OpenMP) - $:GPU_DECLARE(create='[bc_x, bc_y, bc_z]') + $:GPU_DECLARE(create='[bc]') $:GPU_DECLARE(create='[ib_bc_x, ib_bc_y, ib_bc_z]') #endif type(bounds_info) :: x_domain, y_domain, z_domain @@ -569,14 +569,14 @@ contains num_bc_patches = 0 bc_io = .false. - bc_x%beg = dflt_int; bc_x%end = dflt_int - bc_y%beg = dflt_int; bc_y%end = dflt_int - bc_z%beg = dflt_int; bc_z%end = dflt_int + bc%x%beg = dflt_int; bc%x%end = dflt_int + bc%y%beg = dflt_int; bc%y%end = dflt_int + bc%z%beg = dflt_int; bc%z%end = dflt_int #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc_${DIM}$%vb${DIR}$ = 0._wp - bc_${DIM}$%ve${DIR}$ = 0._wp + bc%${DIM}$%vb${DIR}$ = 0._wp + bc%${DIM}$%ve${DIR}$ = 0._wp #:endfor #:endfor @@ -732,16 +732,16 @@ contains ! GRCBC flags #:for dir in {'x', 'y', 'z'} - bc_${dir}$%grcbc_in = .false. - bc_${dir}$%grcbc_out = .false. - bc_${dir}$%grcbc_vel_out = .false. + bc%${dir}$%grcbc_in = .false. + bc%${dir}$%grcbc_out = .false. + bc%${dir}$%grcbc_vel_out = .false. #:endfor #:for dir in {'x', 'y', 'z'} - bc_${dir}$%isothermal_in = .false. - bc_${dir}$%isothermal_out = .false. - bc_${dir}$%Twall_in = dflt_real - bc_${dir}$%Twall_out = dflt_real + bc%${dir}$%isothermal_in = .false. + bc%${dir}$%isothermal_out = .false. + bc%${dir}$%Twall_in = dflt_real + bc%${dir}$%Twall_out = dflt_real #:endfor ! Lagrangian subgrid bubble model diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index 1aa7fad220..d09a5397c5 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -72,8 +72,8 @@ contains #:for VAR in ['t_step_old', 'm', 'n', 'p', 'm_glb', 'n_glb', 'p_glb', & & 't_step_start','t_step_stop','t_step_save','t_step_print', & & 'model_eqns','time_stepper', 'riemann_solver', 'low_Mach', & - & 'wave_speeds', 'avg_state', 'precision', 'bc_x%beg', 'bc_x%end', & - & 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', 'fd_order', & + & 'wave_speeds', 'avg_state', 'precision', 'bc%x%beg', 'bc%x%end', & + & 'bc%y%beg', 'bc%y%end', 'bc%z%beg', 'bc%z%end', 'fd_order', & & 'num_probes', 'num_integrals', 'bubble_model', 'thermal', & & 'num_source', 'relax_model', 'num_ibs', 'n_start', & & 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters', & @@ -88,11 +88,11 @@ contains & 'polydisperse', 'qbmm', 'acoustic_source', 'probe_wrt', 'integral_wrt', & & 'prim_vars_wrt', 'weno_avg', 'file_per_process', 'relax', & & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf_x%enabled', 'bf_y%enabled', 'bf_z%enabled', & - & 'bc_x%grcbc_in', 'bc_x%grcbc_out', 'bc_x%grcbc_vel_out', & - & 'bc_y%grcbc_in', 'bc_y%grcbc_out', 'bc_y%grcbc_vel_out', & - & 'bc_z%grcbc_in', 'bc_z%grcbc_out', 'bc_z%grcbc_vel_out', & - & 'bc_x%isothermal_in', 'bc_y%isothermal_in', 'bc_z%isothermal_in', & - & 'bc_x%isothermal_out', 'bc_y%isothermal_out', 'bc_z%isothermal_out', & + & 'bc%x%grcbc_in', 'bc%x%grcbc_out', 'bc%x%grcbc_vel_out', & + & 'bc%y%grcbc_in', 'bc%y%grcbc_out', 'bc%y%grcbc_vel_out', & + & 'bc%z%grcbc_in', 'bc%z%grcbc_out', 'bc%z%grcbc_vel_out', & + & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & + & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out', & & 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', 'surface_tension', & & 'shear_stress', 'bulk_stress', 'bubbles_lagrange', & & 'hyperelasticity', 'down_sample', 'fft_wrt', & @@ -127,15 +127,15 @@ contains #:for VAR in [ 'dt','weno_eps','teno_CT','pref','rhoref','R0ref','Web','Ca', 'sigma', & & 'Re_inv', 'poly_sigma', 'palpha_eps', 'ptgalpha_eps', 'pi_fac', & - & 'bc_x%vb1','bc_x%vb2','bc_x%vb3','bc_x%ve1','bc_x%ve2','bc_x%ve3', & - & 'bc_y%vb1','bc_y%vb2','bc_y%vb3','bc_y%ve1','bc_y%ve2','bc_y%ve3', & - & 'bc_z%vb1','bc_z%vb2','bc_z%vb3','bc_z%ve1','bc_z%ve2','bc_z%ve3', & - & 'bc_x%pres_in','bc_x%pres_out','bc_y%pres_in','bc_y%pres_out', 'bc_z%pres_in','bc_z%pres_out', & + & 'bc%x%vb1','bc%x%vb2','bc%x%vb3','bc%x%ve1','bc%x%ve2','bc%x%ve3', & + & 'bc%y%vb1','bc%y%vb2','bc%y%vb3','bc%y%ve1','bc%y%ve2','bc%y%ve3', & + & 'bc%z%vb1','bc%z%vb2','bc%z%vb3','bc%z%ve1','bc%z%ve2','bc%z%ve3', & + & 'bc%x%pres_in','bc%x%pres_out','bc%y%pres_in','bc%y%pres_out', 'bc%z%pres_in','bc%z%pres_out', & & 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', & & 'z_domain%beg', 'z_domain%end', 'x_stretch%beg', 'x_stretch%end', & & 'y_stretch%beg', 'y_stretch%end', 'z_stretch%beg', 'z_stretch%end', & - & 'bc_x%Twall_in', 'bc_x%Twall_out', 'bc_y%Twall_in', 'bc_y%Twall_out', & - & 'bc_z%Twall_in', 'bc_z%Twall_out', & + & 'bc%x%Twall_in', 'bc%x%Twall_out', 'bc%y%Twall_in', 'bc%y%Twall_out', & + & 'bc%z%Twall_in', 'bc%z%Twall_out', & & 't_stop', 't_save', 'cfl_target', 'Bx0', 'alf_factor', & & 'tau_star', 'cont_damage_s', 'alpha_bar', 'adap_dt_tol', & & 'ic_eps', 'ic_beta', 'hyper_cleaning_speed', & @@ -145,8 +145,8 @@ contains #:endfor do i = 1, 3 - #:for VAR in [ 'bc_x%vel_in', 'bc_x%vel_out', 'bc_y%vel_in', 'bc_y%vel_out', & - & 'bc_z%vel_in', 'bc_z%vel_out' ] + #:for VAR in [ 'bc%x%vel_in', 'bc%x%vel_out', 'bc%y%vel_in', 'bc%y%vel_out', & + & 'bc%z%vel_in', 'bc%z%vel_out' ] call MPI_BCAST(${VAR}$ (i), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do @@ -187,8 +187,8 @@ contains end if do i = 1, num_fluids_max - #:for VAR in ['bc_x%alpha_rho_in','bc_x%alpha_in','bc_y%alpha_rho_in','bc_y%alpha_in','bc_z%alpha_rho_in', & - & 'bc_z%alpha_in'] + #:for VAR in ['bc%x%alpha_rho_in','bc%x%alpha_in','bc%y%alpha_rho_in','bc%y%alpha_in','bc%z%alpha_rho_in', & + & 'bc%z%alpha_in'] call MPI_BCAST(${VAR}$ (i), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do diff --git a/src/simulation/m_rhs.fpp b/src/simulation/m_rhs.fpp index ff02d416cf..d892270364 100644 --- a/src/simulation/m_rhs.fpp +++ b/src/simulation/m_rhs.fpp @@ -928,10 +928,10 @@ contains select case (idir) case (1) ! x-direction - if (bc_x%beg <= BC_CHAR_SLIP_WALL .and. bc_x%beg >= BC_CHAR_SUP_OUTFLOW) then + if (bc%x%beg <= BC_CHAR_SLIP_WALL .and. bc%x%beg >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, -1, irx, iry, irz) end if - if (bc_x%end <= BC_CHAR_SLIP_WALL .and. bc_x%end >= BC_CHAR_SUP_OUTFLOW) then + if (bc%x%end <= BC_CHAR_SLIP_WALL .and. bc%x%end >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, 1, irx, iry, irz) end if @@ -974,10 +974,10 @@ contains call s_add_directional_advection_source_terms(idir, rhs_vf, q_cons_vf, q_prim_vf, flux_src_n_vf, Kterm) case (2) ! y-direction - if (bc_y%beg <= BC_CHAR_SLIP_WALL .and. bc_y%beg >= BC_CHAR_SUP_OUTFLOW) then + if (bc%y%beg <= BC_CHAR_SLIP_WALL .and. bc%y%beg >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, -1, irx, iry, irz) end if - if (bc_y%end <= BC_CHAR_SLIP_WALL .and. bc_y%end >= BC_CHAR_SUP_OUTFLOW) then + if (bc%y%end <= BC_CHAR_SLIP_WALL .and. bc%y%end >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, 1, irx, iry, irz) end if @@ -1041,10 +1041,10 @@ contains call s_add_directional_advection_source_terms(idir, rhs_vf, q_cons_vf, q_prim_vf, flux_src_n_vf, Kterm) case (3) ! z-direction - if (bc_z%beg <= BC_CHAR_SLIP_WALL .and. bc_z%beg >= BC_CHAR_SUP_OUTFLOW) then + if (bc%z%beg <= BC_CHAR_SLIP_WALL .and. bc%z%beg >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, -1, irx, iry, irz) end if - if (bc_z%end <= BC_CHAR_SLIP_WALL .and. bc_z%end >= BC_CHAR_SUP_OUTFLOW) then + if (bc%z%end <= BC_CHAR_SLIP_WALL .and. bc%z%end >= BC_CHAR_SUP_OUTFLOW) then call s_cbc(q_prim_vf%vf, flux_n(idir)%vf, flux_src_n_vf%vf, idir, 1, irx, iry, irz) end if @@ -1437,7 +1437,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (cyl_coord .and. ((bc_y%beg == -2) .or. (bc_y%beg == -14))) then + if (cyl_coord .and. ((bc%y%beg == -2) .or. (bc%y%beg == -14))) then if (viscous .or. dummy) then if (p > 0) then call s_compute_viscous_stress_cylindrical_boundary(q_prim_vf, & @@ -1512,7 +1512,7 @@ contains ! Applying the geometrical viscous Riemann source fluxes calculated as average of values at cell boundaries if (cyl_coord) then - if ((bc_y%beg == -2) .or. (bc_y%beg == -14)) then + if ((bc%y%beg == -2) .or. (bc%y%beg == -14)) then $:GPU_PARALLEL_LOOP(private='[i, j, k, l]', collapse=3) do l = 0, p do k = 1, n diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index 546d3d5a19..1f93351d12 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -3729,7 +3729,7 @@ contains ! Population of Buffers in x-direction if (norm_dir == 1) then - if (bc_x%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning + if (bc%x%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size do l = is3%beg, is3%end @@ -3777,7 +3777,7 @@ contains end if end if - if (bc_x%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end + if (bc%x%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size @@ -3829,7 +3829,7 @@ contains ! Population of Buffers in y-direction else if (norm_dir == 2) then - if (bc_y%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning + if (bc%y%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size do l = is3%beg, is3%end @@ -3875,7 +3875,7 @@ contains end if end if - if (bc_y%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end + if (bc%y%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size @@ -3925,7 +3925,7 @@ contains ! Population of Buffers in z-direction else - if (bc_z%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning + if (bc%z%beg == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at beginning $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size do l = is3%beg, is3%end @@ -3967,7 +3967,7 @@ contains end if end if - if (bc_z%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end + if (bc%z%end == BC_RIEMANN_EXTRAP) then ! Riemann state extrap. BC at end $:GPU_PARALLEL_LOOP(collapse=3) do i = 1, sys_size diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index efda5afc35..bc364d5fa8 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -87,7 +87,7 @@ contains model_eqns, mpp_lim, time_stepper, weno_eps, muscl_eps, & rdma_mpi, teno_CT, mp_weno, weno_avg, & riemann_solver, low_Mach, wave_speeds, avg_state, & - bc_x, bc_y, bc_z, & + bc, & x_stretch, y_stretch, z_stretch, & x_domain, y_domain, z_domain, & hypoelasticity, & @@ -141,7 +141,7 @@ contains if (cfl_adap_dt .or. cfl_const_dt) cfl_dt = .true. - if (any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end/) == -17) .or. num_bc_patches > 0) then + if (any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end/) == -17) .or. num_bc_patches > 0) then bc_io = .true. end if else @@ -857,11 +857,11 @@ contains call s_initialize_global_parameters_module() #:if USING_AMD #:for BC in {-5, -6, -7, -8, -9, -10, -11, -12, -13} - @:PROHIBIT(any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, & - & bc_z%end/) == ${BC}$) .and. eqn_idx%adv%end > 20 .and. (.not. chemistry), & + @:PROHIBIT(any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, & + & bc%z%end/) == ${BC}$) .and. eqn_idx%adv%end > 20 .and. (.not. chemistry), & & "CBC module with AMD compiler requires eqn_idx%adv%end <= 20 when case optimization is turned off") - @:PROHIBIT(any((/bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, & - & bc_z%end/) == ${BC}$) .and. sys_size > 20 .and. (chemistry), & + @:PROHIBIT(any((/bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, & + & bc%z%end/) == ${BC}$) .and. sys_size > 20 .and. (chemistry), & & "CBC module with AMD compiler and chemistry requires sys_size <= 20 when case optimization is turned off") #:endfor #:endif @@ -1031,9 +1031,9 @@ contains call s_mpi_bcast_user_inputs() ! Save original BCs before decomposition overwrites them with MPI neighbor ranks - ib_bc_x = bc_x - ib_bc_y = bc_y - ib_bc_z = bc_z + ib_bc_x = bc%x + ib_bc_y = bc%y + ib_bc_z = bc%z call s_initialize_parallel_io() @@ -1081,19 +1081,19 @@ contains $:GPU_UPDATE(device='[sigma, surface_tension]') $:GPU_UPDATE(device='[x%spacing, y%spacing, z%spacing, x%cb, x%cc, y%cb, y%cc, z%cb, z%cc]') - $:GPU_UPDATE(device='[bc_x%beg, bc_x%end, bc_y%beg, bc_y%end, bc_z%beg, bc_z%end]') - $:GPU_UPDATE(device='[bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3]') - $:GPU_UPDATE(device='[bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3]') - $:GPU_UPDATE(device='[bc_z%vb1, bc_z%vb2, bc_z%vb3, bc_z%ve1, bc_z%ve2, bc_z%ve3]') - - $:GPU_UPDATE(device='[bc_x%grcbc_in, bc_x%grcbc_out, bc_x%grcbc_vel_out]') - $:GPU_UPDATE(device='[bc_y%grcbc_in, bc_y%grcbc_out, bc_y%grcbc_vel_out]') - $:GPU_UPDATE(device='[bc_z%grcbc_in, bc_z%grcbc_out, bc_z%grcbc_vel_out]') - - $:GPU_UPDATE(device='[bc_x%isothermal_in, bc_x%isothermal_out]') - $:GPU_UPDATE(device='[bc_y%isothermal_in, bc_y%isothermal_out]') - $:GPU_UPDATE(device='[bc_z%isothermal_in, bc_z%isothermal_out]') - $:GPU_UPDATE(device='[bc_x%Twall_in, bc_x%Twall_out, bc_y%Twall_in, bc_y%Twall_out, bc_z%Twall_in, bc_z%Twall_out]') + $:GPU_UPDATE(device='[bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end]') + $:GPU_UPDATE(device='[bc%x%vb1, bc%x%vb2, bc%x%vb3, bc%x%ve1, bc%x%ve2, bc%x%ve3]') + $:GPU_UPDATE(device='[bc%y%vb1, bc%y%vb2, bc%y%vb3, bc%y%ve1, bc%y%ve2, bc%y%ve3]') + $:GPU_UPDATE(device='[bc%z%vb1, bc%z%vb2, bc%z%vb3, bc%z%ve1, bc%z%ve2, bc%z%ve3]') + + $:GPU_UPDATE(device='[bc%x%grcbc_in, bc%x%grcbc_out, bc%x%grcbc_vel_out]') + $:GPU_UPDATE(device='[bc%y%grcbc_in, bc%y%grcbc_out, bc%y%grcbc_vel_out]') + $:GPU_UPDATE(device='[bc%z%grcbc_in, bc%z%grcbc_out, bc%z%grcbc_vel_out]') + + $:GPU_UPDATE(device='[bc%x%isothermal_in, bc%x%isothermal_out]') + $:GPU_UPDATE(device='[bc%y%isothermal_in, bc%y%isothermal_out]') + $:GPU_UPDATE(device='[bc%z%isothermal_in, bc%z%isothermal_out]') + $:GPU_UPDATE(device='[bc%x%Twall_in, bc%x%Twall_out, bc%y%Twall_in, bc%y%Twall_out, bc%z%Twall_in, bc%z%Twall_out]') $:GPU_UPDATE(device='[relax, relax_model]') if (relax) then diff --git a/src/simulation/m_surface_tension.fpp b/src/simulation/m_surface_tension.fpp index 60822e3505..98b1121391 100644 --- a/src/simulation/m_surface_tension.fpp +++ b/src/simulation/m_surface_tension.fpp @@ -284,7 +284,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - call s_populate_capillary_buffers(c_divs, bc_type, bc_xyz_info(bc_x, bc_y, bc_z)) + call s_populate_capillary_buffers(c_divs, bc_type, bc) iv%beg = 1; iv%end = num_dims + 1 diff --git a/src/simulation/m_viscous.fpp b/src/simulation/m_viscous.fpp index f6dc194579..55d1747440 100644 --- a/src/simulation/m_viscous.fpp +++ b/src/simulation/m_viscous.fpp @@ -1225,7 +1225,7 @@ contains end if end if - if (bc_x%beg <= BC_GHOST_EXTRAP) then + if (bc%x%beg <= BC_GHOST_EXTRAP) then $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end @@ -1234,7 +1234,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() end if - if (bc_x%end <= BC_GHOST_EXTRAP) then + if (bc%x%end <= BC_GHOST_EXTRAP) then $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do k = idwbuff(2)%beg, idwbuff(2)%end @@ -1245,7 +1245,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if if (n > 0) then - if (bc_y%beg <= BC_GHOST_EXTRAP .and. bc_y%beg /= BC_NULL) then + if (bc%y%beg <= BC_GHOST_EXTRAP .and. bc%y%beg /= BC_NULL) then $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end @@ -1254,7 +1254,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() end if - if (bc_y%end <= BC_GHOST_EXTRAP) then + if (bc%y%end <= BC_GHOST_EXTRAP) then $:GPU_PARALLEL_LOOP(collapse=2) do l = idwbuff(3)%beg, idwbuff(3)%end do j = idwbuff(1)%beg, idwbuff(1)%end @@ -1265,7 +1265,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if if (p > 0) then - if (bc_z%beg <= BC_GHOST_EXTRAP) then + if (bc%z%beg <= BC_GHOST_EXTRAP) then $:GPU_PARALLEL_LOOP(collapse=2) do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end @@ -1275,7 +1275,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() end if - if (bc_z%end <= BC_GHOST_EXTRAP) then + if (bc%z%end <= BC_GHOST_EXTRAP) then $:GPU_PARALLEL_LOOP(collapse=2) do k = idwbuff(2)%beg, idwbuff(2)%end do j = idwbuff(1)%beg, idwbuff(1)%end diff --git a/src/simulation/m_weno.fpp b/src/simulation/m_weno.fpp index 7cd622694a..4377857e6e 100644 --- a/src/simulation/m_weno.fpp +++ b/src/simulation/m_weno.fpp @@ -191,11 +191,11 @@ contains ! Determine cell count, boundary locations, and BCs for selected WENO direction if (weno_dir == 1) then - s = m; s_cb => x%cb; bc_s = bc_x + s = m; s_cb => x%cb; bc_s = bc%x else if (weno_dir == 2) then - s = n; s_cb => y%cb; bc_s = bc_y + s = n; s_cb => y%cb; bc_s = bc%y else - s = p; s_cb => z%cb; bc_s = bc_z + s = p; s_cb => z%cb; bc_s = bc%z end if #:for WENO_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] diff --git a/tests/failed_uuids.txt b/tests/failed_uuids.txt new file mode 100644 index 0000000000..34d9baa7d5 --- /dev/null +++ b/tests/failed_uuids.txt @@ -0,0 +1 @@ +BB07B6F1 diff --git a/toolchain/mfc/case_validator.py b/toolchain/mfc/case_validator.py index 30a0d3c577..f07afd259b 100644 --- a/toolchain/mfc/case_validator.py +++ b/toolchain/mfc/case_validator.py @@ -416,22 +416,22 @@ def check_boundary_conditions(self): var_val = {"m": m, "n": n, "p": p}[var] for bound in ["beg", "end"]: - bc_key = f"bc_{dir}%{bound}" + bc_key = f"bc%{dir}%{bound}" bc_val = self.get(bc_key) self.prohibit(var_val is not None and var_val == 0 and bc_val is not None, f"{bc_key} is not supported for {var} = 0") self.prohibit(var_val is not None and var_val > 0 and bc_val is None, f"{var} != 0 but {bc_key} is not set") # Check periodicity matches - beg_bc = self.get(f"bc_{dir}%beg") - end_bc = self.get(f"bc_{dir}%end") + beg_bc = self.get(f"bc%{dir}%beg") + end_bc = self.get(f"bc%{dir}%end") if beg_bc is not None and end_bc is not None: - self.prohibit((beg_bc == -1 and end_bc != -1) or (end_bc == -1 and beg_bc != -1), f"bc_{dir}%beg and bc_{dir}%end must be both periodic (= -1) or both non-periodic") + self.prohibit((beg_bc == -1 and end_bc != -1) or (end_bc == -1 and beg_bc != -1), f"bc%{dir}%beg and bc_{dir}%end must be both periodic (= -1) or both non-periodic") # Range check (skip for cylindrical y/z) skip_check = cyl_coord and dir in ["y", "z"] for bound in ["beg", "end"]: - bc_key = f"bc_{dir}%{bound}" + bc_key = f"bc%{dir}%{bound}" bc_val = self.get(bc_key) if not skip_check and bc_val is not None: @@ -441,28 +441,28 @@ def check_boundary_conditions(self): # Check BC_NULL is not used for dir in ["x", "y", "z"]: for bound in ["beg", "end"]: - bc_val = self.get(f"bc_{dir}%{bound}") + bc_val = self.get(f"bc%{dir}%{bound}") self.prohibit(bc_val == -13, "Boundary condition -13 (BC_NULL) is not supported") # Cylindrical specific checks if cyl_coord: self.prohibit(n is not None and n == 0, "n must be positive (2D or 3D) for cylindrical coordinates") - bc_y_beg = self.get("bc_y%beg") - bc_y_end = self.get("bc_y%end") - bc_z_beg = self.get("bc_z%beg") - bc_z_end = self.get("bc_z%end") + bc_y_beg = self.get("bc%y%beg") + bc_y_end = self.get("bc%y%end") + bc_z_beg = self.get("bc%z%beg") + bc_z_end = self.get("bc%z%end") - self.prohibit(p is not None and p == 0 and bc_y_beg != -2, "bc_y%beg must be -2 (BC_REFLECTIVE) for 2D cylindrical coordinates (p = 0)") - self.prohibit(p is not None and p > 0 and bc_y_beg != -14, "bc_y%beg must be -14 (BC_AXIS) for 3D cylindrical coordinates (p > 0)") + self.prohibit(p is not None and p == 0 and bc_y_beg != -2, "bc%y%beg must be -2 (BC_REFLECTIVE) for 2D cylindrical coordinates (p = 0)") + self.prohibit(p is not None and p > 0 and bc_y_beg != -14, "bc%y%beg must be -14 (BC_AXIS) for 3D cylindrical coordinates (p > 0)") if bc_y_end is not None: - self.prohibit(bc_y_end > -1 or bc_y_end < -17, "bc_y%end must be between -1 and -17") - self.prohibit(bc_y_end == -14, "bc_y%end must not be -14 (BC_AXIS)") + self.prohibit(bc_y_end > -1 or bc_y_end < -17, "bc%y%end must be between -1 and -17") + self.prohibit(bc_y_end == -14, "bc%y%end must not be -14 (BC_AXIS)") # 3D cylindrical if p is not None and p > 0: - self.prohibit(bc_z_beg is not None and bc_z_beg not in [-1, -2], "bc_z%beg must be -1 (periodic) or -2 (reflective) for 3D cylindrical coordinates") - self.prohibit(bc_z_end is not None and bc_z_end not in [-1, -2], "bc_z%end must be -1 (periodic) or -2 (reflective) for 3D cylindrical coordinates") + self.prohibit(bc_z_beg is not None and bc_z_beg not in [-1, -2], "bc%z%beg must be -1 (periodic) or -2 (reflective) for 3D cylindrical coordinates") + self.prohibit(bc_z_end is not None and bc_z_end not in [-1, -2], "bc%z%end must be -1 (periodic) or -2 (reflective) for 3D cylindrical coordinates") def check_bubbles_euler(self): """Checks constraints on bubble parameters""" @@ -952,7 +952,7 @@ def check_igr_simulation(self): # Characteristic BCs are BC_CHAR_SLIP_WALL (-5) through BC_CHAR_SUP_OUTFLOW (-12) for dir in ["x", "y", "z"]: for bound in ["beg", "end"]: - bc = self.get(f"bc_{dir}%{bound}") + bc = self.get(f"bc%{dir}%{bound}") if bc is not None: self.prohibit(-12 <= bc <= -5, f"Characteristic boundary condition bc_{dir}%{bound} is not compatible with IGR") @@ -1183,11 +1183,11 @@ def check_continuum_damage(self): def check_grcbc(self): """Checks Generalized Relaxation Characteristics BC (simulation)""" for dir in ["x", "y", "z"]: - grcbc_in = self.get(f"bc_{dir}%grcbc_in", "F") == "T" - grcbc_out = self.get(f"bc_{dir}%grcbc_out", "F") == "T" - grcbc_vel_out = self.get(f"bc_{dir}%grcbc_vel_out", "F") == "T" - bc_beg = self.get(f"bc_{dir}%beg") - bc_end = self.get(f"bc_{dir}%end") + grcbc_in = self.get(f"bc%{dir}%grcbc_in", "F") == "T" + grcbc_out = self.get(f"bc%{dir}%grcbc_out", "F") == "T" + grcbc_vel_out = self.get(f"bc%{dir}%grcbc_vel_out", "F") == "T" + bc_beg = self.get(f"bc%{dir}%beg") + bc_end = self.get(f"bc%{dir}%end") if grcbc_in: # Check if EITHER beg OR end is set to -7 @@ -1350,10 +1350,10 @@ def check_chemistry(self): wall_bcs = [-15, -16] for dir in ["x", "y", "z"]: - isothermal_in = self.get(f"bc_{dir}%isothermal_in", "F") == "T" - isothermal_out = self.get(f"bc_{dir}%isothermal_out", "F") == "T" - bc_beg = self.get(f"bc_{dir}%beg") - bc_end = self.get(f"bc_{dir}%end") + isothermal_in = self.get(f"bc%{dir}%isothermal_in", "F") == "T" + isothermal_out = self.get(f"bc%{dir}%isothermal_out", "F") == "T" + bc_beg = self.get(f"bc%{dir}%beg") + bc_end = self.get(f"bc%{dir}%end") if isothermal_in: # Prohibit isothermal boundaries if chemistry or diffusion are disabled @@ -1363,7 +1363,7 @@ def check_chemistry(self): self.prohibit(bc_beg not in wall_bcs, f"Isothermal In (bc_{dir}%isothermal_in) requires a wall. Set bc_{dir}%beg to -15 (slip) or -16 (no-slip).") # Check that the wall temperature is defined and physically valid (> 0 K) - tw_in = self.get(f"bc_{dir}%Twall_in") + tw_in = self.get(f"bc%{dir}%Twall_in") self.prohibit(tw_in is None, f"Isothermal In (bc_{dir}%isothermal_in) requires a wall temperature to be set (e.g., bc_{dir}%Twall_in).") if tw_in is not None and self._is_numeric(tw_in): self.prohibit(tw_in <= 0.0, f"Wall temperature bc_{dir}%Twall_in must be strictly positive for thermodynamics (got {tw_in}).") @@ -1376,7 +1376,7 @@ def check_chemistry(self): self.prohibit(bc_end not in wall_bcs, f"Isothermal Out (bc_{dir}%isothermal_out) requires a wall. Set bc_{dir}%end to -15 (slip) or -16 (no-slip).") # Check that the wall temperature is defined and physically valid (> 0 K) - tw_out = self.get(f"bc_{dir}%Twall_out") + tw_out = self.get(f"bc%{dir}%Twall_out") self.prohibit(tw_out is None, f"Isothermal Out (bc_{dir}%isothermal_out) requires a wall temperature to be set (e.g., bc_{dir}%Twall_out).") if tw_out is not None and self._is_numeric(tw_out): self.prohibit(tw_out <= 0.0, f"Wall temperature bc_{dir}%Tw_out must be strictly positive for thermodynamics (got {tw_out}).") @@ -1704,7 +1704,7 @@ def check_fft(self): # BC checks: all boundaries must be periodic (-1) for direction in ["x", "y", "z"]: for end in ["beg", "end"]: - bc_val = self.get(f"bc_{direction}%{end}") + bc_val = self.get(f"bc%{direction}%{end}") if bc_val is not None: self.prohibit(bc_val != -1, "FFT WRT requires periodic BCs (all BCs should be -1)") diff --git a/toolchain/mfc/fp_stability.py b/toolchain/mfc/fp_stability.py index 4095fb32d8..5064bbdbff 100644 --- a/toolchain/mfc/fp_stability.py +++ b/toolchain/mfc/fp_stability.py @@ -130,8 +130,8 @@ def _merge(*dicts): "num_patches": 2, "model_eqns": 2, "weno_order": 5, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, "precision": 2, "parallel_io": "F", "patch_icpp(1)%geometry": 1, @@ -163,8 +163,8 @@ def _merge(*dicts): "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, "precision": 2, "prim_vars_wrt": "F", "parallel_io": "F", diff --git a/toolchain/mfc/gen_physics_docs.py b/toolchain/mfc/gen_physics_docs.py index f81c689117..2f54fbfe25 100644 --- a/toolchain/mfc/gen_physics_docs.py +++ b/toolchain/mfc/gen_physics_docs.py @@ -48,7 +48,7 @@ # Regex to detect code-like tokens in validation messages. # Matches (in order of priority): -# 1. Fortran-style accessors: fluid_pp(i)%gamma, bc_y%beg +# 1. Fortran-style accessors: fluid_pp(i)%gamma, bc%y%beg # 2. Known short param names with optional array index: alpha(j), vel(2), Re(1), nb, dt # 3. Snake_case identifiers with optional array index: model_eqns, weno_order, alpha_rho(j) # 4. Single-letter grid dimension params: m, n, p diff --git a/toolchain/mfc/init.py b/toolchain/mfc/init.py index 12d0317bfd..0c4ac860d9 100644 --- a/toolchain/mfc/init.py +++ b/toolchain/mfc/init.py @@ -81,8 +81,8 @@ "avg_state": 2, # Boundary Conditions (-3 = extrapolation) - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, # Output "format": 1, @@ -187,10 +187,10 @@ "avg_state": 2, # Boundary Conditions - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, # Output "format": 1, @@ -304,12 +304,12 @@ "avg_state": 2, # Boundary Conditions - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Output "format": 1, diff --git a/toolchain/mfc/lint_param_docs.py b/toolchain/mfc/lint_param_docs.py index 657ddae5af..3f083828ac 100644 --- a/toolchain/mfc/lint_param_docs.py +++ b/toolchain/mfc/lint_param_docs.py @@ -49,7 +49,7 @@ def _param_appears_in_case_md(param_base: str, tokens: set[str], text: str) -> b attr = param_base.split("%", 1)[1] if f"`{attr}`" in text or f"`{attr}(" in text: return True - # x/y/z axis variants: bc_x%beg matches bc_[x,y,z]%beg[end] + # x/y/z axis variants: stretch_x%beg matches stretch_[x,y,z]%beg[end] for axis in ("x", "y", "z"): if param_base.startswith(f"{axis}_") or param_base.startswith(f"{axis}%"): rest = param_base[len(axis) :] @@ -60,7 +60,7 @@ def _param_appears_in_case_md(param_base: str, tokens: set[str], text: str) -> b return True if re.search(rf"`[^`]*\[.*{re.escape(axis)}.*\]{re.escape(rest)}", text): return True - # stretch_x -> stretch_x[y,z] or bc_x%beg -> bc_[x,y,z]%beg + # stretch_x -> stretch_x[y,z] or a_x -> a_[x,y,z] m = re.match(rf"^(.+_){axis}(.*)$", param_base) if m: pfx, sfx = m.group(1), m.group(2) @@ -71,6 +71,17 @@ def _param_appears_in_case_md(param_base: str, tokens: set[str], text: str) -> b sib = pfx + other + sfx if re.search(rf"`[^`]*\b{re.escape(sib)}\b[^`]*`", text): return True + # bc%x%beg -> bc%[x,y,z]%beg (percent-delimited axis component) + m2 = re.match(rf"^(.+%)({axis})(%.*|$)", param_base) + if m2: + pfx, sfx = m2.group(1), m2.group(3) + if re.search(rf"`{re.escape(pfx)}\[.*{re.escape(axis)}.*\]{re.escape(sfx)}", text): + return True + for other in ("x", "y", "z"): + if other != axis: + sib = pfx + other + sfx + if re.search(rf"`[^`]*\b{re.escape(sib)}\b[^`]*`", text): + return True # %beg/%end shorthand: param%beg matches if param%end is present if param_base.endswith("%beg") or param_base.endswith("%end"): stem = param_base.rsplit("%", 1)[0] diff --git a/toolchain/mfc/params/definitions.py b/toolchain/mfc/params/definitions.py index 737d701d89..844210593f 100644 --- a/toolchain/mfc/params/definitions.py +++ b/toolchain/mfc/params/definitions.py @@ -329,7 +329,7 @@ def _auto_describe(name: str) -> str: attr_desc = _ATTR_DESCS.get(attr, attr.replace("_", " ")) return f"{attr_desc} for {prefix_desc} {idx}" - # Handle bc_x%attr style (no index in prefix) + # Handle bc%x%attr style (no index in prefix) if "%" in name: prefix, attr = name.split("%", 1) # Check for indexed attr @@ -477,7 +477,7 @@ def _lookup_hint(name): return "" # Compound name: extract family and attribute prefix, attr_full = name.split("%", 1) - # Normalize family: "bc_x" → "bc", "patch_bc(1)" → "patch" + # Normalize family: strip underscore/index suffix — "patch_bc(1)" → "patch" family = re.sub(r"[_(].*", "", prefix) if family not in HINTS: # Fallback: keep underscores — "patch_bc" → "patch_bc", "simplex_params" → "simplex_params" @@ -995,8 +995,8 @@ def _load(): # Boundary conditions for d in ["x", "y", "z"]: - _r(f"bc_{d}%beg", INT, {"bc"}) - _r(f"bc_{d}%end", INT, {"bc"}) + _r(f"bc%{d}%beg", INT, {"bc"}) + _r(f"bc%{d}%end", INT, {"bc"}) # Relativity _r("relativity", LOG, {"relativity"}) @@ -1252,7 +1252,7 @@ def _load(): # Extended BC for d in ["x", "y", "z"]: - px = f"bc_{d}%" + px = f"bc%{d}%" for a in ["vb1", "vb2", "vb3", "ve1", "ve2", "ve3", "pres_in", "pres_out"]: _r(f"{px}{a}", REAL, {"bc"}) for a in ["grcbc_in", "grcbc_out", "grcbc_vel_out"]: diff --git a/toolchain/mfc/params/descriptions.py b/toolchain/mfc/params/descriptions.py index 630085bade..f7ac3dbcbd 100644 --- a/toolchain/mfc/params/descriptions.py +++ b/toolchain/mfc/params/descriptions.py @@ -80,12 +80,12 @@ "avg_state": "Average state for Riemann solver", "low_Mach": "Low Mach number correction", # Boundary conditions - "bc_x%beg": "Boundary condition at x-begin (-1=periodic, -2=reflective, -3=symmetric, etc.)", - "bc_x%end": "Boundary condition at x-end", - "bc_y%beg": "Boundary condition at y-begin", - "bc_y%end": "Boundary condition at y-end", - "bc_z%beg": "Boundary condition at z-begin", - "bc_z%end": "Boundary condition at z-end", + "bc%x%beg": "Boundary condition at x-begin (-1=periodic, -2=reflective, -3=symmetric, etc.)", + "bc%x%end": "Boundary condition at x-end", + "bc%y%beg": "Boundary condition at y-begin", + "bc%y%end": "Boundary condition at y-end", + "bc%z%beg": "Boundary condition at z-begin", + "bc%z%end": "Boundary condition at z-end", "num_bc_patches": "Number of boundary condition patches", # Physics models "bubbles_euler": "Enable Euler-Euler bubble model", diff --git a/toolchain/mfc/params/generators/docs_gen.py b/toolchain/mfc/params/generators/docs_gen.py index 2e9f877b3b..57c8767890 100644 --- a/toolchain/mfc/params/generators/docs_gen.py +++ b/toolchain/mfc/params/generators/docs_gen.py @@ -53,7 +53,7 @@ def _collapse_indices(name: str) -> str: Examples: patch_icpp(1)%vel(2) -> patch_icpp(N)%vel(M) simplex_params%perturb_dens_offset(1, 2) -> simplex_params%perturb_dens_offset(N, M) - bc_x%vel_in(1) -> bc_x%vel_in(N) + bc%x%vel_in(1) -> bc%x%vel_in(N) """ placeholders = ["N", "M", "K", "L", "P", "Q"] placeholder_idx = 0 @@ -388,9 +388,7 @@ def generate_parameter_docs() -> str: "patch_bc": "Boundary condition patch parameters", "fluid_pp": "Fluid material properties", "acoustic": "Acoustic source parameters", - "bc_x": "X-direction boundary conditions", - "bc_y": "Y-direction boundary conditions", - "bc_z": "Z-direction boundary conditions", + "bc": "Boundary conditions (x/y/z directions)", "probe": "Probe/monitoring point parameters", "integral": "Integral region parameters", "simplex_params": "Simplex noise perturbation parameters", diff --git a/toolchain/mfc/params/namelist_parser.py b/toolchain/mfc/params/namelist_parser.py index b013807583..445c2ec676 100644 --- a/toolchain/mfc/params/namelist_parser.py +++ b/toolchain/mfc/params/namelist_parser.py @@ -27,9 +27,7 @@ "a_y", "a_z", "adv_n", - "bc_x", - "bc_y", - "bc_z", + "bc", "bub_pp", "bubbles_euler", "bubbles_lagrange", @@ -141,9 +139,7 @@ "alpha_bar", "alt_soundspeed", "avg_state", - "bc_x", - "bc_y", - "bc_z", + "bc", "bf_x%enabled", "bf_y%enabled", "bf_z%enabled", @@ -288,9 +284,7 @@ "alpha_wrt", "alt_soundspeed", "avg_state", - "bc_x", - "bc_y", - "bc_z", + "bc", "bub_pp", "bubbles_euler", "bubbles_lagrange", diff --git a/toolchain/mfc/params_cmd.py b/toolchain/mfc/params_cmd.py index 577dfeeb55..782c81f327 100644 --- a/toolchain/mfc/params_cmd.py +++ b/toolchain/mfc/params_cmd.py @@ -53,7 +53,7 @@ def _collapse_indexed_params(matches): Collapse indexed parameters into patterns. Handles multiple index patterns: - - Suffix index: bc_z%alpha_in(1) -> bc_z%alpha_in(N) + - Suffix index: bc%z%alpha_in(1) -> bc%z%alpha_in(N) - Prefix index: patch_icpp(1)%geometry -> patch_icpp(N)%geometry - Both: patch_icpp(1)%alpha(1) -> patch_icpp(N)%alpha(M) """ diff --git a/toolchain/mfc/params_tests/mutation_tests.py b/toolchain/mfc/params_tests/mutation_tests.py index aecb7a62c0..fb555a4889 100644 --- a/toolchain/mfc/params_tests/mutation_tests.py +++ b/toolchain/mfc/params_tests/mutation_tests.py @@ -47,10 +47,10 @@ class MutationResult: "mpp_lim": ["X", "yes"], "cyl_coord": ["X", "maybe"], # BOUNDARY CONDITIONS - "bc_x%beg": [None, 100, -100], - "bc_x%end": [None, 100, -100], - "bc_y%beg": [100, -100], - "bc_y%end": [100, -100], + "bc%x%beg": [None, 100, -100], + "bc%x%end": [None, 100, -100], + "bc%y%beg": [100, -100], + "bc%y%end": [100, -100], # DOMAIN PARAMETERS "x_domain%beg": [None], "x_domain%end": [None], diff --git a/toolchain/mfc/params_tests/negative_tests.py b/toolchain/mfc/params_tests/negative_tests.py index b379b9b44a..66b3d29c1f 100644 --- a/toolchain/mfc/params_tests/negative_tests.py +++ b/toolchain/mfc/params_tests/negative_tests.py @@ -36,8 +36,8 @@ class ConstraintTest: "t_step_save": 10, "dt": 1e-6, "weno_order": 5, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "x_domain%beg": 0.0, "x_domain%end": 1.0, "patch_icpp(1)%geometry": 1, @@ -198,16 +198,16 @@ def generate_constraint_tests() -> List[ConstraintTest]: ConstraintTest( method="check_boundary_conditions", line_number=0, - message="bc_x%beg must be set", - condition="bc_x%beg is None", - test_params={**BASE_CASE, "bc_x%beg": None}, + message="bc%x%beg must be set", + condition="bc%x%beg is None", + test_params={**BASE_CASE, "bc%x%beg": None}, ), ConstraintTest( method="check_boundary_conditions", line_number=0, - message="bc_x%end must be set", - condition="bc_x%end is None", - test_params={**BASE_CASE, "bc_x%end": None}, + message="bc%x%end must be set", + condition="bc%x%end is None", + test_params={**BASE_CASE, "bc%x%end": None}, ), ] ) @@ -249,8 +249,8 @@ def generate_constraint_tests() -> List[ConstraintTest]: test_params={ **BASE_CASE, "n": 10, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "y_domain%beg": 0.0, "y_domain%end": 1.0, "num_fluids": 2, diff --git a/toolchain/mfc/params_tests/test_definitions.py b/toolchain/mfc/params_tests/test_definitions.py index ca731c1044..a5c9402d2c 100644 --- a/toolchain/mfc/params_tests/test_definitions.py +++ b/toolchain/mfc/params_tests/test_definitions.py @@ -42,8 +42,8 @@ def test_domain_params_exist(self): for d in ["x", "y", "z"]: self.assertIn(f"{d}_domain%beg", REGISTRY.all_params) self.assertIn(f"{d}_domain%end", REGISTRY.all_params) - self.assertIn(f"bc_{d}%beg", REGISTRY.all_params) - self.assertIn(f"bc_{d}%end", REGISTRY.all_params) + self.assertIn(f"bc%{d}%beg", REGISTRY.all_params) + self.assertIn(f"bc%{d}%end", REGISTRY.all_params) class TestConstraintValidation(unittest.TestCase): diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index 30e9d4a166..3a256d244d 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -165,7 +165,7 @@ def _h_sweep(case_path, ndim, cons_vars, extra_args, expected, tol, resolutions, def get_bc_mods(bc: int, dimInfo): params = {} for dimCmp in dimInfo[0]: - params.update({f"bc_{dimCmp}%beg": bc, f"bc_{dimCmp}%end": bc}) + params.update({f"bc%{dimCmp}%beg": bc, f"bc%{dimCmp}%end": bc}) return params @@ -254,21 +254,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(1)": 1.0, "patch_icpp(2)%vel(1)": 1.0, "patch_icpp(3)%vel(1)": 1.0, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "T", - "bc_x%vel_in(1)": 1.0, - "bc_x%vel_in(2)": 0.0, - "bc_x%vel_in(3)": 0.0, - "bc_x%vel_out(1)": 1.0, - "bc_x%vel_out(2)": 0.0, - "bc_x%vel_out(3)": 0.0, - "bc_x%pres_in": 1.0, - "bc_x%pres_out": 1.0, - "bc_x%alpha_in(1)": 1.0, - "bc_x%alpha_rho_in(1)": 1.0, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "T", + "bc%x%vel_in(1)": 1.0, + "bc%x%vel_in(2)": 0.0, + "bc%x%vel_in(3)": 0.0, + "bc%x%vel_out(1)": 1.0, + "bc%x%vel_out(2)": 0.0, + "bc%x%vel_out(3)": 0.0, + "bc%x%pres_in": 1.0, + "bc%x%pres_out": 1.0, + "bc%x%alpha_in(1)": 1.0, + "bc%x%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -280,21 +280,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(1)": 1.0, "patch_icpp(2)%vel(1)": 1.0, "patch_icpp(3)%vel(1)": 1.0, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "T", - "bc_x%vel_in(1)": 1.0, - "bc_x%vel_in(2)": 0.0, - "bc_x%vel_in(3)": 0.0, - "bc_x%vel_out(1)": 1.0, - "bc_x%vel_out(2)": 0.0, - "bc_x%vel_out(3)": 0.0, - "bc_x%pres_in": 1.0, - "bc_x%pres_out": 1.0, - "bc_x%alpha_in(1)": 1.0, - "bc_x%alpha_rho_in(1)": 1.0, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "T", + "bc%x%vel_in(1)": 1.0, + "bc%x%vel_in(2)": 0.0, + "bc%x%vel_in(3)": 0.0, + "bc%x%vel_out(1)": 1.0, + "bc%x%vel_out(2)": 0.0, + "bc%x%vel_out(3)": 0.0, + "bc%x%pres_in": 1.0, + "bc%x%pres_out": 1.0, + "bc%x%alpha_in(1)": 1.0, + "bc%x%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -306,21 +306,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(2)": 1.0, "patch_icpp(2)%vel(2)": 1.0, "patch_icpp(3)%vel(2)": 1.0, - "bc_y%beg": -7, - "bc_y%end": -8, - "bc_y%grcbc_in": "T", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "T", - "bc_y%vel_in(1)": 0.0, - "bc_y%vel_in(2)": 1.0, - "bc_y%vel_in(3)": 0.0, - "bc_y%vel_out(1)": 0.0, - "bc_y%vel_out(2)": 1.0, - "bc_y%vel_out(3)": 0.0, - "bc_y%pres_in": 1.0, - "bc_y%pres_out": 1.0, - "bc_y%alpha_in(1)": 1.0, - "bc_y%alpha_rho_in(1)": 1.0, + "bc%y%beg": -7, + "bc%y%end": -8, + "bc%y%grcbc_in": "T", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "T", + "bc%y%vel_in(1)": 0.0, + "bc%y%vel_in(2)": 1.0, + "bc%y%vel_in(3)": 0.0, + "bc%y%vel_out(1)": 0.0, + "bc%y%vel_out(2)": 1.0, + "bc%y%vel_out(3)": 0.0, + "bc%y%pres_in": 1.0, + "bc%y%pres_out": 1.0, + "bc%y%alpha_in(1)": 1.0, + "bc%y%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc y"], {})) @@ -332,21 +332,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(1)": 1.0, "patch_icpp(2)%vel(1)": 1.0, "patch_icpp(3)%vel(1)": 1.0, - "bc_x%beg": -7, - "bc_x%end": -8, - "bc_x%grcbc_in": "T", - "bc_x%grcbc_out": "T", - "bc_x%grcbc_vel_out": "T", - "bc_x%vel_in(1)": 1.0, - "bc_x%vel_in(2)": 0.0, - "bc_x%vel_in(3)": 0.0, - "bc_x%vel_out(1)": 1.0, - "bc_x%vel_out(2)": 0.0, - "bc_x%vel_out(3)": 0.0, - "bc_x%pres_in": 1.0, - "bc_x%pres_out": 1.0, - "bc_x%alpha_in(1)": 1.0, - "bc_x%alpha_rho_in(1)": 1.0, + "bc%x%beg": -7, + "bc%x%end": -8, + "bc%x%grcbc_in": "T", + "bc%x%grcbc_out": "T", + "bc%x%grcbc_vel_out": "T", + "bc%x%vel_in(1)": 1.0, + "bc%x%vel_in(2)": 0.0, + "bc%x%vel_in(3)": 0.0, + "bc%x%vel_out(1)": 1.0, + "bc%x%vel_out(2)": 0.0, + "bc%x%vel_out(3)": 0.0, + "bc%x%pres_in": 1.0, + "bc%x%pres_out": 1.0, + "bc%x%alpha_in(1)": 1.0, + "bc%x%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -358,21 +358,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(2)": 1.0, "patch_icpp(2)%vel(2)": 1.0, "patch_icpp(3)%vel(2)": 1.0, - "bc_y%beg": -7, - "bc_y%end": -8, - "bc_y%grcbc_in": "T", - "bc_y%grcbc_out": "T", - "bc_y%grcbc_vel_out": "T", - "bc_y%vel_in(1)": 0.0, - "bc_y%vel_in(2)": 1.0, - "bc_y%vel_in(3)": 0.0, - "bc_y%vel_out(1)": 0.0, - "bc_y%vel_out(2)": 1.0, - "bc_y%vel_out(3)": 0.0, - "bc_y%pres_in": 1.0, - "bc_y%pres_out": 1.0, - "bc_y%alpha_in(1)": 1.0, - "bc_y%alpha_rho_in(1)": 1.0, + "bc%y%beg": -7, + "bc%y%end": -8, + "bc%y%grcbc_in": "T", + "bc%y%grcbc_out": "T", + "bc%y%grcbc_vel_out": "T", + "bc%y%vel_in(1)": 0.0, + "bc%y%vel_in(2)": 1.0, + "bc%y%vel_in(3)": 0.0, + "bc%y%vel_out(1)": 0.0, + "bc%y%vel_out(2)": 1.0, + "bc%y%vel_out(3)": 0.0, + "bc%y%pres_in": 1.0, + "bc%y%pres_out": 1.0, + "bc%y%alpha_in(1)": 1.0, + "bc%y%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc y"], {})) @@ -384,21 +384,21 @@ def alter_grcbc(dimInfo): "patch_icpp(1)%vel(3)": 1.0, "patch_icpp(2)%vel(3)": 1.0, "patch_icpp(3)%vel(3)": 1.0, - "bc_z%beg": -7, - "bc_z%end": -8, - "bc_z%grcbc_in": "T", - "bc_z%grcbc_out": "T", - "bc_z%grcbc_vel_out": "T", - "bc_z%vel_in(1)": 0.0, - "bc_z%vel_in(2)": 0.0, - "bc_z%vel_in(3)": 1.0, - "bc_z%vel_out(1)": 0.0, - "bc_z%vel_out(2)": 0.0, - "bc_z%vel_out(3)": 1.0, - "bc_z%pres_in": 1.0, - "bc_z%pres_out": 1.0, - "bc_z%alpha_in(1)": 1.0, - "bc_z%alpha_rho_in(1)": 1.0, + "bc%z%beg": -7, + "bc%z%end": -8, + "bc%z%grcbc_in": "T", + "bc%z%grcbc_out": "T", + "bc%z%grcbc_vel_out": "T", + "bc%z%vel_in(1)": 0.0, + "bc%z%vel_in(2)": 0.0, + "bc%z%vel_in(3)": 1.0, + "bc%z%vel_out(1)": 0.0, + "bc%z%vel_out(2)": 0.0, + "bc%z%vel_out(3)": 1.0, + "bc%z%pres_in": 1.0, + "bc%z%pres_out": 1.0, + "bc%z%alpha_in(1)": 1.0, + "bc%z%alpha_rho_in(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc z"], {})) @@ -633,7 +633,7 @@ def alter_2d(): "Axisymmetric", { "num_fluids": 2, - "bc_y%beg": -2, + "bc%y%beg": -2, "cyl_coord": "T", "fluid_pp(2)%gamma": 2.5, "fluid_pp(2)%pi_inf": 0.0, @@ -673,9 +673,9 @@ def alter_3d(): stack.push( "Cylindrical", { - "bc_y%beg": -14, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%y%beg": -14, + "bc%z%beg": -1, + "bc%z%end": -1, "cyl_coord": "T", "x_domain%beg": 0.0e00, "x_domain%end": 5.0e00, @@ -874,10 +874,10 @@ def alter_ib(dimInfo, six_eqn_model=False, viscous=False): { "ib": "T", "num_ibs": 1, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, "patch_ib(1)%geometry": 2, "patch_ib(1)%x_centroid": 0.0, "patch_ib(1)%y_centroid": 0.0, @@ -938,7 +938,7 @@ def alter_acoustic_src(dimInfo): stack.push("Transducer", transducer_params) for support in [5, 6]: - stack.push(f"support={support}", {"acoustic(1)%support": support, "cyl_coord": "T" if support == 6 else "F", "bc_y%beg": -2 if support == 6 else -3}) + stack.push(f"support={support}", {"acoustic(1)%support": support, "cyl_coord": "T" if support == 6 else "F", "bc%y%beg": -2 if support == 6 else -3}) cases.append(define_case_d(stack, "Sine", {})) cases.append(define_case_d(stack, "Gaussian", {"acoustic(1)%pulse": 2, "acoustic(1)%delay": 0.02, "acoustic(1)%gauss_sigma_dist": 0.01})) cases.append(define_case_d(stack, "Delay", {"acoustic(1)%delay": 0.02})) @@ -950,7 +950,7 @@ def alter_acoustic_src(dimInfo): cases.append(define_case_d(stack, "All Elements", {})) cases.append(define_case_d(stack, "One element", {"acoustic(1)%element_on": 1})) stack.pop() - cases.append(define_case_d(stack, "support=10", {"acoustic(1)%support": 10, "cyl_coord": "T", "bc_y%beg": -2})) + cases.append(define_case_d(stack, "support=10", {"acoustic(1)%support": 10, "cyl_coord": "T", "bc%y%beg": -2})) stack.pop() stack.pop() @@ -1160,9 +1160,9 @@ def alter_hypoelasticity(dimInfo): cases.append(define_case_d(stack, "", {})) - reflective_params = {"bc_x%beg": -2, "bc_x%end": -2, "bc_y%beg": -2, "bc_y%end": -2} + reflective_params = {"bc%x%beg": -2, "bc%x%end": -2, "bc%y%beg": -2, "bc%y%end": -2} if len(dimInfo[0]) == 3: - reflective_params.update({"bc_z%beg": -2, "bc_z%end": -2}) + reflective_params.update({"bc%z%beg": -2, "bc%z%end": -2}) if num_fluids == 1: cases.append(define_case_d(stack, "cont_damage", {"cont_damage": "T", "tau_star": 0.0, "cont_damage_s": 2.0, "alpha_bar": 1e-4})) @@ -1224,16 +1224,16 @@ def alter_mixlayer_perturb(dimInfo): "num_fluids": 1, "x_domain%beg": 0.0, "x_domain%end": 20.0, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "y_domain%beg": -10.0, "y_domain%end": 10.0, - "bc_y%beg": -6, - "bc_y%end": -6, + "bc%y%beg": -6, + "bc%y%end": -6, "z_domain%beg": 0.0, "z_domain%end": 20.0, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "mixlayer_vel_profile": "T", "mixlayer_perturb": "T", "weno_Re_flux": "F", @@ -1810,12 +1810,12 @@ def chemistry_cases(): "num_fluids": 1, "x_domain%beg": 0.0, "x_domain%end": 0.05, - "bc_x%beg": -16, # Left Isothermal Wall - "bc_x%end": -16, # Right Isothermal Wall - "bc_x%isothermal_in": "T", - "bc_x%Twall_in": 600.0, - "bc_x%isothermal_out": "T", - "bc_x%Twall_out": 900.0, + "bc%x%beg": -16, # Left Isothermal Wall + "bc%x%end": -16, # Right Isothermal Wall + "bc%x%isothermal_in": "T", + "bc%x%Twall_in": 600.0, + "bc%x%isothermal_out": "T", + "bc%x%Twall_out": 900.0, "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", @@ -1863,12 +1863,12 @@ def chemistry_cases(): "x_domain%end": 0.05, "y_domain%beg": 0.0, "y_domain%end": 0.05, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -16, - "bc_y%end": -3, - "bc_y%isothermal_in": "T", - "bc_y%Twall_in": 600.0, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -16, + "bc%y%end": -3, + "bc%y%isothermal_in": "T", + "bc%y%Twall_in": 600.0, "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", @@ -1914,8 +1914,8 @@ def chemistry_cases(): "num_fluids": 1, "x_domain%beg": 0.0, "x_domain%end": 0.05, - "bc_x%beg": -1, - "bc_x%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, "weno_order": 5, "weno_eps": 1e-16, "weno_avg": "F", @@ -1975,12 +1975,12 @@ def direction_symmetry_tests(): "y_domain%end": 1.0e00, "z_domain%beg": 0.0e00, "z_domain%end": 1.0e00, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, } centroids = [0.05, 0.45, 0.9] @@ -2019,12 +2019,12 @@ def mpi_consistency_tests(): "y_domain%end": 1.0e00, "z_domain%beg": 0.0e00, "z_domain%end": 1.0e00, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, } for patchID in range(1, 4): @@ -2166,8 +2166,8 @@ def restart_roundtrip_tests(): "p": 0, "x_domain%beg": 0.0e00, "x_domain%end": 1.0e00, - "bc_x%beg": -3, - "bc_x%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, "patch_icpp(1)%geometry": 1, "patch_icpp(2)%geometry": 1, "patch_icpp(3)%geometry": 1, @@ -2196,12 +2196,12 @@ def restart_roundtrip_tests(): "y_domain%end": 1.0e00, "z_domain%beg": 0.0e00, "z_domain%end": 1.0e00, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, } for patchID in range(1, 4): base_3d[f"patch_icpp({patchID})%geometry"] = 9 @@ -2252,12 +2252,12 @@ def kernel_golden_tests(): "y_domain%end": 1.0e00, "z_domain%beg": 0.0e00, "z_domain%end": 1.0e00, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, } for patchID in range(1, 4): base_3d[f"patch_icpp({patchID})%geometry"] = 9 @@ -2342,10 +2342,10 @@ def kernel_golden_tests(): "x_domain%end": 1.0, "y_domain%beg": 0.0, "y_domain%end": 1.0, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, "num_patches": 2, "num_fluids": 2, "fluid_pp(2)%gamma": 2.5, From 81fcf1dae1d3b8324765045d5e362056a57532f8 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Tue, 12 May 2026 21:17:25 -0500 Subject: [PATCH 12/20] fix: update benchmarks and test golden case.py files to bc%x/y/z naming --- benchmarks/5eq_rk3_weno3_hllc/case.py | 12 ++++++------ benchmarks/hypo_hll/case.py | 12 ++++++------ benchmarks/ibm/case.py | 12 ++++++------ benchmarks/igr/case.py | 12 ++++++------ benchmarks/viscous_weno5_sgb_acoustic/case.py | 12 ++++++------ tests/failed_uuids.txt | 9 ++++++++- 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/benchmarks/5eq_rk3_weno3_hllc/case.py b/benchmarks/5eq_rk3_weno3_hllc/case.py index 29bb6fca94..854756fc1c 100644 --- a/benchmarks/5eq_rk3_weno3_hllc/case.py +++ b/benchmarks/5eq_rk3_weno3_hllc/case.py @@ -209,12 +209,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -6, - "bc_x%end": -6, - "bc_y%beg": -2, - "bc_y%end": -3, - "bc_z%beg": -2, - "bc_z%end": -3, + "bc%x%beg": -6, + "bc%x%end": -6, + "bc%y%beg": -2, + "bc%y%end": -3, + "bc%z%beg": -2, + "bc%z%end": -3, # Formatted Database Files Structure Parameters "format": 1, "precision": 2, diff --git a/benchmarks/hypo_hll/case.py b/benchmarks/hypo_hll/case.py index 6a92ee3a3d..e90236b470 100644 --- a/benchmarks/hypo_hll/case.py +++ b/benchmarks/hypo_hll/case.py @@ -64,12 +64,12 @@ "riemann_solver": 1, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Turning on Hypoelasticity "hypoelasticity": "T", "fd_order": 4, diff --git a/benchmarks/ibm/case.py b/benchmarks/ibm/case.py index 697973b8ed..a4d40a03a2 100644 --- a/benchmarks/ibm/case.py +++ b/benchmarks/ibm/case.py @@ -68,12 +68,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, # Turn on IBM "ib": "T", "num_ibs": 1, diff --git a/benchmarks/igr/case.py b/benchmarks/igr/case.py index 65a4ee2f83..076b207ddb 100644 --- a/benchmarks/igr/case.py +++ b/benchmarks/igr/case.py @@ -71,12 +71,12 @@ "num_fluids": 1, "riemann_solver": 5, "time_stepper": 3, - "bc_x%beg": -1, - "bc_x%end": -1, - "bc_y%beg": -1, - "bc_y%end": -1, - "bc_z%beg": -1, - "bc_z%end": -1, + "bc%x%beg": -1, + "bc%x%end": -1, + "bc%y%beg": -1, + "bc%y%end": -1, + "bc%z%beg": -1, + "bc%z%end": -1, "igr": "T", "igr_order": 5, "igr_iter_solver": 1, diff --git a/benchmarks/viscous_weno5_sgb_acoustic/case.py b/benchmarks/viscous_weno5_sgb_acoustic/case.py index ebc13e6161..a68c47ba12 100644 --- a/benchmarks/viscous_weno5_sgb_acoustic/case.py +++ b/benchmarks/viscous_weno5_sgb_acoustic/case.py @@ -114,12 +114,12 @@ "riemann_solver": 2, "wave_speeds": 1, "avg_state": 2, - "bc_x%beg": -3, - "bc_x%end": -3, - "bc_y%beg": -3, - "bc_y%end": -3, - "bc_z%beg": -3, - "bc_z%end": -3, + "bc%x%beg": -3, + "bc%x%end": -3, + "bc%y%beg": -3, + "bc%y%end": -3, + "bc%z%beg": -3, + "bc%z%end": -3, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/tests/failed_uuids.txt b/tests/failed_uuids.txt index 34d9baa7d5..5dac491544 100644 --- a/tests/failed_uuids.txt +++ b/tests/failed_uuids.txt @@ -1 +1,8 @@ -BB07B6F1 +1550B67E +486BD166 +322F1E14 +CBF947C1 +140C1392 +BFF7CB93 +BA5EB9FF +B7C96AF7 From 506c745ab67157272d88250f6dddf7d1c2c94ff4 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 07:19:19 -0500 Subject: [PATCH 13/20] fix: handle bc%dir% key format in remove_higher_dimensional_keys PR #1432 renamed bc_x%beg -> bc%x%beg. The remove_higher_dimensional_keys helper only matched the old _y/_z separator style (.+_y, y_.+), so bc%y%beg and bc%z%beg were not removed for lower-dimensional cases. Add %{dim}% substring check to cover the new compound key format. --- toolchain/mfc/case_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/mfc/case_utils.py b/toolchain/mfc/case_utils.py index 3bcd9ef5e2..01fcc4bca9 100644 --- a/toolchain/mfc/case_utils.py +++ b/toolchain/mfc/case_utils.py @@ -11,7 +11,7 @@ def remove_higher_dimensional_keys(case: dict, ndims: int) -> dict: rm_keys = set() for key in case.keys(): for dim in rm_dims: - if any([re.match(f".+_{dim}", key), re.match(f"{dim}_.+", key), re.match(f"%{dim}", key), f"%vel({dim_ids[dim]})" in key]): + if any([re.match(f".+_{dim}", key), re.match(f"{dim}_.+", key), re.match(f"%{dim}", key), f"%vel({dim_ids[dim]})" in key, f"%{dim}%" in key]): rm_keys.add(key) break From e9fed5669d9ce4cbab1fd3cf207f2f0b4dc2f100 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 14:45:56 -0500 Subject: [PATCH 14/20] refactor: introduce bc_side_t type with beg_side/end_side, replace flat _in/_out fields --- examples/2D_Thermal_Flatplate/case.py | 4 +- examples/2D_acoustic_pulse/case.py | 16 +- examples/2D_acoustic_pulse_analytical/case.py | 16 +- examples/2D_ibm_steady_shock/case.py | 26 +-- examples/2D_lid_driven_cavity/case.py | 2 +- examples/2D_patch_modal_shape/case.py | 16 +- examples/2D_patch_modal_shape_exp/case.py | 16 +- examples/2D_zero_circ_vortex/case.py | 26 +-- .../2D_zero_circ_vortex_analytical/case.py | 26 +-- examples/3D_patch_spherical_harmonic/case.py | 24 +-- src/common/m_boundary_common.fpp | 96 +++++----- src/common/m_derived_types.fpp | 21 ++- src/post_process/m_global_parameters.fpp | 12 +- src/post_process/m_mpi_proxy.fpp | 8 +- src/pre_process/m_global_parameters.fpp | 12 +- src/pre_process/m_mpi_proxy.fpp | 10 +- src/simulation/m_cbc.fpp | 26 +-- src/simulation/m_global_parameters.fpp | 23 +-- src/simulation/m_mpi_proxy.fpp | 33 ++-- src/simulation/m_start_up.fpp | 25 +-- toolchain/mfc/case_validator.py | 36 ++-- toolchain/mfc/params/definitions.py | 71 +++----- toolchain/mfc/params/descriptions.py | 30 ++-- toolchain/mfc/params/generators/docs_gen.py | 2 +- toolchain/mfc/params_cmd.py | 2 +- toolchain/mfc/test/cases.py | 168 +++++++++--------- 26 files changed, 366 insertions(+), 381 deletions(-) diff --git a/examples/2D_Thermal_Flatplate/case.py b/examples/2D_Thermal_Flatplate/case.py index 438f1f022e..f6123eccdd 100644 --- a/examples/2D_Thermal_Flatplate/case.py +++ b/examples/2D_Thermal_Flatplate/case.py @@ -41,8 +41,8 @@ "bc%x%end": -3, "bc%y%beg": -16, "bc%y%end": -3, - "bc%y%isothermal_in": "T", - "bc%y%Twall_in": 600.0, + "bc%y%beg_side%isothermal": "T", + "bc%y%beg_side%T_wall": 600.0, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/examples/2D_acoustic_pulse/case.py b/examples/2D_acoustic_pulse/case.py index 1c497502a0..7088ac600b 100644 --- a/examples/2D_acoustic_pulse/case.py +++ b/examples/2D_acoustic_pulse/case.py @@ -87,14 +87,14 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc%x%grcbc_in": "F", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "F", - "bc%x%pres_out": p_inf, - "bc%y%grcbc_in": "F", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "F", - "bc%y%pres_out": p_inf, + "bc%x%beg_side%grcbc": "F", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%end_side%pres": p_inf, + "bc%y%beg_side%grcbc": "F", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "F", + "bc%y%end_side%pres": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_acoustic_pulse_analytical/case.py b/examples/2D_acoustic_pulse_analytical/case.py index a07f46f45e..033905627a 100644 --- a/examples/2D_acoustic_pulse_analytical/case.py +++ b/examples/2D_acoustic_pulse_analytical/case.py @@ -86,14 +86,14 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc%x%grcbc_in": "F", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "F", - "bc%x%pres_out": p_inf, - "bc%y%grcbc_in": "F", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "F", - "bc%y%pres_out": p_inf, + "bc%x%beg_side%grcbc": "F", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%end_side%pres": p_inf, + "bc%y%beg_side%grcbc": "F", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "F", + "bc%y%end_side%pres": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_ibm_steady_shock/case.py b/examples/2D_ibm_steady_shock/case.py index a09cddc90f..73aea61f4e 100644 --- a/examples/2D_ibm_steady_shock/case.py +++ b/examples/2D_ibm_steady_shock/case.py @@ -128,19 +128,19 @@ "patch_icpp(2)%v0": 0.0e00, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "F", - "bc%x%grcbc_vel_out": "F", - "bc%x%vel_in(1)": vel, - "bc%x%vel_in(2)": 0, - "bc%x%vel_in(3)": 0, - "bc%x%pres_in": delta * patm, - "bc%x%alpha_rho_in(1)": beta * rhoatm, - "bc%x%alpha_in(1)": 1, - "bc%x%vel_out(1)": vel, - "bc%x%vel_out(2)": 0, - "bc%x%vel_out(3)": 0, - "bc%x%pres_out": 1.0, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "F", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%beg_side%vel(1)": vel, + "bc%x%beg_side%vel(2)": 0, + "bc%x%beg_side%vel(3)": 0, + "bc%x%beg_side%pres": delta * patm, + "bc%x%beg_side%alpha_rho(1)": beta * rhoatm, + "bc%x%beg_side%alpha(1)": 1, + "bc%x%end_side%vel(1)": vel, + "bc%x%end_side%vel(2)": 0, + "bc%x%end_side%vel(3)": 0, + "bc%x%end_side%pres": 1.0, # Patch: Cylinder Immersed Boundary "patch_ib(1)%geometry": 4, "patch_ib(1)%x_centroid": 1.5e-03 / x0, diff --git a/examples/2D_lid_driven_cavity/case.py b/examples/2D_lid_driven_cavity/case.py index 1548f68f9b..77881aae58 100644 --- a/examples/2D_lid_driven_cavity/case.py +++ b/examples/2D_lid_driven_cavity/case.py @@ -41,7 +41,7 @@ "bc%x%end": -16, "bc%y%beg": -16, "bc%y%end": -16, - "bc%y%ve1": 0.5, + "bc%y%end_side%vel_wall(1)": 0.5, "viscous": "T", # Formatted Database Files Structure Parameters "format": 1, diff --git a/examples/2D_patch_modal_shape/case.py b/examples/2D_patch_modal_shape/case.py index a82b5b2387..98dd70ae57 100644 --- a/examples/2D_patch_modal_shape/case.py +++ b/examples/2D_patch_modal_shape/case.py @@ -96,14 +96,14 @@ "patch_icpp(2)%alpha(1)": 0.0, "patch_icpp(2)%alpha(2)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", - "bc%x%grcbc_in": "F", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "F", - "bc%x%pres_out": p_inf, - "bc%y%grcbc_in": "F", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "F", - "bc%y%pres_out": p_inf, + "bc%x%beg_side%grcbc": "F", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%end_side%pres": p_inf, + "bc%y%beg_side%grcbc": "F", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "F", + "bc%y%end_side%pres": p_inf, "fluid_pp(1)%gamma": 1.0 / (gam - 1.0), "fluid_pp(1)%pi_inf": 0.0, "fluid_pp(2)%gamma": 1.0 / (gam - 1.0), diff --git a/examples/2D_patch_modal_shape_exp/case.py b/examples/2D_patch_modal_shape_exp/case.py index 310b2fe9e1..f761979356 100644 --- a/examples/2D_patch_modal_shape_exp/case.py +++ b/examples/2D_patch_modal_shape_exp/case.py @@ -98,14 +98,14 @@ "patch_icpp(2)%alpha(1)": 0.0, "patch_icpp(2)%alpha(2)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", - "bc%x%grcbc_in": "F", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "F", - "bc%x%pres_out": p_inf, - "bc%y%grcbc_in": "F", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "F", - "bc%y%pres_out": p_inf, + "bc%x%beg_side%grcbc": "F", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%end_side%pres": p_inf, + "bc%y%beg_side%grcbc": "F", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "F", + "bc%y%end_side%pres": p_inf, "fluid_pp(1)%gamma": 1.0 / (gam - 1.0), "fluid_pp(1)%pi_inf": 0.0, "fluid_pp(2)%gamma": 1.0 / (gam - 1.0), diff --git a/examples/2D_zero_circ_vortex/case.py b/examples/2D_zero_circ_vortex/case.py index 1fef44faa5..f75e988e63 100644 --- a/examples/2D_zero_circ_vortex/case.py +++ b/examples/2D_zero_circ_vortex/case.py @@ -87,19 +87,19 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "T", - "bc%x%vel_in(1)": u_inf, - "bc%x%vel_in(2)": 0, - "bc%x%vel_in(3)": 0, - "bc%x%pres_in": p_inf, - "bc%x%alpha_rho_in(1)": rho_inf, - "bc%x%alpha_in(1)": 1, - "bc%x%vel_out(1)": u_inf, - "bc%x%vel_out(2)": 0, - "bc%x%vel_out(3)": 0, - "bc%x%pres_out": p_inf, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "T", + "bc%x%beg_side%vel(1)": u_inf, + "bc%x%beg_side%vel(2)": 0, + "bc%x%beg_side%vel(3)": 0, + "bc%x%beg_side%pres": p_inf, + "bc%x%beg_side%alpha_rho(1)": rho_inf, + "bc%x%beg_side%alpha(1)": 1, + "bc%x%end_side%vel(1)": u_inf, + "bc%x%end_side%vel(2)": 0, + "bc%x%end_side%vel(3)": 0, + "bc%x%end_side%pres": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/2D_zero_circ_vortex_analytical/case.py b/examples/2D_zero_circ_vortex_analytical/case.py index 23491a8742..eec553bf9b 100644 --- a/examples/2D_zero_circ_vortex_analytical/case.py +++ b/examples/2D_zero_circ_vortex_analytical/case.py @@ -88,19 +88,19 @@ "patch_icpp(2)%alpha(1)": 1.0, "patch_icpp(2)%alter_patch(1)": "T", # CBC Inflow / Outflow - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "T", - "bc%x%vel_in(1)": u_inf, - "bc%x%vel_in(2)": 0, - "bc%x%vel_in(3)": 0, - "bc%x%pres_in": p_inf, - "bc%x%alpha_rho_in(1)": rho_inf, - "bc%x%alpha_in(1)": 1, - "bc%x%vel_out(1)": u_inf, - "bc%x%vel_out(2)": 0, - "bc%x%vel_out(3)": 0, - "bc%x%pres_out": p_inf, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "T", + "bc%x%beg_side%vel(1)": u_inf, + "bc%x%beg_side%vel(2)": 0, + "bc%x%beg_side%vel(3)": 0, + "bc%x%beg_side%pres": p_inf, + "bc%x%beg_side%alpha_rho(1)": rho_inf, + "bc%x%beg_side%alpha(1)": 1, + "bc%x%end_side%vel(1)": u_inf, + "bc%x%end_side%vel(2)": 0, + "bc%x%end_side%vel(3)": 0, + "bc%x%end_side%pres": p_inf, # Fluids Physical Parameters "fluid_pp(1)%gamma": 1.0e00 / (gam - 1.0e00), "fluid_pp(1)%pi_inf": 0.0, diff --git a/examples/3D_patch_spherical_harmonic/case.py b/examples/3D_patch_spherical_harmonic/case.py index 2348830545..150a576ee9 100644 --- a/examples/3D_patch_spherical_harmonic/case.py +++ b/examples/3D_patch_spherical_harmonic/case.py @@ -64,18 +64,18 @@ "bc%y%end": -8, "bc%z%beg": -8, "bc%z%end": -8, - "bc%x%grcbc_in": "F", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "F", - "bc%x%pres_out": p_inf, - "bc%y%grcbc_in": "F", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "F", - "bc%y%pres_out": p_inf, - "bc%z%grcbc_in": "F", - "bc%z%grcbc_out": "T", - "bc%z%grcbc_vel_out": "F", - "bc%z%pres_out": p_inf, + "bc%x%beg_side%grcbc": "F", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "F", + "bc%x%end_side%pres": p_inf, + "bc%y%beg_side%grcbc": "F", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "F", + "bc%y%end_side%pres": p_inf, + "bc%z%beg_side%grcbc": "F", + "bc%z%end_side%grcbc": "T", + "bc%z%end_side%grcbc_vel": "F", + "bc%z%end_side%pres": p_inf, "format": 1, "precision": 2, "prim_vars_wrt": "T", diff --git a/src/common/m_boundary_common.fpp b/src/common/m_boundary_common.fpp index f5e2a415bf..7f5578c542 100644 --- a/src/common/m_boundary_common.fpp +++ b/src/common/m_boundary_common.fpp @@ -844,7 +844,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb1 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%beg_side%vel_wall(1) else q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(0, k, l) end if @@ -852,9 +852,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%x%isothermal_in) then + if (bc%x%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(-j, k, l) = 2._wp*bc%x%Twall_in - q_T_sf%sf(j - 1, k, l) + q_T_sf%sf(-j, k, l) = 2._wp*bc%x%beg_side%T_wall - q_T_sf%sf(j - 1, k, l) end do else do j = 1, buff_size @@ -866,7 +866,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve1 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%end_side%vel_wall(1) else q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m, k, l) end if @@ -874,9 +874,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%x%isothermal_out) then + if (bc%x%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) + q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%end_side%T_wall - q_T_sf%sf(m - (j - 1), k, l) end do else do j = 1, buff_size @@ -890,7 +890,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg + 1) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb2 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%beg_side%vel_wall(2) else q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, 0, l) end if @@ -898,9 +898,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%y%isothermal_in) then + if (bc%y%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, -j, l) = 2._wp*bc%y%Twall_in - q_T_sf%sf(k, j - 1, l) + q_T_sf%sf(k, -j, l) = 2._wp*bc%y%beg_side%T_wall - q_T_sf%sf(k, j - 1, l) end do else do j = 1, buff_size @@ -912,7 +912,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg + 1) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve2 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%end_side%vel_wall(2) else q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n, l) end if @@ -920,9 +920,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%y%isothermal_out) then + if (bc%y%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) + q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%end_side%T_wall - q_T_sf%sf(k, n - (j - 1), l) end do else do j = 1, buff_size @@ -936,7 +936,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%end) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb3 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%beg_side%vel_wall(3) else q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, 0) end if @@ -944,9 +944,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%z%isothermal_in) then + if (bc%z%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, l, -j) = 2._wp*bc%z%Twall_in - q_T_sf%sf(k, l, j - 1) + q_T_sf%sf(k, l, -j) = 2._wp*bc%z%beg_side%T_wall - q_T_sf%sf(k, l, j - 1) end do else do j = 1, buff_size @@ -958,7 +958,7 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%end) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve3 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%end_side%vel_wall(3) else q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p) end if @@ -966,9 +966,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%z%isothermal_out) then + if (bc%z%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) + q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%end_side%T_wall - q_T_sf%sf(k, l, p - (j - 1)) end do else do j = 1, buff_size @@ -997,11 +997,11 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb1 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%beg_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb2 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%beg_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%vb3 + q_prim_vf(i)%sf(-j, k, l) = -q_prim_vf(i)%sf(j - 1, k, l) + 2._wp*bc%x%beg_side%vel_wall(3) else q_prim_vf(i)%sf(-j, k, l) = q_prim_vf(i)%sf(0, k, l) end if @@ -1009,9 +1009,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%x%isothermal_in) then + if (bc%x%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(-j, k, l) = 2._wp*bc%x%Twall_in - q_T_sf%sf(j - 1, k, l) + q_T_sf%sf(-j, k, l) = 2._wp*bc%x%beg_side%T_wall - q_T_sf%sf(j - 1, k, l) end do else do j = 1, buff_size @@ -1023,11 +1023,11 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve1 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%end_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve2 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%end_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%ve3 + q_prim_vf(i)%sf(m + j, k, l) = -q_prim_vf(i)%sf(m - (j - 1), k, l) + 2._wp*bc%x%end_side%vel_wall(3) else q_prim_vf(i)%sf(m + j, k, l) = q_prim_vf(i)%sf(m, k, l) end if @@ -1035,9 +1035,9 @@ contains end do if (chemistry .and. present(q_T_sf)) then - if (bc%x%isothermal_out) then + if (bc%x%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%Twall_out - q_T_sf%sf(m - (j - 1), k, l) + q_T_sf%sf(m + j, k, l) = 2._wp*bc%x%end_side%T_wall - q_T_sf%sf(m - (j - 1), k, l) end do else do j = 1, buff_size @@ -1051,20 +1051,20 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb1 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%beg_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb2 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%beg_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%vb3 + q_prim_vf(i)%sf(k, -j, l) = -q_prim_vf(i)%sf(k, j - 1, l) + 2._wp*bc%y%beg_side%vel_wall(3) else q_prim_vf(i)%sf(k, -j, l) = q_prim_vf(i)%sf(k, 0, l) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc%y%isothermal_in) then + if (bc%y%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, -j, l) = 2._wp*bc%y%Twall_in - q_T_sf%sf(k, j - 1, l) + q_T_sf%sf(k, -j, l) = 2._wp*bc%y%beg_side%T_wall - q_T_sf%sf(k, j - 1, l) end do else do j = 1, buff_size @@ -1076,20 +1076,20 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve1 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%end_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve2 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%end_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%ve3 + q_prim_vf(i)%sf(k, n + j, l) = -q_prim_vf(i)%sf(k, n - (j - 1), l) + 2._wp*bc%y%end_side%vel_wall(3) else q_prim_vf(i)%sf(k, n + j, l) = q_prim_vf(i)%sf(k, n, l) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc%y%isothermal_out) then + if (bc%y%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%Twall_out - q_T_sf%sf(k, n - (j - 1), l) + q_T_sf%sf(k, n + j, l) = 2._wp*bc%y%end_side%T_wall - q_T_sf%sf(k, n - (j - 1), l) end do else do j = 1, buff_size @@ -1103,20 +1103,20 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb1 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%beg_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb2 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%beg_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%vb3 + q_prim_vf(i)%sf(k, l, -j) = -q_prim_vf(i)%sf(k, l, j - 1) + 2._wp*bc%z%beg_side%vel_wall(3) else q_prim_vf(i)%sf(k, l, -j) = q_prim_vf(i)%sf(k, l, 0) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc%z%isothermal_in) then + if (bc%z%beg_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, l, -j) = 2._wp*bc%z%Twall_in - q_T_sf%sf(k, l, j - 1) + q_T_sf%sf(k, l, -j) = 2._wp*bc%z%beg_side%T_wall - q_T_sf%sf(k, l, j - 1) end do else do j = 1, buff_size @@ -1128,20 +1128,20 @@ contains do i = 1, sys_size do j = 1, buff_size if (i == eqn_idx%mom%beg) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve1 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%end_side%vel_wall(1) else if (i == eqn_idx%mom%beg + 1 .and. num_dims > 1) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve2 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%end_side%vel_wall(2) else if (i == eqn_idx%mom%beg + 2 .and. num_dims > 2) then - q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%ve3 + q_prim_vf(i)%sf(k, l, p + j) = -q_prim_vf(i)%sf(k, l, p - (j - 1)) + 2._wp*bc%z%end_side%vel_wall(3) else q_prim_vf(i)%sf(k, l, p + j) = q_prim_vf(i)%sf(k, l, p) end if end do end do if (chemistry .and. present(q_T_sf)) then - if (bc%z%isothermal_out) then + if (bc%z%end_side%isothermal) then do j = 1, buff_size - q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%Twall_out - q_T_sf%sf(k, l, p - (j - 1)) + q_T_sf%sf(k, l, p + j) = 2._wp*bc%z%end_side%T_wall - q_T_sf%sf(k, l, p - (j - 1)) end do else do j = 1, buff_size diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 54136ee85a..4d975ccd15 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -110,17 +110,20 @@ module m_derived_types integer :: end end type int_bounds_info + !> Boundary condition data for one face (beg or end) of a coordinate direction. + type bc_side_t + real(wp) :: pres + real(wp), dimension(3) :: vel + real(wp), dimension(3) :: vel_wall + real(wp), dimension(num_fluids_max) :: alpha_rho, alpha + real(wp) :: T_wall + logical :: grcbc, grcbc_vel, isothermal + end type bc_side_t + !> Boundary condition parameters for one coordinate direction (beg/end faces + face data). type bc_dir_t - integer :: beg, end - real(wp) :: vb1, vb2, vb3 - real(wp) :: ve1, ve2, ve3 - real(wp) :: pres_in, pres_out - real(wp), dimension(3) :: vel_in, vel_out - real(wp), dimension(num_fluids_max) :: alpha_rho_in, alpha_in - logical :: grcbc_in, grcbc_out, grcbc_vel_out - logical :: isothermal_in, isothermal_out - real(wp) :: Twall_in, Twall_out + integer :: beg, end + type(bc_side_t) :: beg_side, end_side end type bc_dir_t !> Groups the x, y, z boundary condition structs for passing as a single argument. diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 076da5b8c4..13cc883347 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -321,16 +321,16 @@ contains #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc%${DIM}$%vb${DIR}$ = 0._wp - bc%${DIM}$%ve${DIR}$ = 0._wp + bc%${DIM}$%beg_side%vel_wall(${DIR}$) = 0._wp + bc%${DIM}$%end_side%vel_wall(${DIR}$) = 0._wp #:endfor #:endfor #:for dir in {'x', 'y', 'z'} - bc%${dir}$%isothermal_in = .false. - bc%${dir}$%isothermal_out = .false. - bc%${dir}$%Twall_in = dflt_real - bc%${dir}$%Twall_out = dflt_real + bc%${dir}$%beg_side%isothermal = .false. + bc%${dir}$%end_side%isothermal = .false. + bc%${dir}$%beg_side%T_wall = dflt_real + bc%${dir}$%end_side%T_wall = dflt_real #:endfor chem_params%gamma_method = 1 diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index efb6bb3daf..681ff7acc2 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -84,8 +84,8 @@ contains & 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt','chem_wrt_T', & & 'bubbles_euler', 'qbmm', 'polytropic', 'polydisperse', & & 'file_per_process', 'relax', 'cf_wrt', 'igr', 'liutex_wrt', & - & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & - & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out',& + & 'bc%x%beg_side%isothermal', 'bc%y%beg_side%isothermal', 'bc%z%beg_side%isothermal', & + & 'bc%x%end_side%isothermal', 'bc%y%end_side%isothermal', 'bc%z%end_side%isothermal',& & 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', & & 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', & & 'output_partial_domain', 'relativity', 'cont_damage', 'bc_io', & @@ -133,8 +133,8 @@ contains & 'Re_inv', 'Bx0', 'sigma', 't_save', 't_stop', & & 'x_output%beg', 'x_output%end', 'y_output%beg', & & 'y_output%end', 'z_output%beg', 'z_output%end', & - & 'bc%x%Twall_in', 'bc%x%Twall_out', 'bc%y%Twall_in',& - & 'bc%y%Twall_out','bc%z%Twall_in', 'bc%z%Twall_out' ] + & 'bc%x%beg_side%T_wall', 'bc%x%end_side%T_wall', 'bc%y%beg_side%T_wall',& + & 'bc%y%end_side%T_wall','bc%z%beg_side%T_wall', 'bc%z%end_side%T_wall' ] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(schlieren_alpha(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr) diff --git a/src/pre_process/m_global_parameters.fpp b/src/pre_process/m_global_parameters.fpp index b3dbd03a91..b4ce1b8952 100644 --- a/src/pre_process/m_global_parameters.fpp +++ b/src/pre_process/m_global_parameters.fpp @@ -265,16 +265,16 @@ contains #:for DIM in ['x', 'y', 'z'] #:for DIR in [1, 2, 3] - bc%${DIM}$%vb${DIR}$ = 0._wp - bc%${DIM}$%ve${DIR}$ = 0._wp + bc%${DIM}$%beg_side%vel_wall(${DIR}$) = 0._wp + bc%${DIM}$%end_side%vel_wall(${DIR}$) = 0._wp #:endfor #:endfor #:for dir in {'x', 'y', 'z'} - bc%${dir}$%isothermal_in = .false. - bc%${dir}$%isothermal_out = .false. - bc%${dir}$%Twall_in = dflt_real - bc%${dir}$%Twall_out = dflt_real + bc%${dir}$%beg_side%isothermal = .false. + bc%${dir}$%end_side%isothermal = .false. + bc%${dir}$%beg_side%T_wall = dflt_real + bc%${dir}$%end_side%T_wall = dflt_real #:endfor parallel_io = .false. diff --git a/src/pre_process/m_mpi_proxy.fpp b/src/pre_process/m_mpi_proxy.fpp index 434b549d52..570d4b3eb9 100644 --- a/src/pre_process/m_mpi_proxy.fpp +++ b/src/pre_process/m_mpi_proxy.fpp @@ -43,8 +43,8 @@ contains & 'mixlayer_perturb', 'bubbles_euler', 'polytropic', 'polydisperse', & & 'qbmm', 'file_per_process', 'adv_n', 'ib' , 'cfl_adap_dt', & & 'cfl_const_dt', 'cfl_dt', 'surface_tension', & - & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & - & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out',& + & 'bc%x%beg_side%isothermal', 'bc%y%beg_side%isothermal', 'bc%z%beg_side%isothermal', & + & 'bc%x%end_side%isothermal', 'bc%y%end_side%isothermal', 'bc%z%end_side%isothermal',& & 'hyperelasticity', 'pre_stress', 'elliptic_smoothing', 'viscous', & & 'bubbles_lagrange', 'bc_io', 'mhd', 'relativity', 'cont_damage', & & 'igr', 'down_sample', 'simplex_perturb','fft_wrt', 'hyper_cleaning' ] @@ -60,9 +60,9 @@ contains & 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', & & 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV', 'palpha_eps', & & 'ptgalpha_eps', 'sigma', 'pi_fac', 'mixlayer_vel_coef', 'Bx0', & - & 'mixlayer_perturb_k0', 'bc%x%Twall_in', 'bc%x%Twall_out', & - & 'bc%y%Twall_in', 'bc%y%Twall_out', 'bc%z%Twall_in', & - & 'bc%z%Twall_out'] + & 'mixlayer_perturb_k0', 'bc%x%beg_side%T_wall', 'bc%x%end_side%T_wall', & + & 'bc%y%beg_side%T_wall', 'bc%y%end_side%T_wall', 'bc%z%beg_side%T_wall', & + & 'bc%z%end_side%T_wall'] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor diff --git a/src/simulation/m_cbc.fpp b/src/simulation/m_cbc.fpp index 01bf6d56a2..81dbd26bec 100644 --- a/src/simulation/m_cbc.fpp +++ b/src/simulation/m_cbc.fpp @@ -302,23 +302,23 @@ contains ! Assign and update GRCBC inputs #:for CBC_DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] if (${CBC_DIR}$ <= num_dims) then - vel_in(${CBC_DIR}$, 1) = bc%${XYZ}$%vel_in(1) - vel_out(${CBC_DIR}$, 1) = bc%${XYZ}$%vel_out(1) + vel_in(${CBC_DIR}$, 1) = bc%${XYZ}$%beg_side%vel(1) + vel_out(${CBC_DIR}$, 1) = bc%${XYZ}$%end_side%vel(1) if (n > 0) then - vel_in(${CBC_DIR}$, 2) = bc%${XYZ}$%vel_in(2) - vel_out(${CBC_DIR}$, 2) = bc%${XYZ}$%vel_out(2) + vel_in(${CBC_DIR}$, 2) = bc%${XYZ}$%beg_side%vel(2) + vel_out(${CBC_DIR}$, 2) = bc%${XYZ}$%end_side%vel(2) if (p > 0) then - vel_in(${CBC_DIR}$, 3) = bc%${XYZ}$%vel_in(3) - vel_out(${CBC_DIR}$, 3) = bc%${XYZ}$%vel_out(3) + vel_in(${CBC_DIR}$, 3) = bc%${XYZ}$%beg_side%vel(3) + vel_out(${CBC_DIR}$, 3) = bc%${XYZ}$%end_side%vel(3) end if end if Del_in(${CBC_DIR}$) = maxval(${XYZ}$%spacing) Del_out(${CBC_DIR}$) = maxval(${XYZ}$%spacing) - pres_in(${CBC_DIR}$) = bc%${XYZ}$%pres_in - pres_out(${CBC_DIR}$) = bc%${XYZ}$%pres_out + pres_in(${CBC_DIR}$) = bc%${XYZ}$%beg_side%pres + pres_out(${CBC_DIR}$) = bc%${XYZ}$%end_side%pres do i = 1, num_fluids - alpha_rho_in(i, ${CBC_DIR}$) = bc%${XYZ}$%alpha_rho_in(i) - alpha_in(i, ${CBC_DIR}$) = bc%${XYZ}$%alpha_in(i) + alpha_rho_in(i, ${CBC_DIR}$) = bc%${XYZ}$%beg_side%alpha_rho(i) + alpha_in(i, ${CBC_DIR}$) = bc%${XYZ}$%beg_side%alpha(i) end do end if #:endfor @@ -736,7 +736,7 @@ contains & .and. bc%${XYZ}$%end == BC_CHAR_NR_SUB_INFLOW)) then call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, dpres_ds, dvel_ds) ! Add GRCBC for Subsonic Inflow - if (bc%${XYZ}$%grcbc_in) then + if (bc%${XYZ}$%beg_side%grcbc) then $:GPU_LOOP(parallelism='[seq]') do i = 2, eqn_idx%mom%beg L(i) = c**3._wp*Ma*(alpha_rho(i - 1) - alpha_rho_in(i - 1, & @@ -764,11 +764,11 @@ contains call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, & & dvel_ds, dadv_ds, dYs_ds) ! Add GRCBC for Subsonic Outflow (Pressure) - if (bc%${XYZ}$%grcbc_out) then + if (bc%${XYZ}$%end_side%grcbc) then L(eqn_idx%adv%end) = c*(1._wp - Ma)*(pres - pres_out(${CBC_DIR}$))/Del_out(${CBC_DIR}$) ! Add GRCBC for Subsonic Outflow (Normal Velocity) - if (bc%${XYZ}$%grcbc_vel_out) then + if (bc%${XYZ}$%end_side%grcbc_vel) then L(eqn_idx%adv%end) = L(eqn_idx%adv%end) + rho*c**2._wp*(1._wp - Ma)*(vel(dir_idx(1)) & & + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$) end if diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 76f416fa38..8b00b8ac04 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -210,9 +210,6 @@ module m_global_parameters type(bc_dir_t) :: ib_bc_x, ib_bc_y, ib_bc_z !> @} #if defined(MFC_OpenACC) - $:GPU_DECLARE(create='[bc%x%vb1, bc%x%vb2, bc%x%vb3, bc%x%ve1, bc%x%ve2, bc%x%ve3]') - $:GPU_DECLARE(create='[bc%y%vb1, bc%y%vb2, bc%y%vb3, bc%y%ve1, bc%y%ve2, bc%y%ve3]') - $:GPU_DECLARE(create='[bc%z%vb1, bc%z%vb2, bc%z%vb3, bc%z%ve1, bc%z%ve2, bc%z%ve3]') $:GPU_DECLARE(create='[ib_bc_x%beg, ib_bc_y%beg, ib_bc_z%beg]') #elif defined(MFC_OpenMP) $:GPU_DECLARE(create='[bc]') @@ -573,10 +570,8 @@ contains bc%z%beg = dflt_int; bc%z%end = dflt_int #:for DIM in ['x', 'y', 'z'] - #:for DIR in [1, 2, 3] - bc%${DIM}$%vb${DIR}$ = 0._wp - bc%${DIM}$%ve${DIR}$ = 0._wp - #:endfor + bc%${DIM}$%beg_side%vel_wall = 0._wp + bc%${DIM}$%end_side%vel_wall = 0._wp #:endfor x_domain%beg = dflt_real; x_domain%end = dflt_real @@ -730,16 +725,16 @@ contains ! GRCBC flags #:for dir in {'x', 'y', 'z'} - bc%${dir}$%grcbc_in = .false. - bc%${dir}$%grcbc_out = .false. - bc%${dir}$%grcbc_vel_out = .false. + bc%${dir}$%beg_side%grcbc = .false. + bc%${dir}$%end_side%grcbc = .false. + bc%${dir}$%end_side%grcbc_vel = .false. #:endfor #:for dir in {'x', 'y', 'z'} - bc%${dir}$%isothermal_in = .false. - bc%${dir}$%isothermal_out = .false. - bc%${dir}$%Twall_in = dflt_real - bc%${dir}$%Twall_out = dflt_real + bc%${dir}$%beg_side%isothermal = .false. + bc%${dir}$%end_side%isothermal = .false. + bc%${dir}$%beg_side%T_wall = dflt_real + bc%${dir}$%end_side%T_wall = dflt_real #:endfor ! Lagrangian subgrid bubble model diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index d09a5397c5..352b837288 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -88,11 +88,11 @@ contains & 'polydisperse', 'qbmm', 'acoustic_source', 'probe_wrt', 'integral_wrt', & & 'prim_vars_wrt', 'weno_avg', 'file_per_process', 'relax', & & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf_x%enabled', 'bf_y%enabled', 'bf_z%enabled', & - & 'bc%x%grcbc_in', 'bc%x%grcbc_out', 'bc%x%grcbc_vel_out', & - & 'bc%y%grcbc_in', 'bc%y%grcbc_out', 'bc%y%grcbc_vel_out', & - & 'bc%z%grcbc_in', 'bc%z%grcbc_out', 'bc%z%grcbc_vel_out', & - & 'bc%x%isothermal_in', 'bc%y%isothermal_in', 'bc%z%isothermal_in', & - & 'bc%x%isothermal_out', 'bc%y%isothermal_out', 'bc%z%isothermal_out', & + & 'bc%x%beg_side%grcbc', 'bc%x%end_side%grcbc', 'bc%x%end_side%grcbc_vel', & + & 'bc%y%beg_side%grcbc', 'bc%y%end_side%grcbc', 'bc%y%end_side%grcbc_vel', & + & 'bc%z%beg_side%grcbc', 'bc%z%end_side%grcbc', 'bc%z%end_side%grcbc_vel', & + & 'bc%x%beg_side%isothermal', 'bc%y%beg_side%isothermal', 'bc%z%beg_side%isothermal', & + & 'bc%x%end_side%isothermal', 'bc%y%end_side%isothermal', 'bc%z%end_side%isothermal', & & 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', 'surface_tension', & & 'shear_stress', 'bulk_stress', 'bubbles_lagrange', & & 'hyperelasticity', 'down_sample', 'fft_wrt', & @@ -127,15 +127,18 @@ contains #:for VAR in [ 'dt','weno_eps','teno_CT','pref','rhoref','R0ref','Web','Ca', 'sigma', & & 'Re_inv', 'poly_sigma', 'palpha_eps', 'ptgalpha_eps', 'pi_fac', & - & 'bc%x%vb1','bc%x%vb2','bc%x%vb3','bc%x%ve1','bc%x%ve2','bc%x%ve3', & - & 'bc%y%vb1','bc%y%vb2','bc%y%vb3','bc%y%ve1','bc%y%ve2','bc%y%ve3', & - & 'bc%z%vb1','bc%z%vb2','bc%z%vb3','bc%z%ve1','bc%z%ve2','bc%z%ve3', & - & 'bc%x%pres_in','bc%x%pres_out','bc%y%pres_in','bc%y%pres_out', 'bc%z%pres_in','bc%z%pres_out', & + & 'bc%x%beg_side%vel_wall(1)', 'bc%x%beg_side%vel_wall(2)', 'bc%x%beg_side%vel_wall(3)', & + & 'bc%x%end_side%vel_wall(1)', 'bc%x%end_side%vel_wall(2)', 'bc%x%end_side%vel_wall(3)', & + & 'bc%y%beg_side%vel_wall(1)', 'bc%y%beg_side%vel_wall(2)', 'bc%y%beg_side%vel_wall(3)', & + & 'bc%y%end_side%vel_wall(1)', 'bc%y%end_side%vel_wall(2)', 'bc%y%end_side%vel_wall(3)', & + & 'bc%z%beg_side%vel_wall(1)', 'bc%z%beg_side%vel_wall(2)', 'bc%z%beg_side%vel_wall(3)', & + & 'bc%z%end_side%vel_wall(1)', 'bc%z%end_side%vel_wall(2)', 'bc%z%end_side%vel_wall(3)', & + & 'bc%x%beg_side%pres','bc%x%end_side%pres','bc%y%beg_side%pres','bc%y%end_side%pres', 'bc%z%beg_side%pres','bc%z%end_side%pres', & & 'x_domain%beg', 'x_domain%end', 'y_domain%beg', 'y_domain%end', & & 'z_domain%beg', 'z_domain%end', 'x_stretch%beg', 'x_stretch%end', & & 'y_stretch%beg', 'y_stretch%end', 'z_stretch%beg', 'z_stretch%end', & - & 'bc%x%Twall_in', 'bc%x%Twall_out', 'bc%y%Twall_in', 'bc%y%Twall_out', & - & 'bc%z%Twall_in', 'bc%z%Twall_out', & + & 'bc%x%beg_side%T_wall', 'bc%x%end_side%T_wall', 'bc%y%beg_side%T_wall', 'bc%y%end_side%T_wall', & + & 'bc%z%beg_side%T_wall', 'bc%z%end_side%T_wall', & & 't_stop', 't_save', 'cfl_target', 'Bx0', 'alf_factor', & & 'tau_star', 'cont_damage_s', 'alpha_bar', 'adap_dt_tol', & & 'ic_eps', 'ic_beta', 'hyper_cleaning_speed', & @@ -145,8 +148,8 @@ contains #:endfor do i = 1, 3 - #:for VAR in [ 'bc%x%vel_in', 'bc%x%vel_out', 'bc%y%vel_in', 'bc%y%vel_out', & - & 'bc%z%vel_in', 'bc%z%vel_out' ] + #:for VAR in [ 'bc%x%beg_side%vel', 'bc%x%end_side%vel', 'bc%y%beg_side%vel', 'bc%y%end_side%vel', & + & 'bc%z%beg_side%vel', 'bc%z%end_side%vel' ] call MPI_BCAST(${VAR}$ (i), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do @@ -187,8 +190,8 @@ contains end if do i = 1, num_fluids_max - #:for VAR in ['bc%x%alpha_rho_in','bc%x%alpha_in','bc%y%alpha_rho_in','bc%y%alpha_in','bc%z%alpha_rho_in', & - & 'bc%z%alpha_in'] + #:for VAR in ['bc%x%beg_side%alpha_rho','bc%x%beg_side%alpha','bc%y%beg_side%alpha_rho','bc%y%beg_side%alpha','bc%z%beg_side%alpha_rho', & + & 'bc%z%beg_side%alpha'] call MPI_BCAST(${VAR}$ (i), 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor end do diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 1e42433ea4..7daf13a433 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -1082,18 +1082,19 @@ contains $:GPU_UPDATE(device='[x%spacing, y%spacing, z%spacing, x%cb, x%cc, y%cb, y%cc, z%cb, z%cc]') $:GPU_UPDATE(device='[bc%x%beg, bc%x%end, bc%y%beg, bc%y%end, bc%z%beg, bc%z%end]') - $:GPU_UPDATE(device='[bc%x%vb1, bc%x%vb2, bc%x%vb3, bc%x%ve1, bc%x%ve2, bc%x%ve3]') - $:GPU_UPDATE(device='[bc%y%vb1, bc%y%vb2, bc%y%vb3, bc%y%ve1, bc%y%ve2, bc%y%ve3]') - $:GPU_UPDATE(device='[bc%z%vb1, bc%z%vb2, bc%z%vb3, bc%z%ve1, bc%z%ve2, bc%z%ve3]') - - $:GPU_UPDATE(device='[bc%x%grcbc_in, bc%x%grcbc_out, bc%x%grcbc_vel_out]') - $:GPU_UPDATE(device='[bc%y%grcbc_in, bc%y%grcbc_out, bc%y%grcbc_vel_out]') - $:GPU_UPDATE(device='[bc%z%grcbc_in, bc%z%grcbc_out, bc%z%grcbc_vel_out]') - - $:GPU_UPDATE(device='[bc%x%isothermal_in, bc%x%isothermal_out]') - $:GPU_UPDATE(device='[bc%y%isothermal_in, bc%y%isothermal_out]') - $:GPU_UPDATE(device='[bc%z%isothermal_in, bc%z%isothermal_out]') - $:GPU_UPDATE(device='[bc%x%Twall_in, bc%x%Twall_out, bc%y%Twall_in, bc%y%Twall_out, bc%z%Twall_in, bc%z%Twall_out]') + $:GPU_UPDATE(device='[bc%x%beg_side%vel_wall, bc%x%end_side%vel_wall]') + $:GPU_UPDATE(device='[bc%y%beg_side%vel_wall, bc%y%end_side%vel_wall]') + $:GPU_UPDATE(device='[bc%z%beg_side%vel_wall, bc%z%end_side%vel_wall]') + + $:GPU_UPDATE(device='[bc%x%beg_side%grcbc, bc%x%end_side%grcbc, bc%x%end_side%grcbc_vel]') + $:GPU_UPDATE(device='[bc%y%beg_side%grcbc, bc%y%end_side%grcbc, bc%y%end_side%grcbc_vel]') + $:GPU_UPDATE(device='[bc%z%beg_side%grcbc, bc%z%end_side%grcbc, bc%z%end_side%grcbc_vel]') + + $:GPU_UPDATE(device='[bc%x%beg_side%isothermal, bc%x%end_side%isothermal]') + $:GPU_UPDATE(device='[bc%y%beg_side%isothermal, bc%y%end_side%isothermal]') + $:GPU_UPDATE(device='[bc%z%beg_side%isothermal, bc%z%end_side%isothermal]') + $:GPU_UPDATE(device='[bc%x%beg_side%T_wall, bc%x%end_side%T_wall, bc%y%beg_side%T_wall, bc%y%end_side%T_wall, & + & bc%z%beg_side%T_wall, bc%z%end_side%T_wall]') $:GPU_UPDATE(device='[relax, relax_model]') if (relax) then diff --git a/toolchain/mfc/case_validator.py b/toolchain/mfc/case_validator.py index f07afd259b..6c5cd7a50b 100644 --- a/toolchain/mfc/case_validator.py +++ b/toolchain/mfc/case_validator.py @@ -1183,20 +1183,20 @@ def check_continuum_damage(self): def check_grcbc(self): """Checks Generalized Relaxation Characteristics BC (simulation)""" for dir in ["x", "y", "z"]: - grcbc_in = self.get(f"bc%{dir}%grcbc_in", "F") == "T" - grcbc_out = self.get(f"bc%{dir}%grcbc_out", "F") == "T" - grcbc_vel_out = self.get(f"bc%{dir}%grcbc_vel_out", "F") == "T" + grcbc_in = self.get(f"bc%{dir}%beg_side%grcbc", "F") == "T" + grcbc_out = self.get(f"bc%{dir}%end_side%grcbc", "F") == "T" + grcbc_vel_out = self.get(f"bc%{dir}%end_side%grcbc_vel", "F") == "T" bc_beg = self.get(f"bc%{dir}%beg") bc_end = self.get(f"bc%{dir}%end") if grcbc_in: # Check if EITHER beg OR end is set to -7 - self.prohibit(bc_beg != -7 and bc_end != -7, f"Subsonic Inflow (grcbc_in) requires bc_{dir}%beg = -7 or bc_{dir}%end = -7") + self.prohibit(bc_beg != -7 and bc_end != -7, f"Subsonic Inflow (beg_side%grcbc) requires bc_{dir}%beg = -7 or bc_{dir}%end = -7") if grcbc_out: # Check if EITHER beg OR end is set to -8 - self.prohibit(bc_beg != -8 and bc_end != -8, f"Subsonic Outflow (grcbc_out) requires bc_{dir}%beg = -8 or bc_{dir}%end = -8") + self.prohibit(bc_beg != -8 and bc_end != -8, f"Subsonic Outflow (end_side%grcbc) requires bc_{dir}%beg = -8 or bc_{dir}%end = -8") if grcbc_vel_out: - self.prohibit(bc_beg != -8 and bc_end != -8, f"Subsonic Outflow Velocity (grcbc_vel_out) requires bc_{dir}%beg = -8 or bc_{dir}%end = -8") + self.prohibit(bc_beg != -8 and bc_end != -8, f"Subsonic Outflow Velocity (end_side%grcbc_vel) requires bc_{dir}%beg = -8 or bc_{dir}%end = -8") def check_probe_integral_output(self): """Checks probe and integral output requirements (simulation)""" @@ -1350,36 +1350,36 @@ def check_chemistry(self): wall_bcs = [-15, -16] for dir in ["x", "y", "z"]: - isothermal_in = self.get(f"bc%{dir}%isothermal_in", "F") == "T" - isothermal_out = self.get(f"bc%{dir}%isothermal_out", "F") == "T" + isothermal_in = self.get(f"bc%{dir}%beg_side%isothermal", "F") == "T" + isothermal_out = self.get(f"bc%{dir}%end_side%isothermal", "F") == "T" bc_beg = self.get(f"bc%{dir}%beg") bc_end = self.get(f"bc%{dir}%end") if isothermal_in: # Prohibit isothermal boundaries if chemistry or diffusion are disabled - self.prohibit(not chemistry or not diffusion, f"Isothermal In (bc_{dir}%isothermal_in) requires both chemistry='T' and chem_params%diffusion='T' to calculate heat conduction.") + self.prohibit(not chemistry or not diffusion, f"Isothermal In (bc_{dir}%beg_side%isothermal) requires both chemistry='T' and chem_params%diffusion='T' to calculate heat conduction.") # Prohibit if neither beg nor end is set to a valid wall condition - self.prohibit(bc_beg not in wall_bcs, f"Isothermal In (bc_{dir}%isothermal_in) requires a wall. Set bc_{dir}%beg to -15 (slip) or -16 (no-slip).") + self.prohibit(bc_beg not in wall_bcs, f"Isothermal In (bc_{dir}%beg_side%isothermal) requires a wall. Set bc_{dir}%beg to -15 (slip) or -16 (no-slip).") # Check that the wall temperature is defined and physically valid (> 0 K) - tw_in = self.get(f"bc%{dir}%Twall_in") - self.prohibit(tw_in is None, f"Isothermal In (bc_{dir}%isothermal_in) requires a wall temperature to be set (e.g., bc_{dir}%Twall_in).") + tw_in = self.get(f"bc%{dir}%beg_side%T_wall") + self.prohibit(tw_in is None, f"Isothermal In (bc_{dir}%beg_side%isothermal) requires a wall temperature to be set (e.g., bc_{dir}%beg_side%T_wall).") if tw_in is not None and self._is_numeric(tw_in): - self.prohibit(tw_in <= 0.0, f"Wall temperature bc_{dir}%Twall_in must be strictly positive for thermodynamics (got {tw_in}).") + self.prohibit(tw_in <= 0.0, f"Wall temperature bc_{dir}%beg_side%T_wall must be strictly positive for thermodynamics (got {tw_in}).") if isothermal_out: # Prohibit isothermal boundaries if chemistry or diffusion are disabled - self.prohibit(not chemistry or not diffusion, f"Isothermal Out (bc_{dir}%isothermal_out) requires both chemistry='T' and chem_params%diffusion='T' to calculate heat conduction.") + self.prohibit(not chemistry or not diffusion, f"Isothermal Out (bc_{dir}%end_side%isothermal) requires both chemistry='T' and chem_params%diffusion='T' to calculate heat conduction.") # Prohibit if neither beg nor end is set to a valid wall condition - self.prohibit(bc_end not in wall_bcs, f"Isothermal Out (bc_{dir}%isothermal_out) requires a wall. Set bc_{dir}%end to -15 (slip) or -16 (no-slip).") + self.prohibit(bc_end not in wall_bcs, f"Isothermal Out (bc_{dir}%end_side%isothermal) requires a wall. Set bc_{dir}%end to -15 (slip) or -16 (no-slip).") # Check that the wall temperature is defined and physically valid (> 0 K) - tw_out = self.get(f"bc%{dir}%Twall_out") - self.prohibit(tw_out is None, f"Isothermal Out (bc_{dir}%isothermal_out) requires a wall temperature to be set (e.g., bc_{dir}%Twall_out).") + tw_out = self.get(f"bc%{dir}%end_side%T_wall") + self.prohibit(tw_out is None, f"Isothermal Out (bc_{dir}%end_side%isothermal) requires a wall temperature to be set (e.g., bc_{dir}%end_side%T_wall).") if tw_out is not None and self._is_numeric(tw_out): - self.prohibit(tw_out <= 0.0, f"Wall temperature bc_{dir}%Tw_out must be strictly positive for thermodynamics (got {tw_out}).") + self.prohibit(tw_out <= 0.0, f"Wall temperature bc_{dir}%end_side%T_wall must be strictly positive for thermodynamics (got {tw_out}).") def check_misc_pre_process(self): """Checks miscellaneous pre-process constraints""" diff --git a/toolchain/mfc/params/definitions.py b/toolchain/mfc/params/definitions.py index 844210593f..48794f8177 100644 --- a/toolchain/mfc/params/definitions.py +++ b/toolchain/mfc/params/definitions.py @@ -111,17 +111,11 @@ def _fc(name: str, default: int) -> int: "angular_vel": "Angular velocity", "mass": "Mass", # BC specific - "vel_in": "Inlet velocity", - "vel_out": "Outlet velocity", - "alpha_rho_in": "Inlet partial density", - "alpha_in": "Inlet volume fraction", - "pres_in": "Inlet pressure", - "pres_out": "Outlet pressure", - "grcbc_in": "Enable GRCBC inlet", - "grcbc_out": "Enable GRCBC outlet", - "grcbc_vel_out": "Enable GRCBC velocity outlet", - "isothermal_in": "Enable isothermal wall at the domain entrance (minimum coordinate)", - "isothermal_out": "Enable isothermal wall at the domain exit (maximum coordinate)", + "grcbc": "Enable GRCBC", + "grcbc_vel": "Enable GRCBC velocity", + "isothermal": "Enable isothermal wall", + "T_wall": "Isothermal wall temperature", + "vel_wall": "Wall velocity component", # Acoustic "loc": "Location", "mag": "Magnitude", @@ -393,23 +387,15 @@ def _auto_describe(name: str) -> str: HINTS = { "bc": { - "grcbc_in": "Enables GRCBC subsonic inflow (bc type -7)", - "grcbc_out": "Enables GRCBC subsonic outflow (bc type -8)", - "grcbc_vel_out": "GRCBC velocity outlet (requires `grcbc_out`)", - "vel_in": "Inlet velocity component (used with `grcbc_in`)", - "vel_out": "Outlet velocity component (used with `grcbc_vel_out`)", - "pres_in": "Inlet pressure (used with `grcbc_in`)", - "pres_out": "Outlet pressure (used with `grcbc_out`)", - "alpha_rho_in": "Inlet partial density per fluid (used with `grcbc_in`)", - "alpha_in": "Inlet volume fraction per fluid (used with `grcbc_in`)", - "vb1": "Boundary velocity component 1 at domain begin", - "vb2": "Boundary velocity component 2 at domain begin", - "vb3": "Boundary velocity component 3 at domain begin", - "ve1": "Boundary velocity component 1 at domain end", - "ve2": "Boundary velocity component 2 at domain end", - "ve3": "Boundary velocity component 3 at domain end", - "Twall_in": "Temperature of the entrance-side isothermal wall.", - "Twall_out": "Temperature of the exit-side isothermal wall.", + "grcbc": "Enable GRCBC (subsonic inflow bc type -7, outflow bc type -8)", + "grcbc_vel": "GRCBC velocity outlet (requires end_side%grcbc)", + "vel": "Velocity component (used with beg_side%grcbc / end_side%grcbc_vel)", + "pres": "Pressure (beg_side: inlet, end_side: outlet)", + "alpha_rho": "Partial density per fluid (used with beg_side%grcbc)", + "alpha": "Volume fraction per fluid (used with beg_side%grcbc)", + "vel_wall": "Wall velocity component", + "T_wall": "Isothermal wall temperature", + "isothermal": "Enable isothermal wall", }, "patch_bc": { "geometry": "Patch shape: 1=line, 2=circle, 3=rectangle", @@ -1252,22 +1238,19 @@ def _load(): # Extended BC for d in ["x", "y", "z"]: - px = f"bc%{d}%" - for a in ["vb1", "vb2", "vb3", "ve1", "ve2", "ve3", "pres_in", "pres_out"]: - _r(f"{px}{a}", REAL, {"bc"}) - for a in ["grcbc_in", "grcbc_out", "grcbc_vel_out"]: - _r(f"{px}{a}", LOG, {"bc"}) - for f in range(1, NF + 1): - _r(f"{px}alpha_rho_in({f})", REAL, {"bc"}) - _r(f"{px}alpha_in({f})", REAL, {"bc"}) - for j in range(1, 4): - _r(f"{px}vel_in({j})", REAL, {"bc"}) - _r(f"{px}vel_out({j})", REAL, {"bc"}) - - for a in ["Twall_in", "Twall_out"]: - _r(f"{px}{a}", REAL, {"bc"}) - for a in ["isothermal_in", "isothermal_out"]: - _r(f"{px}{a}", LOG, {"bc"}) + for side, prefix in [("beg_side", "beg"), ("end_side", "end")]: + px = f"bc%{d}%{side}%" + _r(f"{px}pres", REAL, {"bc"}) + for j in range(1, 4): + _r(f"{px}vel({j})", REAL, {"bc"}) + _r(f"{px}vel_wall({j})", REAL, {"bc"}) + for f in range(1, NF + 1): + _r(f"{px}alpha_rho({f})", REAL, {"bc"}) + _r(f"{px}alpha({f})", REAL, {"bc"}) + _r(f"{px}T_wall", REAL, {"bc"}) + _r(f"{px}grcbc", LOG, {"bc"}) + _r(f"{px}grcbc_vel", LOG, {"bc"}) + _r(f"{px}isothermal", LOG, {"bc"}) # patch_bc (10 BC patches) for i in range(1, NB + 1): diff --git a/toolchain/mfc/params/descriptions.py b/toolchain/mfc/params/descriptions.py index f7ac3dbcbd..1517698490 100644 --- a/toolchain/mfc/params/descriptions.py +++ b/toolchain/mfc/params/descriptions.py @@ -361,21 +361,21 @@ (r"patch_ib\((\d+)\)%model_scale\((\d+)\)", "Model scale component {1} for IB patch {0}"), (r"patch_ib\((\d+)\)%model_rotate\((\d+)\)", "Model rotation component {1} for IB patch {0}"), # bc patterns - (r"bc_([xyz])%vel_in\((\d+)\)", "Inlet velocity component {1} at {0}-boundary"), - (r"bc_([xyz])%vel_out\((\d+)\)", "Outlet velocity component {1} at {0}-boundary"), - (r"bc_([xyz])%alpha_rho_in\((\d+)\)", "Inlet partial density of fluid {1} at {0}-boundary"), - (r"bc_([xyz])%alpha_in\((\d+)\)", "Inlet volume fraction of fluid {1} at {0}-boundary"), - (r"bc_([xyz])%pres_in", "Inlet pressure at {0}-boundary"), - (r"bc_([xyz])%pres_out", "Outlet pressure at {0}-boundary"), - (r"bc_([xyz])%vb(\d+)", "Boundary velocity component {1} at {0}-begin"), - (r"bc_([xyz])%ve(\d+)", "Boundary velocity component {1} at {0}-end"), - (r"bc_([xyz])%grcbc_in", "Enable GRCBC at {0}-inlet"), - (r"bc_([xyz])%grcbc_out", "Enable GRCBC at {0}-outlet"), - (r"bc_([xyz])%grcbc_vel_out", "Enable GRCBC velocity at {0}-outlet"), - (r"bc_([xyz])%isothermal_in", "Enable isothermal wall at {0}-inlet"), - (r"bc_([xyz])%isothermal_out", "Enable isothermal wall at {0}-outlet"), - (r"bc_([xyz])%Twall_in", "Wall temperature at {0}-inlet"), - (r"bc_([xyz])%Twall_out", "Wall temperature at {0}-outlet"), + (r"bc%([xyz])%beg_side%vel\((\d+)\)", "Inlet velocity component {1} at {0}-boundary"), + (r"bc%([xyz])%end_side%vel\((\d+)\)", "Outlet velocity component {1} at {0}-boundary"), + (r"bc%([xyz])%beg_side%alpha_rho\((\d+)\)", "Inlet partial density of fluid {1} at {0}-boundary"), + (r"bc%([xyz])%beg_side%alpha\((\d+)\)", "Inlet volume fraction of fluid {1} at {0}-boundary"), + (r"bc%([xyz])%beg_side%pres", "Inlet pressure at {0}-boundary"), + (r"bc%([xyz])%end_side%pres", "Outlet pressure at {0}-boundary"), + (r"bc%([xyz])%beg_side%vel_wall\((\d+)\)", "Wall velocity component {1} at {0}-begin"), + (r"bc%([xyz])%end_side%vel_wall\((\d+)\)", "Wall velocity component {1} at {0}-end"), + (r"bc%([xyz])%beg_side%grcbc", "Enable GRCBC at {0}-inlet"), + (r"bc%([xyz])%end_side%grcbc", "Enable GRCBC at {0}-outlet"), + (r"bc%([xyz])%end_side%grcbc_vel", "Enable GRCBC velocity at {0}-outlet"), + (r"bc%([xyz])%beg_side%isothermal", "Enable isothermal wall at {0}-inlet"), + (r"bc%([xyz])%end_side%isothermal", "Enable isothermal wall at {0}-outlet"), + (r"bc%([xyz])%beg_side%T_wall", "Wall temperature at {0}-inlet"), + (r"bc%([xyz])%end_side%T_wall", "Wall temperature at {0}-outlet"), # patch_bc patterns (r"patch_bc\((\d+)\)%geometry", "Geometry type for BC patch {0}"), (r"patch_bc\((\d+)\)%type", "BC type for patch {0}"), diff --git a/toolchain/mfc/params/generators/docs_gen.py b/toolchain/mfc/params/generators/docs_gen.py index 57c8767890..0ab3fc25cb 100644 --- a/toolchain/mfc/params/generators/docs_gen.py +++ b/toolchain/mfc/params/generators/docs_gen.py @@ -53,7 +53,7 @@ def _collapse_indices(name: str) -> str: Examples: patch_icpp(1)%vel(2) -> patch_icpp(N)%vel(M) simplex_params%perturb_dens_offset(1, 2) -> simplex_params%perturb_dens_offset(N, M) - bc%x%vel_in(1) -> bc%x%vel_in(N) + bc%x%beg_side%vel(1) -> bc%x%beg_side%vel(N) """ placeholders = ["N", "M", "K", "L", "P", "Q"] placeholder_idx = 0 diff --git a/toolchain/mfc/params_cmd.py b/toolchain/mfc/params_cmd.py index 782c81f327..d4e0b07a2b 100644 --- a/toolchain/mfc/params_cmd.py +++ b/toolchain/mfc/params_cmd.py @@ -53,7 +53,7 @@ def _collapse_indexed_params(matches): Collapse indexed parameters into patterns. Handles multiple index patterns: - - Suffix index: bc%z%alpha_in(1) -> bc%z%alpha_in(N) + - Suffix index: bc%z%beg_side%alpha(1) -> bc%z%beg_side%alpha(N) - Prefix index: patch_icpp(1)%geometry -> patch_icpp(N)%geometry - Both: patch_icpp(1)%alpha(1) -> patch_icpp(N)%alpha(M) """ diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index 3a256d244d..14060a3ec7 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -256,19 +256,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(1)": 1.0, "bc%x%beg": -7, "bc%x%end": -8, - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "T", - "bc%x%vel_in(1)": 1.0, - "bc%x%vel_in(2)": 0.0, - "bc%x%vel_in(3)": 0.0, - "bc%x%vel_out(1)": 1.0, - "bc%x%vel_out(2)": 0.0, - "bc%x%vel_out(3)": 0.0, - "bc%x%pres_in": 1.0, - "bc%x%pres_out": 1.0, - "bc%x%alpha_in(1)": 1.0, - "bc%x%alpha_rho_in(1)": 1.0, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "T", + "bc%x%beg_side%vel(1)": 1.0, + "bc%x%beg_side%vel(2)": 0.0, + "bc%x%beg_side%vel(3)": 0.0, + "bc%x%end_side%vel(1)": 1.0, + "bc%x%end_side%vel(2)": 0.0, + "bc%x%end_side%vel(3)": 0.0, + "bc%x%beg_side%pres": 1.0, + "bc%x%end_side%pres": 1.0, + "bc%x%beg_side%alpha(1)": 1.0, + "bc%x%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -282,19 +282,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(1)": 1.0, "bc%x%beg": -7, "bc%x%end": -8, - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "T", - "bc%x%vel_in(1)": 1.0, - "bc%x%vel_in(2)": 0.0, - "bc%x%vel_in(3)": 0.0, - "bc%x%vel_out(1)": 1.0, - "bc%x%vel_out(2)": 0.0, - "bc%x%vel_out(3)": 0.0, - "bc%x%pres_in": 1.0, - "bc%x%pres_out": 1.0, - "bc%x%alpha_in(1)": 1.0, - "bc%x%alpha_rho_in(1)": 1.0, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "T", + "bc%x%beg_side%vel(1)": 1.0, + "bc%x%beg_side%vel(2)": 0.0, + "bc%x%beg_side%vel(3)": 0.0, + "bc%x%end_side%vel(1)": 1.0, + "bc%x%end_side%vel(2)": 0.0, + "bc%x%end_side%vel(3)": 0.0, + "bc%x%beg_side%pres": 1.0, + "bc%x%end_side%pres": 1.0, + "bc%x%beg_side%alpha(1)": 1.0, + "bc%x%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -308,19 +308,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(2)": 1.0, "bc%y%beg": -7, "bc%y%end": -8, - "bc%y%grcbc_in": "T", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "T", - "bc%y%vel_in(1)": 0.0, - "bc%y%vel_in(2)": 1.0, - "bc%y%vel_in(3)": 0.0, - "bc%y%vel_out(1)": 0.0, - "bc%y%vel_out(2)": 1.0, - "bc%y%vel_out(3)": 0.0, - "bc%y%pres_in": 1.0, - "bc%y%pres_out": 1.0, - "bc%y%alpha_in(1)": 1.0, - "bc%y%alpha_rho_in(1)": 1.0, + "bc%y%beg_side%grcbc": "T", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "T", + "bc%y%beg_side%vel(1)": 0.0, + "bc%y%beg_side%vel(2)": 1.0, + "bc%y%beg_side%vel(3)": 0.0, + "bc%y%end_side%vel(1)": 0.0, + "bc%y%end_side%vel(2)": 1.0, + "bc%y%end_side%vel(3)": 0.0, + "bc%y%beg_side%pres": 1.0, + "bc%y%end_side%pres": 1.0, + "bc%y%beg_side%alpha(1)": 1.0, + "bc%y%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc y"], {})) @@ -334,19 +334,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(1)": 1.0, "bc%x%beg": -7, "bc%x%end": -8, - "bc%x%grcbc_in": "T", - "bc%x%grcbc_out": "T", - "bc%x%grcbc_vel_out": "T", - "bc%x%vel_in(1)": 1.0, - "bc%x%vel_in(2)": 0.0, - "bc%x%vel_in(3)": 0.0, - "bc%x%vel_out(1)": 1.0, - "bc%x%vel_out(2)": 0.0, - "bc%x%vel_out(3)": 0.0, - "bc%x%pres_in": 1.0, - "bc%x%pres_out": 1.0, - "bc%x%alpha_in(1)": 1.0, - "bc%x%alpha_rho_in(1)": 1.0, + "bc%x%beg_side%grcbc": "T", + "bc%x%end_side%grcbc": "T", + "bc%x%end_side%grcbc_vel": "T", + "bc%x%beg_side%vel(1)": 1.0, + "bc%x%beg_side%vel(2)": 0.0, + "bc%x%beg_side%vel(3)": 0.0, + "bc%x%end_side%vel(1)": 1.0, + "bc%x%end_side%vel(2)": 0.0, + "bc%x%end_side%vel(3)": 0.0, + "bc%x%beg_side%pres": 1.0, + "bc%x%end_side%pres": 1.0, + "bc%x%beg_side%alpha(1)": 1.0, + "bc%x%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc x"], {})) @@ -360,19 +360,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(2)": 1.0, "bc%y%beg": -7, "bc%y%end": -8, - "bc%y%grcbc_in": "T", - "bc%y%grcbc_out": "T", - "bc%y%grcbc_vel_out": "T", - "bc%y%vel_in(1)": 0.0, - "bc%y%vel_in(2)": 1.0, - "bc%y%vel_in(3)": 0.0, - "bc%y%vel_out(1)": 0.0, - "bc%y%vel_out(2)": 1.0, - "bc%y%vel_out(3)": 0.0, - "bc%y%pres_in": 1.0, - "bc%y%pres_out": 1.0, - "bc%y%alpha_in(1)": 1.0, - "bc%y%alpha_rho_in(1)": 1.0, + "bc%y%beg_side%grcbc": "T", + "bc%y%end_side%grcbc": "T", + "bc%y%end_side%grcbc_vel": "T", + "bc%y%beg_side%vel(1)": 0.0, + "bc%y%beg_side%vel(2)": 1.0, + "bc%y%beg_side%vel(3)": 0.0, + "bc%y%end_side%vel(1)": 0.0, + "bc%y%end_side%vel(2)": 1.0, + "bc%y%end_side%vel(3)": 0.0, + "bc%y%beg_side%pres": 1.0, + "bc%y%end_side%pres": 1.0, + "bc%y%beg_side%alpha(1)": 1.0, + "bc%y%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc y"], {})) @@ -386,19 +386,19 @@ def alter_grcbc(dimInfo): "patch_icpp(3)%vel(3)": 1.0, "bc%z%beg": -7, "bc%z%end": -8, - "bc%z%grcbc_in": "T", - "bc%z%grcbc_out": "T", - "bc%z%grcbc_vel_out": "T", - "bc%z%vel_in(1)": 0.0, - "bc%z%vel_in(2)": 0.0, - "bc%z%vel_in(3)": 1.0, - "bc%z%vel_out(1)": 0.0, - "bc%z%vel_out(2)": 0.0, - "bc%z%vel_out(3)": 1.0, - "bc%z%pres_in": 1.0, - "bc%z%pres_out": 1.0, - "bc%z%alpha_in(1)": 1.0, - "bc%z%alpha_rho_in(1)": 1.0, + "bc%z%beg_side%grcbc": "T", + "bc%z%end_side%grcbc": "T", + "bc%z%end_side%grcbc_vel": "T", + "bc%z%beg_side%vel(1)": 0.0, + "bc%z%beg_side%vel(2)": 0.0, + "bc%z%beg_side%vel(3)": 1.0, + "bc%z%end_side%vel(1)": 0.0, + "bc%z%end_side%vel(2)": 0.0, + "bc%z%end_side%vel(3)": 1.0, + "bc%z%beg_side%pres": 1.0, + "bc%z%end_side%pres": 1.0, + "bc%z%beg_side%alpha(1)": 1.0, + "bc%z%beg_side%alpha_rho(1)": 1.0, }, ) cases.append(define_case_d(stack, ["grcbc z"], {})) @@ -1812,10 +1812,10 @@ def chemistry_cases(): "x_domain%end": 0.05, "bc%x%beg": -16, # Left Isothermal Wall "bc%x%end": -16, # Right Isothermal Wall - "bc%x%isothermal_in": "T", - "bc%x%Twall_in": 600.0, - "bc%x%isothermal_out": "T", - "bc%x%Twall_out": 900.0, + "bc%x%beg_side%isothermal": "T", + "bc%x%beg_side%T_wall": 600.0, + "bc%x%end_side%isothermal": "T", + "bc%x%end_side%T_wall": 900.0, "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", @@ -1867,8 +1867,8 @@ def chemistry_cases(): "bc%x%end": -3, "bc%y%beg": -16, "bc%y%end": -3, - "bc%y%isothermal_in": "T", - "bc%y%Twall_in": 600.0, + "bc%y%beg_side%isothermal": "T", + "bc%y%beg_side%T_wall": 600.0, "weno_order": 5, "weno_eps": 1e-16, "mapped_weno": "T", From 1280b70c06c60f92e1cd225faefa68736491d84c Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 16:17:57 -0500 Subject: [PATCH 15/20] refactor: introduce body_force_t; rename bf_x/y/z to bf%x/y/z Group the three body-force axis structs (bf_x, bf_y, bf_z) into a single body_force_t container variable bf, matching the bc%x/y/z compound naming pattern. Updates all Fortran source, Python toolchain, examples, and docs. --- docs/documentation/case.md | 14 +++--- docs/documentation/equations.md | 2 +- examples/2D_rayleigh_taylor/case.py | 10 ++--- examples/3D_rayleigh_taylor_muscl/case.py | 10 ++--- src/common/m_derived_types.fpp | 5 +++ src/simulation/m_body_forces.fpp | 10 ++--- src/simulation/m_global_parameters.fpp | 10 ++--- src/simulation/m_ibm.fpp | 6 +-- src/simulation/m_mpi_proxy.fpp | 8 ++-- src/simulation/m_start_up.fpp | 12 +++--- toolchain/mfc/params/definitions.py | 52 +++++++++++------------ toolchain/mfc/params/descriptions.py | 30 ++++++------- toolchain/mfc/params/namelist_parser.py | 30 ++++++------- toolchain/mfc/test/cases.py | 6 +-- 14 files changed, 105 insertions(+), 100 deletions(-) diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 199a5d015c..092cecdb0e 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -987,15 +987,15 @@ This parameter enables the use of true `pi_\infty` in bubble dynamics models whe | Parameter | Type | Description | | ---: | :---: | :--- | -| `bf_[x,y,z]%%enabled` | Logical | Enable body forces in the [x,y,z] direction | -| `bf_[x,y,z]%%k` | Real | Magnitude of oscillating acceleration | -| `bf_[x,y,z]%%w` | Real | Frequency of oscillating acceleration | -| `bf_[x,y,z]%%p` | Real | Phase shift of oscillating acceleration | -| `bf_[x,y,z]%%g` | Real | Magnitude of background acceleration | +| `bf%%[x,y,z]%%enabled` | Logical | Enable body forces in the [x,y,z] direction | +| `bf%%[x,y,z]%%k` | Real | Magnitude of oscillating acceleration | +| `bf%%[x,y,z]%%w` | Real | Frequency of oscillating acceleration | +| `bf%%[x,y,z]%%p` | Real | Phase shift of oscillating acceleration | +| `bf%%[x,y,z]%%g` | Real | Magnitude of background acceleration | -`bf_[x,y,z]%%k`, `bf_[x,y,z]%%w`, `bf_[x,y,z]%%p`, and `bf_[x,y,z]%%g` define an oscillating acceleration in the `[x,y,z]` direction with the form +`bf%%[x,y,z]%%k`, `bf%%[x,y,z]%%w`, `bf%%[x,y,z]%%p`, and `bf%%[x,y,z]%%g` define an oscillating acceleration in the `[x,y,z]` direction with the form -\f[ a_{[x,y,z]} = bf_{[x,y,z]}\%g + bf_{[x,y,z]}\%k\sin\left(bf_{[x,y,z]}\%w \cdot t + bf_{[x,y,z]}\%p\right). \f] +\f[ a_{[x,y,z]} = bf\%[x,y,z]\%g + bf\%[x,y,z]\%k\sin\left(bf\%[x,y,z]\%w \cdot t + bf\%[x,y,z]\%p\right). \f] By convention, positive accelerations in the `x[y,z]` direction are in the positive `x[y,z]` direction. diff --git a/docs/documentation/equations.md b/docs/documentation/equations.md index 73037c6aa0..5e4ac403c5 100644 --- a/docs/documentation/equations.md +++ b/docs/documentation/equations.md @@ -746,7 +746,7 @@ Uses Lax-Friedrichs flux (replaces WENO + Riemann solver). --- -## 13. Body Forces (`bf_x`, `bf_y`, `bf_z`) +## 13. Body Forces (`bf%%x`, `bf%%y`, `bf%%z`) **Source:** `src/simulation/m_body_forces.fpp` diff --git a/examples/2D_rayleigh_taylor/case.py b/examples/2D_rayleigh_taylor/case.py index db9078f7af..e9ded4ff05 100644 --- a/examples/2D_rayleigh_taylor/case.py +++ b/examples/2D_rayleigh_taylor/case.py @@ -79,11 +79,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y%enabled": "T", - "bf_y%k": 0.0, - "bf_y%w": 0.0, - "bf_y%p": 0.0, - "bf_y%g": -9.81, + "bf%y%enabled": "T", + "bf%y%k": 0.0, + "bf%y%w": 0.0, + "bf%y%p": 0.0, + "bf%y%g": -9.81, # Water Patch "patch_icpp(1)%geometry": 3, "patch_icpp(1)%hcid": 204, diff --git a/examples/3D_rayleigh_taylor_muscl/case.py b/examples/3D_rayleigh_taylor_muscl/case.py index 7133886a28..4d646ea577 100644 --- a/examples/3D_rayleigh_taylor_muscl/case.py +++ b/examples/3D_rayleigh_taylor_muscl/case.py @@ -84,11 +84,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y%enabled": "T", - "bf_y%k": 0.0, - "bf_y%w": 0.0, - "bf_y%p": 0.0, - "bf_y%g": -98.1, + "bf%y%enabled": "T", + "bf%y%k": 0.0, + "bf%y%w": 0.0, + "bf%y%p": 0.0, + "bf%y%g": -98.1, # Water Patch "patch_icpp(1)%geometry": 9, "patch_icpp(1)%hcid": 300, diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index 4d975ccd15..d552a3205b 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -186,6 +186,11 @@ module m_derived_types logical :: enabled end type body_force_axis + !> Groups the x, y, z body force structs for passing as a single argument. + type body_force_t + type(body_force_axis) :: x, y, z + end type body_force_t + !> Groups per-body allocatable arrays (x, y, z) for one IB dynamics quantity type ib_dynamics_t real(wp), allocatable, dimension(:) :: x, y, z diff --git a/src/simulation/m_body_forces.fpp b/src/simulation/m_body_forces.fpp index abbad139a1..95616f6e6b 100644 --- a/src/simulation/m_body_forces.fpp +++ b/src/simulation/m_body_forces.fpp @@ -45,8 +45,8 @@ contains real(wp), intent(in) :: t #:for DIR, XYZ in [(1, 'x'), (2, 'y'), (3, 'z')] - if (bf_${XYZ}$%enabled) then - accel_bf(${DIR}$) = bf_${XYZ}$%g + bf_${XYZ}$%k*sin(bf_${XYZ}$%w*t - bf_${XYZ}$%p) + if (bf%${XYZ}$%enabled) then + accel_bf(${DIR}$) = bf%${XYZ}$%g + bf%${XYZ}$%k*sin(bf%${XYZ}$%w*t - bf%${XYZ}$%p) end if #:endfor @@ -98,7 +98,7 @@ contains end do $:END_GPU_PARALLEL_LOOP() - if (bf_x%enabled) then ! x-direction body forces + if (bf%x%enabled) then ! x-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p @@ -113,7 +113,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bf_y%enabled) then ! y-direction body forces + if (bf%y%enabled) then ! y-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p @@ -129,7 +129,7 @@ contains $:END_GPU_PARALLEL_LOOP() end if - if (bf_z%enabled) then ! z-direction body forces + if (bf%z%enabled) then ! z-direction body forces $:GPU_PARALLEL_LOOP(private='[j, k, l]', collapse=3) do l = 0, p diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 8b00b8ac04..0f8d12f4c7 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -172,7 +172,7 @@ module m_global_parameters integer :: num_igr_warm_start_iters !< number of warm start iterations for elliptic solve real(wp) :: alf_factor !< alpha factor for IGR logical :: bodyForces - type(body_force_axis) :: bf_x, bf_y, bf_z !< body force parameters per direction + type(body_force_t) :: bf !< body force parameters per direction real(wp), dimension(3) :: accel_bf $:GPU_DECLARE(create='[accel_bf]') @@ -666,10 +666,10 @@ contains surface_tension = .false. bodyForces = .false. - bf_x%enabled = .false.; bf_y%enabled = .false.; bf_z%enabled = .false. - bf_x%k = 0._wp; bf_x%w = 0._wp; bf_x%p = 0._wp; bf_x%g = 0._wp - bf_y%k = 0._wp; bf_y%w = 0._wp; bf_y%p = 0._wp; bf_y%g = 0._wp - bf_z%k = 0._wp; bf_z%w = 0._wp; bf_z%p = 0._wp; bf_z%g = 0._wp + bf%x%enabled = .false.; bf%y%enabled = .false.; bf%z%enabled = .false. + bf%x%k = 0._wp; bf%x%w = 0._wp; bf%x%p = 0._wp; bf%x%g = 0._wp + bf%y%k = 0._wp; bf%y%w = 0._wp; bf%y%p = 0._wp; bf%y%g = 0._wp + bf%z%k = 0._wp; bf%z%w = 0._wp; bf%z%p = 0._wp; bf%z%g = 0._wp fft_wrt = .false. diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 71d0bcc530..e4d65b3343 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -1015,13 +1015,13 @@ contains ! consider body forces after reducing to avoid double counting do i = 1, num_ibs - if (bf_x%enabled) then + if (bf%x%enabled) then forces(i, 1) = forces(i, 1) + accel_bf(1)*patch_ib(i)%mass end if - if (bf_y%enabled) then + if (bf%y%enabled) then forces(i, 2) = forces(i, 2) + accel_bf(2)*patch_ib(i)%mass end if - if (bf_z%enabled) then + if (bf%z%enabled) then forces(i, 3) = forces(i, 3) + accel_bf(3)*patch_ib(i)%mass end if end do diff --git a/src/simulation/m_mpi_proxy.fpp b/src/simulation/m_mpi_proxy.fpp index 352b837288..ce87eab0de 100644 --- a/src/simulation/m_mpi_proxy.fpp +++ b/src/simulation/m_mpi_proxy.fpp @@ -63,9 +63,9 @@ contains call MPI_BCAST(case_dir, len(case_dir), MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) - #:for VAR in ['bf_x%k', 'bf_x%w', 'bf_x%p', 'bf_x%g', & - & 'bf_y%k', 'bf_y%w', 'bf_y%p', 'bf_y%g', & - & 'bf_z%k', 'bf_z%w', 'bf_z%p', 'bf_z%g'] + #:for VAR in ['bf%x%k', 'bf%x%w', 'bf%x%p', 'bf%x%g', & + & 'bf%y%k', 'bf%y%w', 'bf%y%p', 'bf%y%g', & + & 'bf%z%k', 'bf%z%w', 'bf%z%p', 'bf%z%g'] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor @@ -87,7 +87,7 @@ contains & 'parallel_io', 'hypoelasticity', 'bubbles_euler', 'polytropic', & & 'polydisperse', 'qbmm', 'acoustic_source', 'probe_wrt', 'integral_wrt', & & 'prim_vars_wrt', 'weno_avg', 'file_per_process', 'relax', & - & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf_x%enabled', 'bf_y%enabled', 'bf_z%enabled', & + & 'adv_n', 'adap_dt', 'ib', 'bodyForces', 'bf%x%enabled', 'bf%y%enabled', 'bf%z%enabled', & & 'bc%x%beg_side%grcbc', 'bc%x%end_side%grcbc', 'bc%x%end_side%grcbc_vel', & & 'bc%y%beg_side%grcbc', 'bc%y%end_side%grcbc', 'bc%y%end_side%grcbc_vel', & & 'bc%z%beg_side%grcbc', 'bc%z%end_side%grcbc', 'bc%z%end_side%grcbc_vel', & diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 7daf13a433..e648295cab 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -108,11 +108,11 @@ contains #:endif Ca, Web, Re_inv, acoustic_source, acoustic, num_source, polytropic, thermal, integral, integral_wrt, num_integrals, & & polydisperse, poly_sigma, qbmm, relax, relax_model, palpha_eps, ptgalpha_eps, file_per_process, sigma, pi_fac, & - & adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, bf_x, bf_y, bf_z, n_start, t_save, t_stop, cfl_adap_dt, & - & cfl_const_dt, cfl_target, surface_tension, bubbles_lagrange, lag_params, hyperelasticity, R0ref, num_bc_patches, & - & Bx0, cont_damage, tau_star, cont_damage_s, alpha_bar, hyper_cleaning, hyper_cleaning_speed, hyper_cleaning_tau, & - & alf_factor, num_igr_iters, num_igr_warm_start_iters, int_comp, ic_eps, ic_beta, nv_uvm_out_of_core, & - & nv_uvm_igr_temps_on_gpu, nv_uvm_pref_gpu, down_sample, fft_wrt + & adv_n, adap_dt, adap_dt_tol, adap_dt_max_iters, bf, n_start, t_save, t_stop, cfl_adap_dt, cfl_const_dt, cfl_target, & + & surface_tension, bubbles_lagrange, lag_params, hyperelasticity, R0ref, num_bc_patches, Bx0, cont_damage, tau_star, & + & cont_damage_s, alpha_bar, hyper_cleaning, hyper_cleaning_speed, hyper_cleaning_tau, alf_factor, num_igr_iters, & + & num_igr_warm_start_iters, int_comp, ic_eps, ic_beta, nv_uvm_out_of_core, nv_uvm_igr_temps_on_gpu, nv_uvm_pref_gpu, & + & down_sample, fft_wrt inquire (FILE=trim(file_path), EXIST=file_exist) @@ -129,7 +129,7 @@ contains close (1) - if (bf_x%enabled .or. bf_y%enabled .or. bf_z%enabled) then + if (bf%x%enabled .or. bf%y%enabled .or. bf%z%enabled) then bodyForces = .true. end if diff --git a/toolchain/mfc/params/definitions.py b/toolchain/mfc/params/definitions.py index 48794f8177..1db0369a7d 100644 --- a/toolchain/mfc/params/definitions.py +++ b/toolchain/mfc/params/definitions.py @@ -262,21 +262,21 @@ def _fc(name: str, default: int) -> int: "format": "Output format", "precision": "Output precision", # Body forces - "bf_x%enabled": "Enable body force in x", - "bf_y%enabled": "Enable body force in y", - "bf_z%enabled": "Enable body force in z", - "bf_x%k": "Body force wavenumber in x", - "bf_y%k": "Body force wavenumber in y", - "bf_z%k": "Body force wavenumber in z", - "bf_x%w": "Body force frequency in x", - "bf_y%w": "Body force frequency in y", - "bf_z%w": "Body force frequency in z", - "bf_x%p": "Body force phase in x", - "bf_y%p": "Body force phase in y", - "bf_z%p": "Body force phase in z", - "bf_x%g": "Gravitational acceleration in x", - "bf_y%g": "Gravitational acceleration in y", - "bf_z%g": "Gravitational acceleration in z", + "bf%x%enabled": "Enable body force in x", + "bf%y%enabled": "Enable body force in y", + "bf%z%enabled": "Enable body force in z", + "bf%x%k": "Body force wavenumber in x", + "bf%y%k": "Body force wavenumber in y", + "bf%z%k": "Body force wavenumber in z", + "bf%x%w": "Body force frequency in x", + "bf%y%w": "Body force frequency in y", + "bf%z%w": "Body force frequency in z", + "bf%x%p": "Body force phase in x", + "bf%y%p": "Body force phase in y", + "bf%z%p": "Body force phase in z", + "bf%x%g": "Gravitational acceleration in x", + "bf%y%g": "Gravitational acceleration in y", + "bf%z%g": "Gravitational acceleration in z", # More output "E_wrt": "Write energy field", "c_wrt": "Write sound speed field", @@ -743,19 +743,19 @@ def get_value_label(param_name: str, value: int) -> str: "requires": ["a_z", "z_stretch%beg", "z_stretch%end"], } }, - "bf_x%enabled": { + "bf%x%enabled": { "when_true": { - "requires": ["bf_x%k", "bf_x%w", "bf_x%p", "bf_x%g"], + "requires": ["bf%x%k", "bf%x%w", "bf%x%p", "bf%x%g"], } }, - "bf_y%enabled": { + "bf%y%enabled": { "when_true": { - "requires": ["bf_y%k", "bf_y%w", "bf_y%p", "bf_y%g"], + "requires": ["bf%y%k", "bf%y%w", "bf%y%p", "bf%y%g"], } }, - "bf_z%enabled": { + "bf%z%enabled": { "when_true": { - "requires": ["bf_z%k", "bf_z%w", "bf_z%p", "bf_z%g"], + "requires": ["bf%z%k", "bf%z%w", "bf%z%p", "bf%z%g"], } }, "teno": { @@ -1062,11 +1062,11 @@ def _load(): # Body force for d in ["x", "y", "z"]: - _r(f"bf_{d}%g", REAL, math=r"\f$g_" + d + r"\f$") - _r(f"bf_{d}%k", REAL, math=r"\f$k_" + d + r"\f$") - _r(f"bf_{d}%w", REAL, math=r"\f$\omega_" + d + r"\f$") - _r(f"bf_{d}%p", REAL, math=r"\f$\phi_" + d + r"\f$") - _r(f"bf_{d}%enabled", LOG) + _r(f"bf%{d}%g", REAL, math=r"\f$g_" + d + r"\f$") + _r(f"bf%{d}%k", REAL, math=r"\f$k_" + d + r"\f$") + _r(f"bf%{d}%w", REAL, math=r"\f$\omega_" + d + r"\f$") + _r(f"bf%{d}%p", REAL, math=r"\f$\phi_" + d + r"\f$") + _r(f"bf%{d}%enabled", LOG) # INDEXED PARAMETERS diff --git a/toolchain/mfc/params/descriptions.py b/toolchain/mfc/params/descriptions.py index 1517698490..65288e127a 100644 --- a/toolchain/mfc/params/descriptions.py +++ b/toolchain/mfc/params/descriptions.py @@ -214,21 +214,21 @@ "lag_header": "Enable Lagrangian output header", "chem_wrt_T": "Write temperature field for chemistry", # Body force parameters - "bf_x%enabled": "Enable body force in x-direction", - "bf_y%enabled": "Enable body force in y-direction", - "bf_z%enabled": "Enable body force in z-direction", - "bf_x%g": "Body force magnitude in x-direction", - "bf_y%g": "Body force magnitude in y-direction", - "bf_z%g": "Body force magnitude in z-direction", - "bf_x%k": "Body force wavenumber in x-direction", - "bf_y%k": "Body force wavenumber in y-direction", - "bf_z%k": "Body force wavenumber in z-direction", - "bf_x%w": "Body force frequency in x-direction", - "bf_y%w": "Body force frequency in y-direction", - "bf_z%w": "Body force frequency in z-direction", - "bf_x%p": "Body force phase in x-direction", - "bf_y%p": "Body force phase in y-direction", - "bf_z%p": "Body force phase in z-direction", + "bf%x%enabled": "Enable body force in x-direction", + "bf%y%enabled": "Enable body force in y-direction", + "bf%z%enabled": "Enable body force in z-direction", + "bf%x%g": "Body force magnitude in x-direction", + "bf%y%g": "Body force magnitude in y-direction", + "bf%z%g": "Body force magnitude in z-direction", + "bf%x%k": "Body force wavenumber in x-direction", + "bf%y%k": "Body force wavenumber in y-direction", + "bf%z%k": "Body force wavenumber in z-direction", + "bf%x%w": "Body force frequency in x-direction", + "bf%y%w": "Body force frequency in y-direction", + "bf%z%w": "Body force frequency in z-direction", + "bf%x%p": "Body force phase in x-direction", + "bf%y%p": "Body force phase in y-direction", + "bf%z%p": "Body force phase in z-direction", # Output flags "mom_wrt": "Write momentum to database", "flux_wrt": "Write flux data", diff --git a/toolchain/mfc/params/namelist_parser.py b/toolchain/mfc/params/namelist_parser.py index 445c2ec676..0c2e57db52 100644 --- a/toolchain/mfc/params/namelist_parser.py +++ b/toolchain/mfc/params/namelist_parser.py @@ -140,9 +140,9 @@ "alt_soundspeed", "avg_state", "bc", - "bf_x%enabled", - "bf_y%enabled", - "bf_z%enabled", + "bf%x%enabled", + "bf%y%enabled", + "bf%z%enabled", "bub_pp", "bubble_model", "bubbles_euler", @@ -161,9 +161,9 @@ "fft_wrt", "file_per_process", "fluid_pp", - "bf_x%g", - "bf_y%g", - "bf_z%g", + "bf%x%g", + "bf%y%g", + "bf%z%g", "hyper_cleaning", "hyper_cleaning_speed", "hyper_cleaning_tau", @@ -180,9 +180,9 @@ "int_comp", "integral", "integral_wrt", - "bf_x%k", - "bf_y%k", - "bf_z%k", + "bf%x%k", + "bf%y%k", + "bf%z%k", "lag_params", "low_Mach", "m", @@ -210,9 +210,9 @@ "nv_uvm_out_of_core", "nv_uvm_pref_gpu", "p", - "bf_x%p", - "bf_y%p", - "bf_z%p", + "bf%x%p", + "bf%y%p", + "bf%z%p", "palpha_eps", "parallel_io", "patch_ib", @@ -250,9 +250,9 @@ "thermal", "time_stepper", "viscous", - "bf_x%w", - "bf_y%w", - "bf_z%w", + "bf%x%w", + "bf%y%w", + "bf%z%w", "wave_speeds", "weno_Re_flux", "weno_avg", diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index 14060a3ec7..a0d0611cc4 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -1186,13 +1186,13 @@ def alter_hypoelasticity(dimInfo): def alter_body_forces(dimInfo): ndims = len(dimInfo[0]) - stack.push("Bodyforces", {"bf_x%enabled": "T", "bf_x%k": 1, "bf_x%w": 1, "bf_x%p": 1, "bf_x%g": 10}) + stack.push("Bodyforces", {"bf%x%enabled": "T", "bf%x%k": 1, "bf%x%w": 1, "bf%x%p": 1, "bf%x%g": 10}) if ndims >= 2: - stack.push("", {"bf_y%enabled": "T", "bf_y%k": 1, "bf_y%w": 1, "bf_y%p": 1, "bf_y%g": 10}) + stack.push("", {"bf%y%enabled": "T", "bf%y%k": 1, "bf%y%w": 1, "bf%y%p": 1, "bf%y%g": 10}) if ndims == 3: - stack.push("", {"bf_z%enabled": "T", "bf_z%k": 1, "bf_z%w": 1, "bf_z%p": 1, "bf_z%g": 10}) + stack.push("", {"bf%z%enabled": "T", "bf%z%k": 1, "bf%z%w": 1, "bf%z%p": 1, "bf%z%g": 10}) cases.append(define_case_d(stack, "", {})) From 31f842108f4da774043c0ab714286593ea4f24b1 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 16:24:09 -0500 Subject: [PATCH 16/20] fix: update remaining bf_x/y/z references missed in rename - examples/3D_rayleigh_taylor/case.py: bf_y%* -> bf%y%* - case_validator.py: check_body_forces uses bf%{dir}%enabled/k/w/p/g - descriptions.py: regex pattern bf_([xyz]) -> bf%([xyz])%enabled --- examples/3D_rayleigh_taylor/case.py | 10 +++++----- toolchain/mfc/case_validator.py | 10 +++++----- toolchain/mfc/params/descriptions.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/3D_rayleigh_taylor/case.py b/examples/3D_rayleigh_taylor/case.py index a476a5ffba..b674c0e073 100644 --- a/examples/3D_rayleigh_taylor/case.py +++ b/examples/3D_rayleigh_taylor/case.py @@ -86,11 +86,11 @@ "fluid_pp(2)%pi_inf": 0.0e00, "fluid_pp(2)%Re(1)": 1 / 0.0073, # Body Forces - "bf_y%enabled": "T", - "bf_y%k": 0.0, - "bf_y%w": 0.0, - "bf_y%p": 0.0, - "bf_y%g": -98.1, + "bf%y%enabled": "T", + "bf%y%k": 0.0, + "bf%y%w": 0.0, + "bf%y%p": 0.0, + "bf%y%g": -98.1, # Water Patch "patch_icpp(1)%geometry": 9, "patch_icpp(1)%hcid": 300, diff --git a/toolchain/mfc/case_validator.py b/toolchain/mfc/case_validator.py index 6c5cd7a50b..e8e7de4bc1 100644 --- a/toolchain/mfc/case_validator.py +++ b/toolchain/mfc/case_validator.py @@ -845,15 +845,15 @@ def check_bubbles_euler_simulation(self): def check_body_forces(self): """Checks constraints on body forces parameters""" for dir in ["x", "y", "z"]: - bf = self.get(f"bf_{dir}", "F") == "T" + bf = self.get(f"bf%{dir}%enabled", "F") == "T" if not bf: continue - self.prohibit(self.get(f"k_{dir}") is None, f"k_{dir} must be specified if bf_{dir} is true") - self.prohibit(self.get(f"w_{dir}") is None, f"w_{dir} must be specified if bf_{dir} is true") - self.prohibit(self.get(f"p_{dir}") is None, f"p_{dir} must be specified if bf_{dir} is true") - self.prohibit(self.get(f"g_{dir}") is None, f"g_{dir} must be specified if bf_{dir} is true") + self.prohibit(self.get(f"bf%{dir}%k") is None, f"bf%{dir}%k must be specified if bf%{dir}%enabled is true") + self.prohibit(self.get(f"bf%{dir}%w") is None, f"bf%{dir}%w must be specified if bf%{dir}%enabled is true") + self.prohibit(self.get(f"bf%{dir}%p") is None, f"bf%{dir}%p must be specified if bf%{dir}%enabled is true") + self.prohibit(self.get(f"bf%{dir}%g") is None, f"bf%{dir}%g must be specified if bf%{dir}%enabled is true") def check_viscosity(self): """Checks constraints on viscosity parameters""" diff --git a/toolchain/mfc/params/descriptions.py b/toolchain/mfc/params/descriptions.py index 65288e127a..61d473fa98 100644 --- a/toolchain/mfc/params/descriptions.py +++ b/toolchain/mfc/params/descriptions.py @@ -473,7 +473,7 @@ (r"lag_(\w+)_wrt", "Write Lagrangian {0} field"), # Body force patterns (r"([kgwp])_([xyz])", "Body force parameter {0} in {1}-direction"), - (r"bf_([xyz])", "Enable body force in {0}-direction"), + (r"bf%([xyz])%enabled", "Enable body force in {0}-direction"), # simplex patterns (r"simplex_params%perturb_dens\((\d+)\)", "Enable density perturbation for fluid {0}"), (r"simplex_params%perturb_dens_freq\((\d+)\)", "Density perturbation frequency for fluid {0}"), From aca89c0c43ad6528aeed0653c3165beafc03ff87 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 17:07:22 -0500 Subject: [PATCH 17/20] refactor: extend riemann_states to HLL, LF, HLLC solvers Replace flat rho_L/rho_R, pres_L/pres_R, E_L/E_R, H_L/H_R, gamma_L/R, pi_inf_L/R, qv_L/R, c_L/R, T_L/R, MW_L/R, R_gas_L/R, Cp_L/R, Cv_L/R, Gamm_L/R, G_L/R, Y_L/R, vel_L_rms/R_rms, vel_L_tmp/R_tmp, nbub_L/R, ptilde_L/R with type(riemann_states) :: rho, pres, E, H, ... accessed as rho%L / rho%R. Replace vel_L/vel_R with type(riemann_states_vec3) :: vel accessed as vel%L(i) / vel%R(i). HLLD already used this pattern; HLL, LF, and HLLC now match. GPU private lists updated to name the struct once instead of _L and _R. --- src/simulation/include/inline_riemann.fpp | 82 +- src/simulation/m_riemann_solvers.fpp | 1801 ++++++++++----------- 2 files changed, 913 insertions(+), 970 deletions(-) diff --git a/src/simulation/include/inline_riemann.fpp b/src/simulation/include/inline_riemann.fpp index aae4015292..bd67afc381 100644 --- a/src/simulation/include/inline_riemann.fpp +++ b/src/simulation/include/inline_riemann.fpp @@ -1,61 +1,61 @@ #:def arithmetic_avg() - rho_avg = 5.e-1_wp*(rho_L + rho_R) + rho_avg = 5.e-1_wp*(rho%L + rho%R) vel_avg_rms = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels - vel_avg_rms = vel_avg_rms + (5.e-1_wp*(vel_L(i) + vel_R(i)))**2._wp + vel_avg_rms = vel_avg_rms + (5.e-1_wp*(vel%L(i) + vel%R(i)))**2._wp end do - H_avg = 5.e-1_wp*(H_L + H_R) - gamma_avg = 5.e-1_wp*(gamma_L + gamma_R) - qv_avg = 5.e-1_wp*(qv_L + qv_R) + H_avg = 5.e-1_wp*(H%L + H%R) + gamma_avg = 5.e-1_wp*(gamma%L + gamma%R) + qv_avg = 5.e-1_wp*(qv%L + qv%R) #:enddef arithmetic_avg #:def roe_avg() - rho_avg = sqrt(rho_L*rho_R) + rho_avg = sqrt(rho%L*rho%R) vel_avg_rms = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels - vel_avg_rms = vel_avg_rms + (sqrt(rho_L)*vel_L(i) + sqrt(rho_R)*vel_R(i))**2._wp/(sqrt(rho_L) + sqrt(rho_R))**2._wp + vel_avg_rms = vel_avg_rms + (sqrt(rho%L)*vel%L(i) + sqrt(rho%R)*vel%R(i))**2._wp/(sqrt(rho%L) + sqrt(rho%R))**2._wp end do - H_avg = (sqrt(rho_L)*H_L + sqrt(rho_R)*H_R)/(sqrt(rho_L) + sqrt(rho_R)) + H_avg = (sqrt(rho%L)*H%L + sqrt(rho%R)*H%R)/(sqrt(rho%L) + sqrt(rho%R)) - gamma_avg = (sqrt(rho_L)*gamma_L + sqrt(rho_R)*gamma_R)/(sqrt(rho_L) + sqrt(rho_R)) + gamma_avg = (sqrt(rho%L)*gamma%L + sqrt(rho%R)*gamma%R)/(sqrt(rho%L) + sqrt(rho%R)) - vel_avg_rms = (sqrt(rho_L)*vel_L(1) + sqrt(rho_R)*vel_R(1))**2._wp/(sqrt(rho_L) + sqrt(rho_R))**2._wp + vel_avg_rms = (sqrt(rho%L)*vel%L(1) + sqrt(rho%R)*vel%R(1))**2._wp/(sqrt(rho%L) + sqrt(rho%R))**2._wp - qv_avg = (sqrt(rho_L)*qv_L + sqrt(rho_R)*qv_R)/(sqrt(rho_L) + sqrt(rho_R)) + qv_avg = (sqrt(rho%L)*qv%L + sqrt(rho%R)*qv%R)/(sqrt(rho%L) + sqrt(rho%R)) if (chemistry) then eps = 0.001_wp - call get_species_enthalpies_rt(T_L, h_iL) - call get_species_enthalpies_rt(T_R, h_iR) + call get_species_enthalpies_rt(T%L, h_iL) + call get_species_enthalpies_rt(T%R, h_iR) #:if USING_AMD - h_iL = h_iL*gas_constant/molecular_weights_nonparameter*T_L - h_iR = h_iR*gas_constant/molecular_weights_nonparameter*T_R + h_iL = h_iL*gas_constant/molecular_weights_nonparameter*T%L + h_iR = h_iR*gas_constant/molecular_weights_nonparameter*T%R #:else - h_iL = h_iL*gas_constant/molecular_weights*T_L - h_iR = h_iR*gas_constant/molecular_weights*T_R + h_iL = h_iL*gas_constant/molecular_weights*T%L + h_iR = h_iR*gas_constant/molecular_weights*T%R #:endif - call get_species_specific_heats_r(T_L, Cp_iL) - call get_species_specific_heats_r(T_R, Cp_iR) + call get_species_specific_heats_r(T%L, Cp_iL) + call get_species_specific_heats_r(T%R, Cp_iR) - h_avg_2 = (sqrt(rho_L)*h_iL + sqrt(rho_R)*h_iR)/(sqrt(rho_L) + sqrt(rho_R)) - Yi_avg = (sqrt(rho_L)*Ys_L + sqrt(rho_R)*Ys_R)/(sqrt(rho_L) + sqrt(rho_R)) - T_avg = (sqrt(rho_L)*T_L + sqrt(rho_R)*T_R)/(sqrt(rho_L) + sqrt(rho_R)) + h_avg_2 = (sqrt(rho%L)*h_iL + sqrt(rho%R)*h_iR)/(sqrt(rho%L) + sqrt(rho%R)) + Yi_avg = (sqrt(rho%L)*Ys_L + sqrt(rho%R)*Ys_R)/(sqrt(rho%L) + sqrt(rho%R)) + T_avg = (sqrt(rho%L)*T%L + sqrt(rho%R)*T%R)/(sqrt(rho%L) + sqrt(rho%R)) #:if USING_AMD - if (abs(T_L - T_R) < eps) then - ! Case when T_L and T_R are very close + if (abs(T%L - T%R) < eps) then + ! Case when T%L and T%R are very close Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:)) Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights_nonparameter(:) & & - gas_constant/molecular_weights_nonparameter(:))) else - ! Normal calculation when T_L and T_R are sufficiently different - Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L)) - Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights_nonparameter(:))) + ! Normal calculation when T%L and T%R are sufficiently different + Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T%R - T%L)) + Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T%R - T%L) - gas_constant/molecular_weights_nonparameter(:))) end if gamma_avg = Cp_avg/Cv_avg @@ -63,15 +63,15 @@ & + gamma_avg*gas_constant/molecular_weights_nonparameter(:)*T_avg c_sum_Yi_Phi = sum(Yi_avg(:)*Phi_avg(:)) #:else - if (abs(T_L - T_R) < eps) then - ! Case when T_L and T_R are very close + if (abs(T%L - T%R) < eps) then + ! Case when T%L and T%R are very close Cp_avg = sum(Yi_avg(:)*(0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:)) Cv_avg = sum(Yi_avg(:)*((0.5_wp*Cp_iL(:) + 0.5_wp*Cp_iR(:))*gas_constant/molecular_weights(:) & & - gas_constant/molecular_weights(:))) else - ! Normal calculation when T_L and T_R are sufficiently different - Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T_R - T_L)) - Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T_R - T_L) - gas_constant/molecular_weights(:))) + ! Normal calculation when T%L and T%R are sufficiently different + Cp_avg = sum(Yi_avg(:)*(h_iR(:) - h_iL(:))/(T%R - T%L)) + Cv_avg = sum(Yi_avg(:)*((h_iR(:) - h_iL(:))/(T%R - T%L) - gas_constant/molecular_weights(:))) end if gamma_avg = Cp_avg/Cv_avg @@ -93,24 +93,24 @@ #:def compute_low_Mach_correction() if (riemann_solver == 1 .or. riemann_solver == 5) then - zcoef = min(1._wp, max(vel_L_rms**5.e-1_wp/c_L, vel_R_rms**5.e-1_wp/c_R)) + zcoef = min(1._wp, max(vel_rms%L**5.e-1_wp/c%L, vel_rms%R**5.e-1_wp/c%R)) pcorr = 0._wp if (low_Mach == 1) then - pcorr = -(s_P - s_M)*(rho_L + rho_R)/8._wp*(zcoef - 1._wp) + pcorr = -(s_P - s_M)*(rho%L + rho%R)/8._wp*(zcoef - 1._wp) end if else if (riemann_solver == 2) then - zcoef = min(1._wp, max(vel_L_rms**5.e-1_wp/c_L, vel_R_rms**5.e-1_wp/c_R)) + zcoef = min(1._wp, max(vel_rms%L**5.e-1_wp/c%L, vel_rms%R**5.e-1_wp/c%R)) pcorr = 0._wp if (low_Mach == 1) then - pcorr = rho_L*rho_R*(s_L - vel_L(dir_idx(1)))*(s_R - vel_R(dir_idx(1)))*(vel_R(dir_idx(1)) - vel_L(dir_idx(1))) & - & /(rho_R*(s_R - vel_R(dir_idx(1))) - rho_L*(s_L - vel_L(dir_idx(1))))*(zcoef - 1._wp) + pcorr = rho%L*rho%R*(s_L - vel%L(dir_idx(1)))*(s_R - vel%R(dir_idx(1)))*(vel%R(dir_idx(1)) - vel%L(dir_idx(1))) & + & /(rho%R*(s_R - vel%R(dir_idx(1))) - rho%L*(s_L - vel%L(dir_idx(1))))*(zcoef - 1._wp) else if (low_Mach == 2) then - vel_L_tmp = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) - vel_R_tmp = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + zcoef*(vel_R(dir_idx(1)) - vel_L(dir_idx(1)))) - vel_L(dir_idx(1)) = vel_L_tmp - vel_R(dir_idx(1)) = vel_R_tmp + vel_tmp%L = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + zcoef*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + vel_tmp%R = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + zcoef*(vel%R(dir_idx(1)) - vel%L(dir_idx(1)))) + vel%L(dir_idx(1)) = vel_tmp%L + vel%R(dir_idx(1)) = vel_tmp%R end if end if #:enddef compute_low_Mach_correction diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index b8f8a9225f..dd9965f0f2 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -144,37 +144,24 @@ contains #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R - real(wp), dimension(3) :: vel_L, vel_R real(wp), dimension(3) :: alpha_L, alpha_R real(wp), dimension(10) :: Ys_L, Ys_R real(wp), dimension(10) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR real(wp), dimension(10) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 #:else real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R - real(wp), dimension(num_vels) :: vel_L, vel_R real(wp), dimension(num_fluids) :: alpha_L, alpha_R real(wp), dimension(num_species) :: Ys_L, Ys_R real(wp), dimension(num_species) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR real(wp), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 #:endif - real(wp) :: rho_L, rho_R - real(wp) :: pres_L, pres_R - real(wp) :: E_L, E_R - real(wp) :: H_L, H_R + type(riemann_states_vec3) :: vel + type(riemann_states) :: rho, pres, E, H + type(riemann_states) :: T, Y, MW, R_gas, Cp, Cv, Gamm, gamma + type(riemann_states) :: pi_inf, qv, c, G, ptilde + type(riemann_states) :: vel_rms, vel_tmp real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi - real(wp) :: T_L, T_R - real(wp) :: Y_L, Y_R - real(wp) :: MW_L, MW_R - real(wp) :: R_gas_L, R_gas_R - real(wp) :: Cp_L, Cp_R - real(wp) :: Cv_L, Cv_R - real(wp) :: Gamm_L, Gamm_R - real(wp) :: gamma_L, gamma_R - real(wp) :: pi_inf_L, pi_inf_R - real(wp) :: qv_L, qv_R - real(wp) :: c_L, c_R real(wp), dimension(6) :: tau_e_L, tau_e_R - real(wp) :: G_L, G_R real(wp), dimension(2) :: Re_L, Re_R real(wp), dimension(3) :: xi_field_L, xi_field_R real(wp) :: rho_avg @@ -182,11 +169,9 @@ contains real(wp) :: qv_avg real(wp) :: gamma_avg real(wp) :: c_avg + real(wp) :: vel_avg_rms real(wp) :: s_L, s_R, s_M, s_P, s_S real(wp) :: xi_M, xi_P - real(wp) :: ptilde_L, ptilde_R - real(wp) :: vel_L_rms, vel_R_rms, vel_avg_rms - real(wp) :: vel_L_tmp, vel_R_tmp real(wp) :: Ms_L, Ms_R, pres_SL, pres_SR real(wp) :: alpha_L_sum, alpha_R_sum real(wp) :: zcoef, pcorr !< low Mach number correction @@ -211,14 +196,12 @@ contains #:set SV = STENCIL_VAR #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, & - & alpha_R, tau_e_L, tau_e_R, Re_L, Re_R, s_L, s_R, s_S, Ys_L, Ys_R, xi_field_L, xi_field_R, & - & Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, c_fast, & - & pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, vel_L_tmp, vel_R_tmp, rho_L, rho_R, & - & pres_L, pres_R, E_L, E_R, H_L, H_R, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, T_L, T_R, & - & Y_L, Y_R, MW_L, MW_R, R_gas_L, R_gas_R, Cp_L, Cp_R, Cv_L, Cv_R, Gamm_L, Gamm_R, gamma_L, & - & gamma_R, pi_inf_L, pi_inf_R, qv_L, qv_R, qv_avg, c_L, c_R, G_L, G_R, rho_avg, H_avg, c_avg, & - & gamma_avg, ptilde_L, ptilde_R, vel_L_rms, vel_R_rms, vel_avg_rms, Ms_L, Ms_R, pres_SL, & + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, & + & tau_e_L, tau_e_R, Re_L, Re_R, s_L, s_R, s_S, Ys_L, Ys_R, xi_field_L, xi_field_R, Cp_iL, & + & Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, c_fast, & + & pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, vel_tmp, rho, pres, E, H, Cp_avg, Cv_avg, & + & T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Cv, Gamm, gamma, pi_inf, qv, qv_avg, c, G, & + & rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, vel_avg_rms, Ms_L, Ms_R, pres_SL, & & pres_SR, alpha_L_sum, alpha_R_sum, flux_tau_L, flux_tau_R]', copyin='[norm_dir]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end @@ -229,14 +212,14 @@ contains alpha_rho_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - vel_L_rms = 0._wp; vel_R_rms = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do $:GPU_LOOP(parallelism='[seq]') @@ -245,8 +228,8 @@ contains alpha_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i) end do - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) if (mhd) then if (n == 0) then ! 1D: constant Bx; By, Bz as variables @@ -266,15 +249,15 @@ contains end if end if - rho_L = 0._wp - gamma_L = 0._wp - pi_inf_L = 0._wp - qv_L = 0._wp + rho%L = 0._wp + gamma%L = 0._wp + pi_inf%L = 0._wp + qv%L = 0._wp - rho_R = 0._wp - gamma_R = 0._wp - pi_inf_R = 0._wp - qv_R = 0._wp + rho%R = 0._wp + gamma%R = 0._wp + pi_inf%R = 0._wp + qv%R = 0._wp alpha_L_sum = 0._wp alpha_R_sum = 0._wp @@ -299,15 +282,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + alpha_rho_L(i) - gamma_L = gamma_L + alpha_L(i)*gammas(i) - pi_inf_L = pi_inf_L + alpha_L(i)*pi_infs(i) - qv_L = qv_L + alpha_rho_L(i)*qvs(i) - - rho_R = rho_R + alpha_rho_R(i) - gamma_R = gamma_R + alpha_R(i)*gammas(i) - pi_inf_R = pi_inf_R + alpha_R(i)*pi_infs(i) - qv_R = qv_R + alpha_rho_R(i)*qvs(i) + rho%L = rho%L + alpha_rho_L(i) + gamma%L = gamma%L + alpha_L(i)*gammas(i) + pi_inf%L = pi_inf%L + alpha_L(i)*pi_infs(i) + qv%L = qv%L + alpha_rho_L(i)*qvs(i) + + rho%R = rho%R + alpha_rho_R(i) + gamma%R = gamma%R + alpha_R(i)*gammas(i) + pi_inf%R = pi_inf%R + alpha_R(i)*pi_infs(i) + qv%R = qv%R + alpha_rho_R(i)*qvs(i) end do if (viscous) then @@ -337,60 +320,60 @@ contains Ys_R(i - eqn_idx%species%beg + 1) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - call get_mixture_molecular_weight(Ys_L, MW_L) - call get_mixture_molecular_weight(Ys_R, MW_R) + call get_mixture_molecular_weight(Ys_L, MW%L) + call get_mixture_molecular_weight(Ys_R, MW%R) #:if USING_AMD - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:) #:else - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:) #:endif - R_gas_L = gas_constant/MW_L - R_gas_R = gas_constant/MW_R - T_L = pres_L/rho_L/R_gas_L - T_R = pres_R/rho_R/R_gas_R + R_gas%L = gas_constant/MW%L + R_gas%R = gas_constant/MW%R + T%L = pres%L/rho%L/R_gas%L + T%R = pres%R/rho%R/R_gas%R - call get_species_specific_heats_r(T_L, Cp_iL) - call get_species_specific_heats_r(T_R, Cp_iR) + call get_species_specific_heats_r(T%L, Cp_iL) + call get_species_specific_heats_r(T%R, Cp_iR) if (chem_params%gamma_method == 1) then ! gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. Gamma_iL = Cp_iL/(Cp_iL - 1.0_wp) Gamma_iR = Cp_iR/(Cp_iR - 1.0_wp) - gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) - gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) + gamma%L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) + gamma%R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) else if (chem_params%gamma_method == 2) then ! gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. - call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) - call get_mixture_specific_heat_cp_mass(T_R, Ys_R, Cp_R) - call get_mixture_specific_heat_cv_mass(T_L, Ys_L, Cv_L) - call get_mixture_specific_heat_cv_mass(T_R, Ys_R, Cv_R) - - Gamm_L = Cp_L/Cv_L - gamma_L = 1.0_wp/(Gamm_L - 1.0_wp) - Gamm_R = Cp_R/Cv_R - gamma_R = 1.0_wp/(Gamm_R - 1.0_wp) + call get_mixture_specific_heat_cp_mass(T%L, Ys_L, Cp%L) + call get_mixture_specific_heat_cp_mass(T%R, Ys_R, Cp%R) + call get_mixture_specific_heat_cv_mass(T%L, Ys_L, Cv%L) + call get_mixture_specific_heat_cv_mass(T%R, Ys_R, Cv%R) + + Gamm%L = Cp%L/Cv%L + gamma%L = 1.0_wp/(Gamm%L - 1.0_wp) + Gamm%R = Cp%R/Cv%R + gamma%R = 1.0_wp/(Gamm%R - 1.0_wp) end if - call get_mixture_energy_mass(T_L, Ys_L, E_L) - call get_mixture_energy_mass(T_R, Ys_R, E_R) + call get_mixture_energy_mass(T%L, Ys_L, E%L) + call get_mixture_energy_mass(T%R, Ys_R, E%R) - E_L = rho_L*E_L + 5.e-1*rho_L*vel_L_rms - E_R = rho_R*E_R + 5.e-1*rho_R*vel_R_rms - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + E%L = rho%L*E%L + 5.e-1*rho%L*vel_rms%L + E%R = rho%R*E%R + 5.e-1*rho%R*vel_rms%R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R else if (mhd .and. relativity) then - Ga%L = 1._wp/sqrt(1._wp - vel_L_rms) - Ga%R = 1._wp/sqrt(1._wp - vel_R_rms) + Ga%L = 1._wp/sqrt(1._wp - vel_rms%L) + Ga%R = 1._wp/sqrt(1._wp - vel_rms%R) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 - vdotB%L = vel_L(1)*B%L(1) + vel_L(2)*B%L(2) + vel_L(3)*B%L(3) - vdotB%R = vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3) + vdotB%L = vel%L(1)*B%L(1) + vel%L(2)*B%L(2) + vel%L(3)*B%L(3) + vdotB%R = vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3) - b4%L(1:3) = B%L(1:3)/Ga%L + Ga%L*vel_L(1:3)*vdotB%L - b4%R(1:3) = B%R(1:3)/Ga%R + Ga%R*vel_R(1:3)*vdotB%R + b4%L(1:3) = B%L(1:3)/Ga%L + Ga%L*vel%L(1:3)*vdotB%L + b4%R(1:3) = B%R(1:3)/Ga%R + Ga%R*vel%R(1:3)*vdotB%R B2%L = B%L(1)**2._wp + B%L(2)**2._wp + B%L(3)**2._wp B2%R = B%R(1)**2._wp + B%R(2)**2._wp + B%R(3)**2._wp #:endif @@ -399,46 +382,46 @@ contains pres_mag%R = 0.5_wp*(B2%R/Ga%R**2._wp + vdotB%R**2._wp) ! Hard-coded EOS - H_L = 1._wp + (gamma_L + 1)*pres_L/rho_L - H_R = 1._wp + (gamma_R + 1)*pres_R/rho_R + H%L = 1._wp + (gamma%L + 1)*pres%L/rho%L + H%R = 1._wp + (gamma%R + 1)*pres%R/rho%R #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 - cm%L(1:3) = (rho_L*H_L*Ga%L**2 + B2%L)*vel_L(1:3) - vdotB%L*B%L(1:3) - cm%R(1:3) = (rho_R*H_R*Ga%R**2 + B2%R)*vel_R(1:3) - vdotB%R*B%R(1:3) + cm%L(1:3) = (rho%L*H%L*Ga%L**2 + B2%L)*vel%L(1:3) - vdotB%L*B%L(1:3) + cm%R(1:3) = (rho%R*H%R*Ga%R**2 + B2%R)*vel%R(1:3) - vdotB%R*B%R(1:3) #:endif - E_L = rho_L*H_L*Ga%L**2 - pres_L + 0.5_wp*(B2%L + vel_L_rms*B2%L - vdotB%L**2._wp) - rho_L*Ga%L - E_R = rho_R*H_R*Ga%R**2 - pres_R + 0.5_wp*(B2%R + vel_R_rms*B2%R - vdotB%R**2._wp) - rho_R*Ga%R + E%L = rho%L*H%L*Ga%L**2 - pres%L + 0.5_wp*(B2%L + vel_rms%L*B2%L - vdotB%L**2._wp) - rho%L*Ga%L + E%R = rho%R*H%R*Ga%R**2 - pres%R + 0.5_wp*(B2%R + vel_rms%R*B2%R - vdotB%R**2._wp) - rho%R*Ga%R else if (mhd .and. .not. relativity) then #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 pres_mag%L = 0.5_wp*(B%L(1)**2._wp + B%L(2)**2._wp + B%L(3)**2._wp) pres_mag%R = 0.5_wp*(B%R(1)**2._wp + B%R(2)**2._wp + B%R(3)**2._wp) #:endif - E_L = gamma_L*pres_L + pi_inf_L + 0.5_wp*rho_L*vel_L_rms + qv_L + pres_mag%L + E%L = gamma%L*pres%L + pi_inf%L + 0.5_wp*rho%L*vel_rms%L + qv%L + pres_mag%L ! includes magnetic energy - E_R = gamma_R*pres_R + pi_inf_R + 0.5_wp*rho_R*vel_R_rms + qv_R + pres_mag%R - H_L = (E_L + pres_L - pres_mag%L)/rho_L + E%R = gamma%R*pres%R + pi_inf%R + 0.5_wp*rho%R*vel_rms%R + qv%R + pres_mag%R + H%L = (E%L + pres%L - pres_mag%L)/rho%L ! stagnation enthalpy here excludes magnetic energy (only used to find speed of sound) - H_R = (E_R + pres_R - pres_mag%R)/rho_R + H%R = (E%R + pres%R - pres_mag%R)/rho%R else - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1*rho_R*vel_R_rms + qv_R - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1*rho%L*vel_rms%L + qv%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1*rho%R*vel_rms%R + qv%R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R end if ! elastic energy update if (hypoelasticity) then - G_L = 0._wp; G_R = 0._wp + G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do if (cont_damage) then - G_L = G_L*max((1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) - G_R = G_R*max((1._wp - qR_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) + G%L = G%L*max((1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) + G%R = G%R*max((1._wp - qR_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) end if $:GPU_LOOP(parallelism='[seq]') @@ -446,13 +429,13 @@ contains tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) ! Elastic contribution to energy if G large enough TODO take out if statement if stable without - if ((G_L > 1000) .and. (G_R > 1000)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + if ((G%L > 1000) .and. (G%R > 1000)) then + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) ! Double for shear stresses if (any(eqn_idx%stress%beg - 1 + i == shear_indices)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) end if end if end do @@ -460,26 +443,26 @@ contains @:compute_average_state() - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, c_L, & - & qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, c%L, & + & qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, c_R, & - & qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, c%R, & + & qv%R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. - call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, vel_avg_rms, & + call s_compute_speed_of_sound(pres%R, rho_avg, gamma_avg, pi_inf%R, H_avg, alpha_R, vel_avg_rms, & & c_sum_Yi_Phi, c_avg, qv_avg) if (mhd) then - call s_compute_fast_magnetosonic_speed(rho_L, c_L, B%L, norm_dir, c_fast%L, H_L) - call s_compute_fast_magnetosonic_speed(rho_R, c_R, B%R, norm_dir, c_fast%R, H_R) + call s_compute_fast_magnetosonic_speed(rho%L, c%L, B%L, norm_dir, c_fast%L, H%L) + call s_compute_fast_magnetosonic_speed(rho%R, c%R, B%R, norm_dir, c_fast%R, H%R) end if if (viscous) then if (chemistry) then - call compute_viscosity_and_inversion(T_L, Ys_L, T_R, Ys_R, Re_L(1), Re_R(1)) + call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re_L(1), Re_R(1)) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 @@ -491,26 +474,26 @@ contains if (wave_speeds == 1) then if (mhd) then ! MHD: use fast magnetosonic speed - s_L = min(vel_L(dir_idx(1)) - c_fast%L, vel_R(dir_idx(1)) - c_fast%R) - s_R = max(vel_R(dir_idx(1)) + c_fast%R, vel_L(dir_idx(1)) + c_fast%L) + s_L = min(vel%L(dir_idx(1)) - c_fast%L, vel%R(dir_idx(1)) - c_fast%R) + s_R = max(vel%R(dir_idx(1)) + c_fast%R, vel%L(dir_idx(1)) + c_fast%L) else if (hypoelasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) + tau_e_L(dir_idx_tau(1))) & - & /rho_L), & - & vel_R(dir_idx(1)) - sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) + tau_e_R(dir_idx_tau(1))) & - & /rho_R)) - s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) + tau_e_R(dir_idx_tau(1))) & - & /rho_R), & - & vel_L(dir_idx(1)) + sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) + tau_e_L(dir_idx_tau(1))) & - & /rho_L)) + s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1))) & + & /rho%L), & + & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1))) & + & /rho%R)) + s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1))) & + & /rho%R), & + & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1))) & + & /rho%L)) else if (hyperelasticity) then - s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L), & - & vel_R(dir_idx(1)) - sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R)) - s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + (4._wp*G_R/3._wp)/rho_R), & - & vel_L(dir_idx(1)) + sqrt(c_L*c_L + (4._wp*G_L/3._wp)/rho_L)) + s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (4._wp*G%L/3._wp)/rho%L), & + & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (4._wp*G%R/3._wp)/rho%R)) + s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (4._wp*G%R/3._wp)/rho%R), & + & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (4._wp*G%L/3._wp)/rho%L)) else - s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) - s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L) + s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) end if if (hyper_cleaning) then @@ -519,26 +502,26 @@ contains s_R = max(s_R, hyper_cleaning_speed) end if - s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) & - & - rho_R*vel_R(dir_idx(1))*(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L - vel_L(dir_idx(1))) & - & - rho_R*(s_R - vel_R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & + & - rho%R*(s_R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres_L + pres_R + rho_avg*c_avg*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) pres_SR = pres_SL ! Low Mach correction: Thornber et al. JCP (2008) Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_L)/(1._wp + gamma_L))*(pres_SL/pres_L - 1._wp) & - & *pres_L/((pres_L + pi_inf_L/(1._wp + gamma_L))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_R)/(1._wp + gamma_R))*(pres_SR/pres_R - 1._wp) & - & *pres_R/((pres_R + pi_inf_R/(1._wp + gamma_R))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel_L(dir_idx(1)) - c_L*Ms_L - s_R = vel_R(dir_idx(1)) + c_R*Ms_R + s_L = vel%L(dir_idx(1)) - c%L*Ms_L + s_R = vel%R(dir_idx(1)) + c%R*Ms_R - s_S = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + (pres_L - pres_R)/(rho_avg*c_avg)) + s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) @@ -560,15 +543,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = (s_M*alpha_rho_R(i)*vel_R(norm_dir) - s_P*alpha_rho_L(i)*vel_L(norm_dir) & + & i) = (s_M*alpha_rho_R(i)*vel%R(norm_dir) - s_P*alpha_rho_L(i)*vel%L(norm_dir) & & + s_M*s_P*(alpha_rho_L(i) - alpha_rho_R(i)))/(s_M - s_P) end do else if (relativity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = (s_M*Ga%R*alpha_rho_R(i)*vel_R(norm_dir) - s_P*Ga%L*alpha_rho_L(i) & - & *vel_L(norm_dir) + s_M*s_P*(Ga%L*alpha_rho_L(i) - Ga%R*alpha_rho_R(i)))/(s_M & + & i) = (s_M*Ga%R*alpha_rho_R(i)*vel%R(norm_dir) - s_P*Ga%L*alpha_rho_L(i) & + & *vel%L(norm_dir) + s_M*s_P*(Ga%L*alpha_rho_L(i) - Ga%R*alpha_rho_R(i)))/(s_M & & - s_P) end do end if @@ -580,10 +563,10 @@ contains ! Flux of rho*v_i in the ${XYZ}$ direction = rho * v_i * v_${XYZ}$ - B_i * B_${XYZ}$ + ! delta_(${XYZ}$,i) * p_tot flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + i) = (s_M*(rho_R*vel_R(i)*vel_R(norm_dir) - B%R(i) & - & *B%R(norm_dir) + dir_flg(i)*(pres_R + pres_mag%R)) - s_P*(rho_L*vel_L(i) & - & *vel_L(norm_dir) - B%L(i)*B%L(norm_dir) + dir_flg(i)*(pres_L + pres_mag%L)) & - & + s_M*s_P*(rho_L*vel_L(i) - rho_R*vel_R(i)))/(s_M - s_P) + & eqn_idx%cont%end + i) = (s_M*(rho%R*vel%R(i)*vel%R(norm_dir) - B%R(i) & + & *B%R(norm_dir) + dir_flg(i)*(pres%R + pres_mag%R)) - s_P*(rho%L*vel%L(i) & + & *vel%L(norm_dir) - B%L(i)*B%L(norm_dir) + dir_flg(i)*(pres%L + pres_mag%L)) & + & + s_M*s_P*(rho%L*vel%L(i) - rho%R*vel%R(i)))/(s_M - s_P) end do else if (mhd .and. relativity) then $:GPU_LOOP(parallelism='[seq]') @@ -591,40 +574,40 @@ contains ! Flux of m_i in the ${XYZ}$ direction = m_i * v_${XYZ}$ - b_i/Gamma * B_${XYZ}$ + ! delta_(${XYZ}$,i) * p_tot flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + i) = (s_M*(cm%R(i)*vel_R(norm_dir) - b4%R(i) & - & /Ga%R*B%R(norm_dir) + dir_flg(i)*(pres_R + pres_mag%R)) - s_P*(cm%L(i) & - & *vel_L(norm_dir) - b4%L(i)/Ga%L*B%L(norm_dir) + dir_flg(i)*(pres_L + pres_mag%L) & + & eqn_idx%cont%end + i) = (s_M*(cm%R(i)*vel%R(norm_dir) - b4%R(i) & + & /Ga%R*B%R(norm_dir) + dir_flg(i)*(pres%R + pres_mag%R)) - s_P*(cm%L(i) & + & *vel%L(norm_dir) - b4%L(i)/Ga%L*B%L(norm_dir) + dir_flg(i)*(pres%L + pres_mag%L) & & ) + s_M*s_P*(cm%L(i) - cm%R(i)))/(s_M - s_P) end do else if (bubbles_euler) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*(pres_R - ptilde_R)) - s_P*(rho_L*vel_L(dir_idx(1)) & - & *vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres_L - ptilde_L)) & - & + s_M*s_P*(rho_L*vel_L(dir_idx(i)) - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) & - & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_R(dir_idx(i)) - vel_L(dir_idx(i))) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*(pres%R - ptilde%R)) - s_P*(rho%L*vel%L(dir_idx(1)) & + & *vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres%L - ptilde%L)) & + & + s_M*s_P*(rho%L*vel%L(dir_idx(i)) - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) & + & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do else if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_R - tau_e_R(dir_idx_tau(i))) & - & - s_P*(rho_L*vel_L(dir_idx(1))*vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*pres_L & - & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho_L*vel_L(dir_idx(i)) & - & - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%R - tau_e_R(dir_idx_tau(i))) & + & - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*pres%L & + & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) end do else $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_R) - s_P*(rho_L*vel_L(dir_idx(1))*vel_L(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_L) + s_M*s_P*(rho_L*vel_L(dir_idx(i)) & - & - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & - & *pcorr*(vel_R(dir_idx(i)) - vel_L(dir_idx(i))) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%R) - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%L) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & *pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do end if @@ -633,47 +616,47 @@ contains ! energy flux = (E + p + p_mag) * v_${XYZ}$ - B_${XYZ}$ * (v_x*B_x + v_y*B_y + v_z*B_z) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel_R(norm_dir)*(E_R + pres_R + pres_mag%R) - B%R(norm_dir) & - & *(vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3))) - s_P*(vel_L(norm_dir) & - & *(E_L + pres_L + pres_mag%L) - B%L(norm_dir)*(vel_L(1)*B%L(1) + vel_L(2)*B%L(2) & - & + vel_L(3)*B%L(3))) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + & eqn_idx%E) = (s_M*(vel%R(norm_dir)*(E%R + pres%R + pres_mag%R) - B%R(norm_dir) & + & *(vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3))) - s_P*(vel%L(norm_dir) & + & *(E%L + pres%L + pres_mag%L) - B%L(norm_dir)*(vel%L(1)*B%L(1) + vel%L(2)*B%L(2) & + & + vel%L(3)*B%L(3))) + s_M*s_P*(E%L - E%R))/(s_M - s_P) #:endif else if (mhd .and. relativity) then ! energy flux = m_${XYZ}$ - mass flux Hard-coded for single-component for now flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(cm%R(norm_dir) - Ga%R*alpha_rho_R(1)*vel_R(norm_dir)) & - & - s_P*(cm%L(norm_dir) - Ga%L*alpha_rho_L(1)*vel_L(norm_dir)) + s_M*s_P*(E_L - E_R)) & + & eqn_idx%E) = (s_M*(cm%R(norm_dir) - Ga%R*alpha_rho_R(1)*vel%R(norm_dir)) & + & - s_P*(cm%L(norm_dir) - Ga%L*alpha_rho_L(1)*vel%L(norm_dir)) + s_M*s_P*(E%L - E%R)) & & /(s_M - s_P) else if (bubbles_euler) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*vel_R(dir_idx(1))*(E_R + pres_R - ptilde_R) - s_P*vel_L(dir_idx(1) & - & )*(E_L + pres_L - ptilde_L) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & - & *pcorr*(vel_R_rms - vel_L_rms)/2._wp + & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R - ptilde%R) - s_P*vel%L(dir_idx(1) & + & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & *pcorr*(vel_rms%R - vel_rms%L)/2._wp else if (hypoelasticity) then flux_tau_L = 0._wp; flux_tau_R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel_L(dir_idx(i)) - flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel_R(dir_idx(i)) + flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel%L(dir_idx(i)) + flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel%R(dir_idx(i)) end do flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel_R(dir_idx(1))*(E_R + pres_R) - flux_tau_R) & - & - s_P*(vel_L(dir_idx(1))*(E_L + pres_L) - flux_tau_L) + s_M*s_P*(E_L - E_R))/(s_M & + & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau_R) & + & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau_L) + s_M*s_P*(E%L - E%R))/(s_M & & - s_P) else flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*vel_R(dir_idx(1))*(E_R + pres_R) - s_P*vel_L(dir_idx(1))*(E_L & - & + pres_L) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_R_rms & - & - vel_L_rms)/2._wp + & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R) - s_P*vel%L(dir_idx(1))*(E%L & + & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_rms%R & + & - vel_rms%L)/2._wp end if ! Elastic Stresses if (hypoelasticity) then do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! TODO: this indexing may be slow flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = (s_M*(rho_R*vel_R(dir_idx(1))*tau_e_R(i)) & - & - s_P*(rho_L*vel_L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho_L*tau_e_L(i) & - & - rho_R*tau_e_R(i)))/(s_M - s_P) + & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e_R(i)) & + & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho%L*tau_e_L(i) & + & - rho%R*tau_e_R(i)))/(s_M - s_P) end do end if @@ -696,12 +679,12 @@ contains if (chemistry) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - Y_L = qL_prim_rsx_vf(${SF('')}$, i) - Y_R = qR_prim_rsx_vf(${SF(' + 1')}$, i) + Y%L = qL_prim_rsx_vf(${SF('')}$, i) + Y%R = qR_prim_rsx_vf(${SF(' + 1')}$, i) flux_rsx_vf(${SF('')}$, & - & i) = (s_M*Y_R*rho_R*vel_R(dir_idx(1)) - s_P*Y_L*rho_L*vel_L(dir_idx(1)) & - & + s_M*s_P*(Y_L*rho_L - Y_R*rho_R))/(s_M - s_P) + & i) = (s_M*Y%R*rho%R*vel%R(dir_idx(1)) - s_P*Y%L*rho%L*vel%L(dir_idx(1)) & + & + s_M*s_P*(Y%L*rho%L - Y%R*rho%R))/(s_M - s_P) flux_src_rsx_vf(${SF('')}$, i) = 0._wp end do end if @@ -713,8 +696,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 0, 1 flux_rsx_vf(j, k, l, & - & eqn_idx%B%beg + i) = (s_M*(vel_R(1)*B%R(2 + i) - vel_R(2 + i)*Bx0) & - & - s_P*(vel_L(1)*B%L(2 + i) - vel_L(2 + i)*Bx0) + s_M*s_P*(B%L(2 + i) & + & eqn_idx%B%beg + i) = (s_M*(vel%R(1)*B%R(2 + i) - vel%R(2 + i)*Bx0) & + & - s_P*(vel%L(1)*B%L(2 + i) - vel%L(2 + i)*Bx0) + s_M*s_P*(B%L(2 + i) & & - B%R(2 + i)))/(s_M - s_P) end do else ! 2D/3D: Bx, By, Bz /= const. but zero flux component in the same direction @@ -724,8 +707,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 0, 2 flux_rsx_vf(${SF('')}$, & - & eqn_idx%B%beg + i) = (s_M*(vel_R(dir_idx(1))*B%R(i + 1) - vel_R(i + 1) & - & *B%R(norm_dir)) - s_P*(vel_L(dir_idx(1))*B%L(i + 1) - vel_L(i + 1) & + & eqn_idx%B%beg + i) = (s_M*(vel%R(dir_idx(1))*B%R(i + 1) - vel%R(i + 1) & + & *B%R(norm_dir)) - s_P*(vel%L(dir_idx(1))*B%L(i + 1) - vel%L(i + 1) & & *B%L(norm_dir)) + s_M*s_P*(B%L(i + 1) - B%R(i + 1)))/(s_M - s_P) end do @@ -756,7 +739,7 @@ contains end do ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%cont%end + 2) = flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + 2) - (s_M*pres_R - s_P*pres_L)/(s_M - s_P) + & eqn_idx%cont%end + 2) - (s_M*pres%R - s_P*pres%L)/(s_M - s_P) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end @@ -830,7 +813,6 @@ contains #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R - real(wp), dimension(3) :: vel_L, vel_R real(wp), dimension(3) :: alpha_L, alpha_R real(wp), dimension(10) :: Ys_L, Ys_R real(wp), dimension(10) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR @@ -838,7 +820,6 @@ contains real(wp), dimension(3, 3) :: vel_grad_L, vel_grad_R !< Averaged velocity gradient tensor `d(vel_i)/d(coord_j)`. #:else real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R - real(wp), dimension(num_vels) :: vel_L, vel_R real(wp), dimension(num_fluids) :: alpha_L, alpha_R real(wp), dimension(num_species) :: Ys_L, Ys_R real(wp), dimension(num_species) :: Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR @@ -846,35 +827,23 @@ contains !> Averaged velocity gradient tensor `d(vel_i)/d(coord_j)`. real(wp), dimension(num_dims, num_dims) :: vel_grad_L, vel_grad_R #:endif - real(wp) :: rho_L, rho_R - real(wp) :: pres_L, pres_R - real(wp) :: E_L, E_R - real(wp) :: H_L, H_R + type(riemann_states_vec3) :: vel + type(riemann_states) :: rho, pres, E, H + type(riemann_states) :: T, Y, MW, R_gas, Cp, Cv, Gamm, gamma + type(riemann_states) :: pi_inf, qv, c, G, ptilde + type(riemann_states) :: vel_rms, vel_tmp real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi - real(wp) :: T_L, T_R - real(wp) :: Y_L, Y_R - real(wp) :: MW_L, MW_R - real(wp) :: R_gas_L, R_gas_R - real(wp) :: Cp_L, Cp_R - real(wp) :: Cv_L, Cv_R - real(wp) :: Gamm_L, Gamm_R - real(wp) :: gamma_L, gamma_R - real(wp) :: pi_inf_L, pi_inf_R - real(wp) :: qv_L, qv_R - real(wp) :: c_L, c_R real(wp), dimension(6) :: tau_e_L, tau_e_R - real(wp) :: G_L, G_R real(wp), dimension(2) :: Re_L, Re_R real(wp), dimension(3) :: xi_field_L, xi_field_R real(wp) :: rho_avg real(wp) :: H_avg + real(wp) :: qv_avg real(wp) :: gamma_avg real(wp) :: c_avg + real(wp) :: vel_avg_rms real(wp) :: s_L, s_R, s_M, s_P, s_S real(wp) :: xi_M, xi_P - real(wp) :: ptilde_L, ptilde_R - real(wp) :: vel_L_rms, vel_R_rms, vel_avg_rms - real(wp) :: vel_L_tmp, vel_R_tmp real(wp) :: Ms_L, Ms_R, pres_SL, pres_SR real(wp) :: alpha_L_sum, alpha_R_sum real(wp) :: zcoef, pcorr !< low Mach number correction @@ -900,15 +869,13 @@ contains #:set SV = STENCIL_VAR #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, & - & alpha_R, tau_e_L, tau_e_R, G_L, G_R, Re_L, Re_R, rho_avg, h_avg, gamma_avg, s_L, s_R, s_S, & - & Ys_L, Ys_R, xi_field_L, xi_field_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, & - & Phi_avg, h_iL, h_iR, h_avg_2, c_fast, pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, & - & vel_grad_L, vel_grad_R, idx_right_phys, vel_L_rms, vel_R_rms, vel_avg_rms, vel_L_tmp, & - & vel_R_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, c_avg, pres_L, pres_R, & - & rho_L, rho_R, gamma_L, gamma_R, pi_inf_L, pi_inf_R, qv_L, qv_R, c_L, c_R, E_L, E_R, H_L, & - & H_R, ptilde_L, ptilde_R, s_M, s_P, xi_M, xi_P, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, & - & Cp_L, Cp_R, Cv_L, Cv_R, R_gas_L, R_gas_R, MW_L, MW_R, T_L, T_R, Y_L, Y_R]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, & + & tau_e_L, tau_e_R, G, Re_L, Re_R, rho_avg, h_avg, gamma_avg, s_L, s_R, s_S, Ys_L, Ys_R, & + & xi_field_L, xi_field_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, & + & h_iL, h_iR, h_avg_2, c_fast, pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, vel_grad_L, & + & vel_grad_R, idx_right_phys, vel_rms, vel_avg_rms, vel_tmp, Ms_L, Ms_R, pres_SL, pres_SR, & + & alpha_L_sum, alpha_R_sum, c_avg, pres, rho, gamma, pi_inf, qv, c, E, H, ptilde, s_M, s_P, & + & xi_M, xi_P, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, Cp, Cv, R_gas, MW, T, Y]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -918,14 +885,14 @@ contains alpha_rho_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - vel_L_rms = 0._wp; vel_R_rms = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do $:GPU_LOOP(parallelism='[seq]') @@ -934,8 +901,8 @@ contains alpha_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i) end do - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) if (mhd) then if (n == 0) then ! 1D: constant Bx; By, Bz as variables @@ -955,15 +922,15 @@ contains end if end if - rho_L = 0._wp - gamma_L = 0._wp - pi_inf_L = 0._wp - qv_L = 0._wp + rho%L = 0._wp + gamma%L = 0._wp + pi_inf%L = 0._wp + qv%L = 0._wp - rho_R = 0._wp - gamma_R = 0._wp - pi_inf_R = 0._wp - qv_R = 0._wp + rho%R = 0._wp + gamma%R = 0._wp + pi_inf%R = 0._wp + qv%R = 0._wp alpha_L_sum = 0._wp alpha_R_sum = 0._wp @@ -988,15 +955,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + alpha_rho_L(i) - gamma_L = gamma_L + alpha_L(i)*gammas(i) - pi_inf_L = pi_inf_L + alpha_L(i)*pi_infs(i) - qv_L = qv_L + alpha_rho_L(i)*qvs(i) - - rho_R = rho_R + alpha_rho_R(i) - gamma_R = gamma_R + alpha_R(i)*gammas(i) - pi_inf_R = pi_inf_R + alpha_R(i)*pi_infs(i) - qv_R = qv_R + alpha_rho_R(i)*qvs(i) + rho%L = rho%L + alpha_rho_L(i) + gamma%L = gamma%L + alpha_L(i)*gammas(i) + pi_inf%L = pi_inf%L + alpha_L(i)*pi_infs(i) + qv%L = qv%L + alpha_rho_L(i)*qvs(i) + + rho%R = rho%R + alpha_rho_R(i) + gamma%R = gamma%R + alpha_R(i)*gammas(i) + pi_inf%R = pi_inf%R + alpha_R(i)*pi_infs(i) + qv%R = qv%R + alpha_rho_R(i)*qvs(i) end do if (viscous) then @@ -1026,61 +993,61 @@ contains Ys_R(i - eqn_idx%species%beg + 1) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - call get_mixture_molecular_weight(Ys_L, MW_L) - call get_mixture_molecular_weight(Ys_R, MW_R) + call get_mixture_molecular_weight(Ys_L, MW%L) + call get_mixture_molecular_weight(Ys_R, MW%R) #:if USING_AMD - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:) #:else - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:) #:endif - R_gas_L = gas_constant/MW_L - R_gas_R = gas_constant/MW_R - T_L = pres_L/rho_L/R_gas_L - T_R = pres_R/rho_R/R_gas_R + R_gas%L = gas_constant/MW%L + R_gas%R = gas_constant/MW%R + T%L = pres%L/rho%L/R_gas%L + T%R = pres%R/rho%R/R_gas%R - call get_species_specific_heats_r(T_L, Cp_iL) - call get_species_specific_heats_r(T_R, Cp_iR) + call get_species_specific_heats_r(T%L, Cp_iL) + call get_species_specific_heats_r(T%R, Cp_iR) if (chem_params%gamma_method == 1) then ! gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. Gamma_iL = Cp_iL/(Cp_iL - 1.0_wp) Gamma_iR = Cp_iR/(Cp_iR - 1.0_wp) - gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) - gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) + gamma%L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) + gamma%R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) else if (chem_params%gamma_method == 2) then ! gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. - call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) - call get_mixture_specific_heat_cp_mass(T_R, Ys_R, Cp_R) - call get_mixture_specific_heat_cv_mass(T_L, Ys_L, Cv_L) - call get_mixture_specific_heat_cv_mass(T_R, Ys_R, Cv_R) - - Gamm_L = Cp_L/Cv_L - gamma_L = 1.0_wp/(Gamm_L - 1.0_wp) - Gamm_R = Cp_R/Cv_R - gamma_R = 1.0_wp/(Gamm_R - 1.0_wp) + call get_mixture_specific_heat_cp_mass(T%L, Ys_L, Cp%L) + call get_mixture_specific_heat_cp_mass(T%R, Ys_R, Cp%R) + call get_mixture_specific_heat_cv_mass(T%L, Ys_L, Cv%L) + call get_mixture_specific_heat_cv_mass(T%R, Ys_R, Cv%R) + + Gamm%L = Cp%L/Cv%L + gamma%L = 1.0_wp/(Gamm%L - 1.0_wp) + Gamm%R = Cp%R/Cv%R + gamma%R = 1.0_wp/(Gamm%R - 1.0_wp) end if - call get_mixture_energy_mass(T_L, Ys_L, E_L) - call get_mixture_energy_mass(T_R, Ys_R, E_R) + call get_mixture_energy_mass(T%L, Ys_L, E%L) + call get_mixture_energy_mass(T%R, Ys_R, E%R) - E_L = rho_L*E_L + 5.e-1*rho_L*vel_L_rms - E_R = rho_R*E_R + 5.e-1*rho_R*vel_R_rms - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + E%L = rho%L*E%L + 5.e-1*rho%L*vel_rms%L + E%R = rho%R*E%R + 5.e-1*rho%R*vel_rms%R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R else if (mhd .and. relativity) then #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 - Ga%L = 1._wp/sqrt(1._wp - vel_L_rms) - Ga%R = 1._wp/sqrt(1._wp - vel_R_rms) - vdotB%L = vel_L(1)*B%L(1) + vel_L(2)*B%L(2) + vel_L(3)*B%L(3) - vdotB%R = vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3) + Ga%L = 1._wp/sqrt(1._wp - vel_rms%L) + Ga%R = 1._wp/sqrt(1._wp - vel_rms%R) + vdotB%L = vel%L(1)*B%L(1) + vel%L(2)*B%L(2) + vel%L(3)*B%L(3) + vdotB%R = vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3) - b4%L(1:3) = B%L(1:3)/Ga%L + Ga%L*vel_L(1:3)*vdotB%L - b4%R(1:3) = B%R(1:3)/Ga%R + Ga%R*vel_R(1:3)*vdotB%R + b4%L(1:3) = B%L(1:3)/Ga%L + Ga%L*vel%L(1:3)*vdotB%L + b4%R(1:3) = B%R(1:3)/Ga%R + Ga%R*vel%R(1:3)*vdotB%R B2%L = B%L(1)**2._wp + B%L(2)**2._wp + B%L(3)**2._wp B2%R = B%R(1)**2._wp + B%R(2)**2._wp + B%R(3)**2._wp @@ -1088,85 +1055,85 @@ contains pres_mag%R = 0.5_wp*(B2%R/Ga%R**2._wp + vdotB%R**2._wp) ! Hard-coded EOS - H_L = 1._wp + (gamma_L + 1)*pres_L/rho_L - H_R = 1._wp + (gamma_R + 1)*pres_R/rho_R + H%L = 1._wp + (gamma%L + 1)*pres%L/rho%L + H%R = 1._wp + (gamma%R + 1)*pres%R/rho%R - cm%L(1:3) = (rho_L*H_L*Ga%L**2 + B2%L)*vel_L(1:3) - vdotB%L*B%L(1:3) - cm%R(1:3) = (rho_R*H_R*Ga%R**2 + B2%R)*vel_R(1:3) - vdotB%R*B%R(1:3) + cm%L(1:3) = (rho%L*H%L*Ga%L**2 + B2%L)*vel%L(1:3) - vdotB%L*B%L(1:3) + cm%R(1:3) = (rho%R*H%R*Ga%R**2 + B2%R)*vel%R(1:3) - vdotB%R*B%R(1:3) - E_L = rho_L*H_L*Ga%L**2 - pres_L + 0.5_wp*(B2%L + vel_L_rms*B2%L - vdotB%L**2._wp) - rho_L*Ga%L - E_R = rho_R*H_R*Ga%R**2 - pres_R + 0.5_wp*(B2%R + vel_R_rms*B2%R - vdotB%R**2._wp) - rho_R*Ga%R + E%L = rho%L*H%L*Ga%L**2 - pres%L + 0.5_wp*(B2%L + vel_rms%L*B2%L - vdotB%L**2._wp) - rho%L*Ga%L + E%R = rho%R*H%R*Ga%R**2 - pres%R + 0.5_wp*(B2%R + vel_rms%R*B2%R - vdotB%R**2._wp) - rho%R*Ga%R #:endif else if (mhd .and. .not. relativity) then pres_mag%L = 0.5_wp*(B%L(1)**2._wp + B%L(2)**2._wp + B%L(3)**2._wp) pres_mag%R = 0.5_wp*(B%R(1)**2._wp + B%R(2)**2._wp + B%R(3)**2._wp) - E_L = gamma_L*pres_L + pi_inf_L + 0.5_wp*rho_L*vel_L_rms + qv_L + pres_mag%L + E%L = gamma%L*pres%L + pi_inf%L + 0.5_wp*rho%L*vel_rms%L + qv%L + pres_mag%L ! includes magnetic energy - E_R = gamma_R*pres_R + pi_inf_R + 0.5_wp*rho_R*vel_R_rms + qv_R + pres_mag%R - H_L = (E_L + pres_L - pres_mag%L)/rho_L + E%R = gamma%R*pres%R + pi_inf%R + 0.5_wp*rho%R*vel_rms%R + qv%R + pres_mag%R + H%L = (E%L + pres%L - pres_mag%L)/rho%L ! stagnation enthalpy here excludes magnetic energy (only used to find speed of sound) - H_R = (E_R + pres_R - pres_mag%R)/rho_R + H%R = (E%R + pres%R - pres_mag%R)/rho%R else - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1*rho_R*vel_R_rms + qv_R - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1*rho%L*vel_rms%L + qv%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1*rho%R*vel_rms%R + qv%R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R end if ! elastic energy update if (hypoelasticity) then - G_L = 0._wp; G_R = 0._wp + G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do if (cont_damage) then - G_L = G_L*max((1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) - G_R = G_R*max((1._wp - qR_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) + G%L = G%L*max((1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) + G%R = G%R*max((1._wp - qR_prim_rsx_vf(${SF('')}$, eqn_idx%damage)), 0._wp) end if do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) ! Elastic contribution to energy if G large enough TODO take out if statement if stable without - if ((G_L > 1000) .and. (G_R > 1000)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + if ((G%L > 1000) .and. (G%R > 1000)) then + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) ! Double for shear stresses if (any(eqn_idx%stress%beg - 1 + i == shear_indices)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) end if end if end do end if - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, c_L, & - & qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, c%L, & + & qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, c_R, & - & qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, c%R, & + & qv%R) if (mhd) then - call s_compute_fast_magnetosonic_speed(rho_L, c_L, B%L, norm_dir, c_fast%L, H_L) - call s_compute_fast_magnetosonic_speed(rho_R, c_R, B%R, norm_dir, c_fast%R, H_R) + call s_compute_fast_magnetosonic_speed(rho%L, c%L, B%L, norm_dir, c_fast%L, H%L) + call s_compute_fast_magnetosonic_speed(rho%R, c%R, B%R, norm_dir, c_fast%R, H%R) end if s_L = 0._wp; s_R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - s_L = s_L + vel_L(i)**2._wp - s_R = s_R + vel_R(i)**2._wp + s_L = s_L + vel%L(i)**2._wp + s_R = s_R + vel%R(i)**2._wp end do s_L = sqrt(s_L) s_R = sqrt(s_R) - s_P = max(s_L, s_R) + max(c_L, c_R) + s_P = max(s_L, s_R) + max(c%L, c%R) s_M = -s_P s_L = s_M @@ -1184,15 +1151,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = (s_M*alpha_rho_R(i)*vel_R(norm_dir) - s_P*alpha_rho_L(i)*vel_L(norm_dir) & + & i) = (s_M*alpha_rho_R(i)*vel%R(norm_dir) - s_P*alpha_rho_L(i)*vel%L(norm_dir) & & + s_M*s_P*(alpha_rho_L(i) - alpha_rho_R(i)))/(s_M - s_P) end do else if (relativity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = (s_M*Ga%R*alpha_rho_R(i)*vel_R(norm_dir) - s_P*Ga%L*alpha_rho_L(i) & - & *vel_L(norm_dir) + s_M*s_P*(Ga%L*alpha_rho_L(i) - Ga%R*alpha_rho_R(i)))/(s_M & + & i) = (s_M*Ga%R*alpha_rho_R(i)*vel%R(norm_dir) - s_P*Ga%L*alpha_rho_L(i) & + & *vel%L(norm_dir) + s_M*s_P*(Ga%L*alpha_rho_L(i) - Ga%R*alpha_rho_R(i)))/(s_M & & - s_P) end do end if @@ -1204,10 +1171,10 @@ contains ! Flux of rho*v_i in the ${XYZ}$ direction = rho * v_i * v_${XYZ}$ - B_i * B_${XYZ}$ + ! delta_(${XYZ}$,i) * p_tot flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + i) = (s_M*(rho_R*vel_R(i)*vel_R(norm_dir) - B%R(i) & - & *B%R(norm_dir) + dir_flg(i)*(pres_R + pres_mag%R)) - s_P*(rho_L*vel_L(i) & - & *vel_L(norm_dir) - B%L(i)*B%L(norm_dir) + dir_flg(i)*(pres_L + pres_mag%L)) & - & + s_M*s_P*(rho_L*vel_L(i) - rho_R*vel_R(i)))/(s_M - s_P) + & eqn_idx%cont%end + i) = (s_M*(rho%R*vel%R(i)*vel%R(norm_dir) - B%R(i) & + & *B%R(norm_dir) + dir_flg(i)*(pres%R + pres_mag%R)) - s_P*(rho%L*vel%L(i) & + & *vel%L(norm_dir) - B%L(i)*B%L(norm_dir) + dir_flg(i)*(pres%L + pres_mag%L)) & + & + s_M*s_P*(rho%L*vel%L(i) - rho%R*vel%R(i)))/(s_M - s_P) end do else if (mhd .and. relativity) then $:GPU_LOOP(parallelism='[seq]') @@ -1215,40 +1182,40 @@ contains ! Flux of m_i in the ${XYZ}$ direction = m_i * v_${XYZ}$ - b_i/Gamma * B_${XYZ}$ + ! delta_(${XYZ}$,i) * p_tot flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + i) = (s_M*(cm%R(i)*vel_R(norm_dir) - b4%R(i) & - & /Ga%R*B%R(norm_dir) + dir_flg(i)*(pres_R + pres_mag%R)) - s_P*(cm%L(i) & - & *vel_L(norm_dir) - b4%L(i)/Ga%L*B%L(norm_dir) + dir_flg(i)*(pres_L + pres_mag%L) & + & eqn_idx%cont%end + i) = (s_M*(cm%R(i)*vel%R(norm_dir) - b4%R(i) & + & /Ga%R*B%R(norm_dir) + dir_flg(i)*(pres%R + pres_mag%R)) - s_P*(cm%L(i) & + & *vel%L(norm_dir) - b4%L(i)/Ga%L*B%L(norm_dir) + dir_flg(i)*(pres%L + pres_mag%L) & & ) + s_M*s_P*(cm%L(i) - cm%R(i)))/(s_M - s_P) end do else if (bubbles_euler) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*(pres_R - ptilde_R)) - s_P*(rho_L*vel_L(dir_idx(1)) & - & *vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres_L - ptilde_L)) & - & + s_M*s_P*(rho_L*vel_L(dir_idx(i)) - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) & - & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_R(dir_idx(i)) - vel_L(dir_idx(i))) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*(pres%R - ptilde%R)) - s_P*(rho%L*vel%L(dir_idx(1)) & + & *vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres%L - ptilde%L)) & + & + s_M*s_P*(rho%L*vel%L(dir_idx(i)) - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) & + & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do else if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_R - tau_e_R(dir_idx_tau(i))) & - & - s_P*(rho_L*vel_L(dir_idx(1))*vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*pres_L & - & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho_L*vel_L(dir_idx(i)) & - & - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%R - tau_e_R(dir_idx_tau(i))) & + & - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*pres%L & + & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) end do else $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho_R*vel_R(dir_idx(1))*vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_R) - s_P*(rho_L*vel_L(dir_idx(1))*vel_L(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres_L) + s_M*s_P*(rho_L*vel_L(dir_idx(i)) & - & - rho_R*vel_R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & - & *pcorr*(vel_R(dir_idx(i)) - vel_L(dir_idx(i))) + & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%R) - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) & + & + dir_flg(dir_idx(i))*pres%L) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & *pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do end if @@ -1257,47 +1224,47 @@ contains ! energy flux = (E + p + p_mag) * v_${XYZ}$ - B_${XYZ}$ * (v_x*B_x + v_y*B_y + v_z*B_z) #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel_R(norm_dir)*(E_R + pres_R + pres_mag%R) - B%R(norm_dir) & - & *(vel_R(1)*B%R(1) + vel_R(2)*B%R(2) + vel_R(3)*B%R(3))) - s_P*(vel_L(norm_dir) & - & *(E_L + pres_L + pres_mag%L) - B%L(norm_dir)*(vel_L(1)*B%L(1) + vel_L(2)*B%L(2) & - & + vel_L(3)*B%L(3))) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + & eqn_idx%E) = (s_M*(vel%R(norm_dir)*(E%R + pres%R + pres_mag%R) - B%R(norm_dir) & + & *(vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3))) - s_P*(vel%L(norm_dir) & + & *(E%L + pres%L + pres_mag%L) - B%L(norm_dir)*(vel%L(1)*B%L(1) + vel%L(2)*B%L(2) & + & + vel%L(3)*B%L(3))) + s_M*s_P*(E%L - E%R))/(s_M - s_P) #:endif else if (mhd .and. relativity) then ! energy flux = m_${XYZ}$ - mass flux Hard-coded for single-component for now flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(cm%R(norm_dir) - Ga%R*alpha_rho_R(1)*vel_R(norm_dir)) & - & - s_P*(cm%L(norm_dir) - Ga%L*alpha_rho_L(1)*vel_L(norm_dir)) + s_M*s_P*(E_L - E_R)) & + & eqn_idx%E) = (s_M*(cm%R(norm_dir) - Ga%R*alpha_rho_R(1)*vel%R(norm_dir)) & + & - s_P*(cm%L(norm_dir) - Ga%L*alpha_rho_L(1)*vel%L(norm_dir)) + s_M*s_P*(E%L - E%R)) & & /(s_M - s_P) else if (bubbles_euler) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*vel_R(dir_idx(1))*(E_R + pres_R - ptilde_R) - s_P*vel_L(dir_idx(1) & - & )*(E_L + pres_L - ptilde_L) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & - & *pcorr*(vel_R_rms - vel_L_rms)/2._wp + & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R - ptilde%R) - s_P*vel%L(dir_idx(1) & + & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & *pcorr*(vel_rms%R - vel_rms%L)/2._wp else if (hypoelasticity) then flux_tau_L = 0._wp; flux_tau_R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel_L(dir_idx(i)) - flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel_R(dir_idx(i)) + flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel%L(dir_idx(i)) + flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel%R(dir_idx(i)) end do flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel_R(dir_idx(1))*(E_R + pres_R) - flux_tau_R) & - & - s_P*(vel_L(dir_idx(1))*(E_L + pres_L) - flux_tau_L) + s_M*s_P*(E_L - E_R))/(s_M & + & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau_R) & + & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau_L) + s_M*s_P*(E%L - E%R))/(s_M & & - s_P) else flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*vel_R(dir_idx(1))*(E_R + pres_R) - s_P*vel_L(dir_idx(1))*(E_L & - & + pres_L) + s_M*s_P*(E_L - E_R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_R_rms & - & - vel_L_rms)/2._wp + & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R) - s_P*vel%L(dir_idx(1))*(E%L & + & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_rms%R & + & - vel_rms%L)/2._wp end if ! Elastic Stresses if (hypoelasticity) then do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! TODO: this indexing may be slow flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = (s_M*(rho_R*vel_R(dir_idx(1))*tau_e_R(i)) & - & - s_P*(rho_L*vel_L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho_L*tau_e_L(i) & - & - rho_R*tau_e_R(i)))/(s_M - s_P) + & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e_R(i)) & + & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho%L*tau_e_L(i) & + & - rho%R*tau_e_R(i)))/(s_M - s_P) end do end if @@ -1320,12 +1287,12 @@ contains if (chemistry) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - Y_L = qL_prim_rsx_vf(${SF('')}$, i) - Y_R = qR_prim_rsx_vf(${SF(' + 1')}$, i) + Y%L = qL_prim_rsx_vf(${SF('')}$, i) + Y%R = qR_prim_rsx_vf(${SF(' + 1')}$, i) flux_rsx_vf(${SF('')}$, & - & i) = (s_M*Y_R*rho_R*vel_R(dir_idx(1)) - s_P*Y_L*rho_L*vel_L(dir_idx(1)) & - & + s_M*s_P*(Y_L*rho_L - Y_R*rho_R))/(s_M - s_P) + & i) = (s_M*Y%R*rho%R*vel%R(dir_idx(1)) - s_P*Y%L*rho%L*vel%L(dir_idx(1)) & + & + s_M*s_P*(Y%L*rho%L - Y%R*rho%R))/(s_M - s_P) flux_src_rsx_vf(${SF('')}$, i) = 0._wp end do end if @@ -1337,8 +1304,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 0, 1 flux_rsx_vf(j, k, l, & - & eqn_idx%B%beg + i) = (s_M*(vel_R(1)*B%R(2 + i) - vel_R(2 + i)*Bx0) & - & - s_P*(vel_L(1)*B%L(2 + i) - vel_L(2 + i)*Bx0) + s_M*s_P*(B%L(2 + i) & + & eqn_idx%B%beg + i) = (s_M*(vel%R(1)*B%R(2 + i) - vel%R(2 + i)*Bx0) & + & - s_P*(vel%L(1)*B%L(2 + i) - vel%L(2 + i)*Bx0) + s_M*s_P*(B%L(2 + i) & & - B%R(2 + i)))/(s_M - s_P) end do else ! 2D/3D: Bx, By, Bz /= const. but zero flux component in the same direction @@ -1348,8 +1315,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 0, 2 flux_rsx_vf(${SF('')}$, & - & eqn_idx%B%beg + i) = (1 - dir_flg(i + 1))*(s_M*(vel_R(dir_idx(1))*B%R(i + 1) & - & - vel_R(i + 1)*B%R(norm_dir)) - s_P*(vel_L(dir_idx(1))*B%L(i + 1) - vel_L(i & + & eqn_idx%B%beg + i) = (1 - dir_flg(i + 1))*(s_M*(vel%R(dir_idx(1))*B%R(i + 1) & + & - vel%R(i + 1)*B%R(norm_dir)) - s_P*(vel%L(dir_idx(1))*B%L(i + 1) - vel%L(i & & + 1)*B%L(norm_dir)) + s_M*s_P*(B%L(i + 1) - B%R(i + 1)))/(s_M - s_P) end do end if @@ -1365,7 +1332,7 @@ contains end do ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%cont%end + 2) = flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + 2) - (s_M*pres_R - s_P*pres_L)/(s_M - s_P) + & eqn_idx%cont%end + 2) - (s_M*pres%R - s_P*pres%L)/(s_M - s_P) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end @@ -1392,8 +1359,8 @@ contains #:endfor if (viscous) then - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, idx_right_phys, vel_grad_L, vel_grad_R, alpha_L, alpha_R, & - & vel_L, vel_R, Re_L, Re_R]', copyin='[norm_dir]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, idx_right_phys, vel_grad_L, vel_grad_R, alpha_L, alpha_R, vel, & + & Re_L, Re_R]', copyin='[norm_dir]') do l = isz%beg, isz%end do k = isy%beg, isy%end do j = isx%beg, isx%end @@ -1411,8 +1378,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) - vel_R(i) = qR_prim_rsx_vf(j + 1, k, l, eqn_idx%mom%beg + i - 1) + vel%L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) + vel%R(i) = qR_prim_rsx_vf(j + 1, k, l, eqn_idx%mom%beg + i - 1) end do else if (norm_dir == 2) then $:GPU_LOOP(parallelism='[seq]') @@ -1422,8 +1389,8 @@ contains end do $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) - vel_R(i) = qR_prim_rsx_vf(j, k + 1, l, eqn_idx%mom%beg + i - 1) + vel%L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) + vel%R(i) = qR_prim_rsx_vf(j, k + 1, l, eqn_idx%mom%beg + i - 1) end do else $:GPU_LOOP(parallelism='[seq]') @@ -1434,8 +1401,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) - vel_R(i) = qR_prim_rsx_vf(j, k, l + 1, eqn_idx%mom%beg + i - 1) + vel%L(i) = qL_prim_rsx_vf(j, k, l, eqn_idx%mom%beg + i - 1) + vel%R(i) = qR_prim_rsx_vf(j, k, l + 1, eqn_idx%mom%beg + i - 1) end do end if @@ -1483,37 +1450,37 @@ contains flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel_L(1) + vel_grad_R(1, 1)*vel_R(1)) + & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel%L(1) + vel_grad_R(1, 1)*vel%R(1)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (num_dims > 1) then flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel_L(1) + vel_grad_R(2, & - & 2)*vel_R(1)) + & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel%L(1) + vel_grad_R(2, & + & 2)*vel%R(1)) flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 2) + vel_grad_R(1, 2)) - 0.5_wp*(vel_grad_L(2, & & 1) + vel_grad_R(2, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 2)*vel_L(2) + vel_grad_R(1, & - & 2)*vel_R(2)) - 0.5_wp*(vel_grad_L(2, 1)*vel_L(2) + vel_grad_R(2, 1)*vel_R(2)) + & l) - 0.5_wp*(vel_grad_L(1, 2)*vel%L(2) + vel_grad_R(1, & + & 2)*vel%R(2)) - 0.5_wp*(vel_grad_L(2, 1)*vel%L(2) + vel_grad_R(2, 1)*vel%R(2)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(3, & - & 3)*vel_L(1) + vel_grad_R(3, 3)*vel_R(1)) + & 3)*vel%L(1) + vel_grad_R(3, 3)*vel%R(1)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 3) + vel_grad_R(1, & & 3)) - 0.5_wp*(vel_grad_L(3, 1) + vel_grad_R(3, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 3)*vel_L(3) + vel_grad_R(1, & - & 3)*vel_R(3)) - 0.5_wp*(vel_grad_L(3, 1)*vel_L(3) + vel_grad_R(3, & - & 1)*vel_R(3)) + & l) - 0.5_wp*(vel_grad_L(1, 3)*vel%L(3) + vel_grad_R(1, & + & 3)*vel%R(3)) - 0.5_wp*(vel_grad_L(3, 1)*vel%L(3) + vel_grad_R(3, & + & 1)*vel%R(3)) end if #:endif end if @@ -1523,34 +1490,34 @@ contains flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel_L(2) + vel_grad_R(1, 1)*vel_R(2)) + & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel%L(2) + vel_grad_R(1, 1)*vel%R(2)) flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel_L(2) + vel_grad_R(2, 2)*vel_R(2)) + & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel%L(2) + vel_grad_R(2, 2)*vel%R(2)) flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 2) + vel_grad_R(1, 2)) - 0.5_wp*(vel_grad_L(2, & & 1) + vel_grad_R(2, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 2)*vel_L(1) + vel_grad_R(1, & - & 2)*vel_R(1)) - 0.5_wp*(vel_grad_L(2, 1)*vel_L(1) + vel_grad_R(2, 1)*vel_R(1)) + & l) - 0.5_wp*(vel_grad_L(1, 2)*vel%L(1) + vel_grad_R(1, & + & 2)*vel%R(1)) - 0.5_wp*(vel_grad_L(2, 1)*vel%L(1) + vel_grad_R(2, 1)*vel%R(1)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, & & k, l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3)*vel_L(2) + vel_grad_R(3, & - & 3)*vel_R(2)) + & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3)*vel%L(2) + vel_grad_R(3, & + & 3)*vel%R(2)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, & & k, l) - 0.5_wp*(vel_grad_L(2, 3) + vel_grad_R(2, & & 3)) - 0.5_wp*(vel_grad_L(3, 2) + vel_grad_R(3, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(2, 3)*vel_L(3) + vel_grad_R(2, & - & 3)*vel_R(3)) - 0.5_wp*(vel_grad_L(3, 2)*vel_L(3) + vel_grad_R(3, & - & 2)*vel_R(3)) + & l) - 0.5_wp*(vel_grad_L(2, 3)*vel%L(3) + vel_grad_R(2, & + & 3)*vel%R(3)) - 0.5_wp*(vel_grad_L(3, 2)*vel%L(3) + vel_grad_R(3, & + & 2)*vel%R(3)) end if #:endif #:endif @@ -1559,31 +1526,31 @@ contains flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel_L(3) + vel_grad_R(1, 1)*vel_R(3)) + & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(1, 1)*vel%L(3) + vel_grad_R(1, 1)*vel%R(3)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel_L(3) + vel_grad_R(2, 2)*vel_R(3)) + & l) - (-2._wp/3._wp)*0.5_wp*(vel_grad_L(2, 2)*vel%L(3) + vel_grad_R(2, 2)*vel%R(3)) flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 3) + vel_grad_R(1, 3)) - 0.5_wp*(vel_grad_L(3, & & 1) + vel_grad_R(3, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 3)*vel_L(1) + vel_grad_R(1, & - & 3)*vel_R(1)) - 0.5_wp*(vel_grad_L(3, 1)*vel_L(1) + vel_grad_R(3, 1)*vel_R(1)) + & l) - 0.5_wp*(vel_grad_L(1, 3)*vel%L(1) + vel_grad_R(1, & + & 3)*vel%R(1)) - 0.5_wp*(vel_grad_L(3, 1)*vel%L(1) + vel_grad_R(3, 1)*vel%R(1)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3)*vel_L(3) + vel_grad_R(3, 3)*vel_R(3)) + & l) - (4._wp/3._wp)*0.5_wp*(vel_grad_L(3, 3)*vel%L(3) + vel_grad_R(3, 3)*vel%R(3)) flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(2, 3) + vel_grad_R(2, 3)) - 0.5_wp*(vel_grad_L(3, & & 2) + vel_grad_R(3, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(2, 3)*vel_L(2) + vel_grad_R(2, & - & 3)*vel_R(2)) - 0.5_wp*(vel_grad_L(3, 2)*vel_L(2) + vel_grad_R(3, 2)*vel_R(2)) + & l) - 0.5_wp*(vel_grad_L(2, 3)*vel%L(2) + vel_grad_R(2, & + & 3)*vel%R(2)) - 0.5_wp*(vel_grad_L(3, 2)*vel%L(2) + vel_grad_R(3, 2)*vel%R(2)) #:endif end if end if @@ -1614,20 +1581,20 @@ contains flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, l) - 0.5_wp*(vel_grad_L(1, & - & 1)*vel_L(1) + vel_grad_R(1, 1)*vel_R(1)) + & 1)*vel%L(1) + vel_grad_R(1, 1)*vel%R(1)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (num_dims > 1) then flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(2, 2)*vel_L(1) + vel_grad_R(2, 2)*vel_R(1)) + & l) - 0.5_wp*(vel_grad_L(2, 2)*vel%L(1) + vel_grad_R(2, 2)*vel%R(1)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then flux_src_vf(eqn_idx%mom%beg)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(3, 3)*vel_L(1) + vel_grad_R(3, 3)*vel_R(1)) + & l) - 0.5_wp*(vel_grad_L(3, 3)*vel%L(1) + vel_grad_R(3, 3)*vel%R(1)) end if #:endif end if @@ -1637,19 +1604,19 @@ contains flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 1)*vel_L(2) + vel_grad_R(1, 1)*vel_R(2)) + & l) - 0.5_wp*(vel_grad_L(1, 1)*vel%L(2) + vel_grad_R(1, 1)*vel%R(2)) flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(2, 2)*vel_L(2) + vel_grad_R(2, 2)*vel_R(2)) + & l) - 0.5_wp*(vel_grad_L(2, 2)*vel%L(2) + vel_grad_R(2, 2)*vel%R(2)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 1)%sf(j, & & k, l) - 0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(3, 3)*vel_L(2) + vel_grad_R(3, 3)*vel_R(2)) + & l) - 0.5_wp*(vel_grad_L(3, 3)*vel%L(2) + vel_grad_R(3, 3)*vel%R(2)) end if #:endif #:endif @@ -1658,17 +1625,17 @@ contains flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(1, 1) + vel_grad_R(1, 1)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(1, 1)*vel_L(3) + vel_grad_R(1, 1)*vel_R(3)) + & l) - 0.5_wp*(vel_grad_L(1, 1)*vel%L(3) + vel_grad_R(1, 1)*vel%R(3)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(2, 2) + vel_grad_R(2, 2)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(2, 2)*vel_L(3) + vel_grad_R(2, 2)*vel_R(3)) + & l) - 0.5_wp*(vel_grad_L(2, 2)*vel%L(3) + vel_grad_R(2, 2)*vel%R(3)) flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, l) = flux_src_vf(eqn_idx%mom%beg + 2)%sf(j, k, & & l) - 0.5_wp*(vel_grad_L(3, 3) + vel_grad_R(3, 3)) flux_src_vf(eqn_idx%E)%sf(j, k, l) = flux_src_vf(eqn_idx%E)%sf(j, k, & - & l) - 0.5_wp*(vel_grad_L(3, 3)*vel_L(3) + vel_grad_R(3, 3)*vel_R(3)) + & l) - 0.5_wp*(vel_grad_L(3, 3)*vel%L(3) + vel_grad_R(3, 3)*vel%R(3)) #:endif end if end if @@ -1702,17 +1669,10 @@ contains #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: alpha_rho_L, alpha_rho_R real(wp), dimension(3) :: alpha_L, alpha_R - real(wp), dimension(3) :: vel_L, vel_R #:else real(wp), dimension(num_fluids) :: alpha_rho_L, alpha_rho_R real(wp), dimension(num_fluids) :: alpha_L, alpha_R - real(wp), dimension(num_dims) :: vel_L, vel_R #:endif - - real(wp) :: rho_L, rho_R - real(wp) :: pres_L, pres_R - real(wp) :: E_L, E_R - real(wp) :: H_L, H_R #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(10) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR real(wp), dimension(10) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 @@ -1720,29 +1680,6 @@ contains real(wp), dimension(num_species) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR real(wp), dimension(num_species) :: Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2 #:endif - real(wp) :: Cp_avg, Cv_avg, T_avg, c_sum_Yi_Phi, eps - real(wp) :: T_L, T_R - real(wp) :: MW_L, MW_R - real(wp) :: R_gas_L, R_gas_R - real(wp) :: Cp_L, Cp_R - real(wp) :: Cv_L, Cv_R - real(wp) :: Gamm_L, Gamm_R - real(wp) :: Y_L, Y_R - real(wp) :: gamma_L, gamma_R - real(wp) :: pi_inf_L, pi_inf_R - real(wp) :: qv_L, qv_R - real(wp) :: c_L, c_R - real(wp), dimension(2) :: Re_L, Re_R - real(wp) :: rho_avg - real(wp) :: H_avg - real(wp) :: gamma_avg - real(wp) :: qv_avg - real(wp) :: c_avg - real(wp) :: s_L, s_R, s_M, s_P, s_S - real(wp) :: xi_L, xi_R !< Left and right wave speeds functions - real(wp) :: xi_L_m1, xi_R_m1 !< xi_L/R - 1, computed without cancellation - real(wp) :: xi_M, xi_P - real(wp) :: xi_MP, xi_PP #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: R0_L, R0_R real(wp), dimension(3) :: V0_L, V0_R @@ -1754,21 +1691,34 @@ contains real(wp), dimension(nb) :: P0_L, P0_R real(wp), dimension(nb) :: pbw_L, pbw_R #:endif - - real(wp) :: alpha_L_sum, alpha_R_sum, nbub_L, nbub_R - real(wp) :: ptilde_L, ptilde_R - real(wp) :: PbwR3Lbar, PbwR3Rbar - real(wp) :: R3Lbar, R3Rbar - real(wp) :: R3V2Lbar, R3V2Rbar - real(wp), dimension(6) :: tau_e_L, tau_e_R + type(riemann_states_vec3) :: vel + type(riemann_states) :: rho, pres, E, H + type(riemann_states) :: T, Y, MW, R_gas, Cp, Cv, Gamm, gamma + type(riemann_states) :: pi_inf, qv, c, G, ptilde, nbub + type(riemann_states) :: vel_rms, vel_tmp + real(wp) :: Cp_avg, Cv_avg, T_avg, c_sum_Yi_Phi, eps + real(wp), dimension(2) :: Re_L, Re_R + real(wp), dimension(6) :: tau_e_L, tau_e_R #:if not MFC_CASE_OPTIMIZATION and USING_AMD real(wp), dimension(3) :: xi_field_L, xi_field_R #:else real(wp), dimension(num_dims) :: xi_field_L, xi_field_R #:endif - real(wp) :: G_L, G_R - real(wp) :: vel_L_rms, vel_R_rms, vel_avg_rms - real(wp) :: vel_L_tmp, vel_R_tmp + real(wp) :: rho_avg + real(wp) :: H_avg + real(wp) :: gamma_avg + real(wp) :: qv_avg + real(wp) :: c_avg + real(wp) :: vel_avg_rms + real(wp) :: s_L, s_R, s_M, s_P, s_S + real(wp) :: xi_L, xi_R !< Left and right wave speeds functions + real(wp) :: xi_L_m1, xi_R_m1 !< xi_L/R - 1, computed without cancellation + real(wp) :: xi_M, xi_P + real(wp) :: xi_MP, xi_PP + real(wp) :: alpha_L_sum, alpha_R_sum + real(wp) :: PbwR3Lbar, PbwR3Rbar + real(wp) :: R3Lbar, R3Rbar + real(wp) :: R3V2Lbar, R3V2Rbar real(wp) :: rho_Star, E_Star, p_Star, p_K_Star, vel_K_star real(wp) :: pres_SL, pres_SR, Ms_L, Ms_R real(wp) :: flux_ene_e @@ -1793,46 +1743,44 @@ contains ! 6-EQUATION MODEL WITH HLLC HLLC star-state flux with contact wave speed s_S if (model_eqns == 3) then ! 6-equation model (model_eqns=3): separate phasic internal energies - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, vel_L, vel_R, Re_L, Re_R, alpha_L, alpha_R, Ys_L, & - & Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, Yi_avg, Phi_avg, h_iL, h_iR, & - & h_avg_2, tau_e_L, tau_e_R, flux_ene_e, xi_field_L, xi_field_R, pcorr, zcoef, rho_L, & - & rho_R, pres_L, pres_R, E_L, E_R, H_L, H_R, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, & - & T_L, T_R, Y_L, Y_R, MW_L, MW_R, R_gas_L, R_gas_R, Cp_L, Cp_R, Cv_L, Cv_R, Gamm_L, & - & Gamm_R, gamma_L, gamma_R, pi_inf_L, pi_inf_R, qv_L, qv_R, qv_avg, c_L, c_R, G_L, G_R, & - & rho_avg, H_avg, c_avg, gamma_avg, ptilde_L, ptilde_R, vel_L_rms, vel_R_rms, & - & vel_avg_rms, vel_L_tmp, vel_R_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, & - & alpha_R_sum, rho_Star, E_Star, p_Star, p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, & - & xi_M, xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, vel, Re_L, Re_R, alpha_L, alpha_R, Ys_L, Ys_R, Xs_L, & + & Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, tau_e_L, & + & tau_e_R, flux_ene_e, xi_field_L, xi_field_R, pcorr, zcoef, rho, pres, E, H, Cp_avg, & + & Cv_avg, T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Cv, Gamm, gamma, pi_inf, qv, & + & qv_avg, c, G, rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, vel_avg_rms, vel_tmp, & + & Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, rho_Star, E_Star, p_Star, & + & p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, xi_R, xi_L_m1, & + & xi_R_m1, xi_MP, xi_PP]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end - vel_L_rms = 0._wp; vel_R_rms = 0._wp - rho_L = 0._wp; rho_R = 0._wp - gamma_L = 0._wp; gamma_R = 0._wp - pi_inf_L = 0._wp; pi_inf_R = 0._wp - qv_L = 0._wp; qv_R = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp + rho%L = 0._wp; rho%R = 0._wp + gamma%L = 0._wp; gamma%R = 0._wp + pi_inf%L = 0._wp; pi_inf%R = 0._wp + qv%L = 0._wp; qv%R = 0._wp alpha_L_sum = 0._wp; alpha_R_sum = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) - rho_L = 0._wp - gamma_L = 0._wp - pi_inf_L = 0._wp - qv_L = 0._wp + rho%L = 0._wp + gamma%L = 0._wp + pi_inf%L = 0._wp + qv%L = 0._wp - rho_R = 0._wp - gamma_R = 0._wp - pi_inf_R = 0._wp - qv_R = 0._wp + rho%R = 0._wp + gamma%R = 0._wp + pi_inf%R = 0._wp + qv%R = 0._wp alpha_L_sum = 0._wp alpha_R_sum = 0._wp @@ -1865,15 +1813,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + qL_prim_rsx_vf(${SF('')}$, i) - gamma_L = gamma_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) - pi_inf_L = pi_inf_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) - qv_L = qv_L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) + rho%L = rho%L + qL_prim_rsx_vf(${SF('')}$, i) + gamma%L = gamma%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) + pi_inf%L = pi_inf%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) + qv%L = qv%L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) - rho_R = rho_R + qR_prim_rsx_vf(${SF(' + 1')}$, i) - gamma_R = gamma_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) - pi_inf_R = pi_inf_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) - qv_R = qv_R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) + rho%R = rho%R + qR_prim_rsx_vf(${SF(' + 1')}$, i) + gamma%R = gamma%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) + pi_inf%R = pi_inf%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) + qv%R = qv%R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) alpha_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%adv%beg + i - 1) alpha_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%adv%beg + i - 1) @@ -1897,8 +1845,8 @@ contains end do end if - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1_wp*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1_wp*rho_R*vel_R_rms + qv_R + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1_wp*rho%L*vel_rms%L + qv%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1_wp*rho%R*vel_rms%R + qv%R ! ENERGY ADJUSTMENTS FOR HYPOELASTIC ENERGY if (hypoelasticity) then @@ -1907,22 +1855,22 @@ contains tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do - G_L = 0._wp; G_R = 0._wp + G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! Elastic contribution to energy if G large enough - if ((G_L > verysmall) .and. (G_R > verysmall)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + if ((G%L > verysmall) .and. (G%R > verysmall)) then + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) ! Additional terms in 2D and 3D if ((i == 2) .or. (i == 4) .or. (i == 5)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) end if end if end do @@ -1935,17 +1883,17 @@ contains xi_field_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) xi_field_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) end do - G_L = 0._wp; G_R = 0._wp + G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids ! Mixture left and right shear modulus - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do ! Elastic contribution to energy if G large enough - if (G_L > verysmall .and. G_R > verysmall) then - E_L = E_L + G_L*qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%end + 1) - E_R = E_R + G_R*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%end + 1) + if (G%L > verysmall .and. G%R > verysmall) then + E%L = E%L + G%L*qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%end + 1) + E%R = E%R + G%R*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%end + 1) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, b_size - 1 @@ -1954,20 +1902,20 @@ contains end do end if - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R @:compute_average_state() - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, & - & c_L, qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, & + & c%L, qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, & - & c_R, qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, & + & c%R, qv%R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. - call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, vel_avg_rms, & + call s_compute_speed_of_sound(pres%R, rho_avg, gamma_avg, pi_inf%R, H_avg, alpha_R, vel_avg_rms, & & 0._wp, c_avg, qv_avg) if (viscous) then @@ -1986,52 +1934,52 @@ contains if (wave_speeds == 1) then if (elasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) + tau_e_L(dir_idx_tau(1) & - & ))/rho_L), & - & vel_R(dir_idx(1)) - sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) & - & + tau_e_R(dir_idx_tau(1)))/rho_R)) - s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) + tau_e_R(dir_idx_tau(1) & - & ))/rho_R), & - & vel_L(dir_idx(1)) + sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) & - & + tau_e_L(dir_idx_tau(1)))/rho_L)) - s_S = (pres_R - tau_e_R(dir_idx_tau(1)) - pres_L + tau_e_L(dir_idx_tau(1)) & - & + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) - rho_R*vel_R(dir_idx(1)) & - & *(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L - vel_L(dir_idx(1))) - rho_R*(s_R & - & - vel_R(dir_idx(1)))) + s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1) & + & ))/rho%L), & + & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) & + & + tau_e_R(dir_idx_tau(1)))/rho%R)) + s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1) & + & ))/rho%R), & + & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) & + & + tau_e_L(dir_idx_tau(1)))/rho%L)) + s_S = (pres%R - tau_e_R(dir_idx_tau(1)) - pres%L + tau_e_L(dir_idx_tau(1)) & + & + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & + & *(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) - rho%R*(s_R & + & - vel%R(dir_idx(1)))) else - s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) - s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L) - s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) & - & - rho_R*vel_R(dir_idx(1))*(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L & - & - vel_L(dir_idx(1))) - rho_R*(s_R - vel_R(dir_idx(1)))) + s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L & + & - vel%L(dir_idx(1))) - rho%R*(s_R - vel%R(dir_idx(1)))) end if else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres_L + pres_R + rho_avg*c_avg*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) pres_SR = pres_SL ! Low Mach correction: Thornber et al. JCP (2008) Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_L)/(1._wp + gamma_L))*(pres_SL/pres_L - 1._wp) & - & *pres_L/((pres_L + pi_inf_L/(1._wp + gamma_L))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_R)/(1._wp + gamma_R))*(pres_SR/pres_R - 1._wp) & - & *pres_R/((pres_R + pi_inf_R/(1._wp + gamma_R))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel_L(dir_idx(1)) - c_L*Ms_L - s_R = vel_R(dir_idx(1)) + c_R*Ms_R + s_L = vel%L(dir_idx(1)) - c%L*Ms_L + s_R = vel%R(dir_idx(1)) + c%R*Ms_R - s_S = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + (pres_L - pres_R)/(rho_avg*c_avg)) + s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) ! goes with numerical star velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(0.5_wp, s_S)) @@ -2041,16 +1989,16 @@ contains xi_MP = -min(0._wp, sign(1._wp, s_L)) xi_PP = max(0._wp, sign(1._wp, s_R)) - E_star = xi_M*(E_L + xi_MP*(xi_L*(E_L + (s_S - vel_L(dir_idx(1)))*(rho_L*s_S + pres_L/(s_L & - & - vel_L(dir_idx(1))))) - E_L)) + xi_P*(E_R + xi_PP*(xi_R*(E_R + (s_S & - & - vel_R(dir_idx(1)))*(rho_R*s_S + pres_R/(s_R - vel_R(dir_idx(1))))) - E_R)) - p_Star = xi_M*(pres_L + xi_MP*(rho_L*(s_L - vel_L(dir_idx(1)))*(s_S - vel_L(dir_idx(1))))) & - & + xi_P*(pres_R + xi_PP*(rho_R*(s_R - vel_R(dir_idx(1)))*(s_S - vel_R(dir_idx(1))))) + E_star = xi_M*(E%L + xi_MP*(xi_L*(E%L + (s_S - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s_L & + & - vel%L(dir_idx(1))))) - E%L)) + xi_P*(E%R + xi_PP*(xi_R*(E%R + (s_S & + & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s_R - vel%R(dir_idx(1))))) - E%R)) + p_Star = xi_M*(pres%L + xi_MP*(rho%L*(s_L - vel%L(dir_idx(1)))*(s_S - vel%L(dir_idx(1))))) & + & + xi_P*(pres%R + xi_PP*(rho%R*(s_R - vel%R(dir_idx(1)))*(s_S - vel%R(dir_idx(1))))) - rho_Star = xi_M*(rho_L*(xi_MP*xi_L + 1._wp - xi_MP)) + xi_P*(rho_R*(xi_PP*xi_R + 1._wp - xi_PP)) + rho_Star = xi_M*(rho%L*(xi_MP*xi_L + 1._wp - xi_MP)) + xi_P*(rho%R*(xi_PP*xi_R + 1._wp - xi_PP)) - vel_K_Star = vel_L(dir_idx(1))*(1._wp - xi_MP) + xi_MP*vel_R(dir_idx(1)) + xi_MP*xi_PP*(s_S & - & - vel_R(dir_idx(1))) + vel_K_Star = vel%L(dir_idx(1))*(1._wp - xi_MP) + xi_MP*vel%R(dir_idx(1)) + xi_MP*xi_PP*(s_S & + & - vel%R(dir_idx(1))) ! Low Mach correction if (low_Mach == 1) then @@ -2063,8 +2011,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! MOMENTUM FLUX. f = \rho u u - \sigma, q = \rho u, q_star = \xi * \rho*(s_star, v, w) @@ -2072,8 +2020,8 @@ contains do i = 1, num_dims flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = rho_Star*vel_K_Star*(dir_flg(dir_idx(i)) & - & *vel_K_Star + (1._wp - dir_flg(dir_idx(i)))*(xi_M*vel_L(dir_idx(i)) & - & + xi_P*vel_R(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star + (s_M/s_L)*(s_P/s_R) & + & *vel_K_Star + (1._wp - dir_flg(dir_idx(i)))*(xi_M*vel%L(dir_idx(i)) & + & + xi_P*vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star + (s_M/s_L)*(s_P/s_R) & & *dir_flg(dir_idx(i))*pcorr end do @@ -2090,11 +2038,11 @@ contains & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e_L(dir_idx_tau(i)) & & - xi_P*tau_e_R(dir_idx_tau(i)) ! ENERGY ELASTIC FLUX. - flux_ene_e = flux_ene_e - xi_M*(vel_L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & - & + s_M*(xi_L*((s_S - vel_L(i))*(tau_e_L(dir_idx_tau(i)) & - & /(s_L - vel_L(i)))))) - xi_P*(vel_R(dir_idx(i)) & - & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel_R(i)) & - & *(tau_e_R(dir_idx_tau(i))/(s_R - vel_R(i)))))) + flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & + & + s_M*(xi_L*((s_S - vel%L(i))*(tau_e_L(dir_idx_tau(i)) & + & /(s_L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & + & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel%R(i)) & + & *(tau_e_R(dir_idx_tau(i))/(s_R - vel%R(i)))))) end do flux_rsx_vf(${SF('')}$, eqn_idx%E) = flux_rsx_vf(${SF('')}$, eqn_idx%E) + flux_ene_e end if @@ -2110,20 +2058,20 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & - & dir_idx(i)) = xi_M*(vel_L(dir_idx(i)) + dir_flg(dir_idx(i)) & - & *(s_S*(xi_MP*xi_L_m1 + 1) - vel_L(dir_idx(i)))) + xi_P*(vel_R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*(s_S*(xi_PP*xi_R_m1 + 1) - vel_R(dir_idx(i)))) + & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i)) & + & *(s_S*(xi_MP*xi_L_m1 + 1) - vel%L(dir_idx(i)))) + xi_P*(vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*(s_S*(xi_PP*xi_R_m1 + 1) - vel%R(dir_idx(i)))) end do ! INTERNAL ENERGIES ADVECTION FLUX. K-th pressure and velocity in preparation for the internal ! energy flux $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - p_K_Star = xi_M*(xi_MP*((pres_L + pi_infs(i)/(1._wp + gammas(i)))*xi_L**(1._wp/gammas(i) & - & + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres_L) + pres_L) & - & + xi_P*(xi_PP*((pres_R + pi_infs(i)/(1._wp + gammas(i))) & - & *xi_R**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres_R) & - & + pres_R) + p_K_Star = xi_M*(xi_MP*((pres%L + pi_infs(i)/(1._wp + gammas(i)))*xi_L**(1._wp/gammas(i) & + & + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres%L) + pres%L) & + & + xi_P*(xi_PP*((pres%R + pi_infs(i)/(1._wp + gammas(i))) & + & *xi_R**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres%R) & + & + pres%R) flux_rsx_vf(${SF('')}$, i + eqn_idx%int_en%beg - 1) = ((xi_M*qL_prim_rsx_vf(${SF('')}$, & & i + eqn_idx%adv%beg - 1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & @@ -2143,9 +2091,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho_L*tau_e_L(i) & - & - rho_L*vel_L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho_R*tau_e_R(i) - rho_R*vel_R(dir_idx(1))*tau_e_R(i)) + & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*tau_e_L(i) & + & - rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & + & *(s_R*rho%R*tau_e_R(i) - rho%R*vel%R(dir_idx(1))*tau_e_R(i)) end do end if @@ -2154,9 +2102,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho_L*xi_field_L(i) & - & - rho_L*vel_L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho_R*xi_field_R(i) - rho_R*vel_R(dir_idx(1))*xi_field_R(i)) + & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*xi_field_L(i) & + & - rho%L*vel%L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & + & *(s_R*rho%R*xi_field_R(i) - rho%R*vel%R(dir_idx(1))*xi_field_R(i)) end do end if @@ -2208,23 +2156,21 @@ contains $:END_GPU_PARALLEL_LOOP() else if (model_eqns == 4) then ! 4-equation model (model_eqns=4): single pressure, velocity equilibrium - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, alpha_rho_L, alpha_rho_R, vel_L, vel_R, alpha_L, alpha_R, & - & nbub_L, nbub_R, rho_L, rho_R, pres_L, pres_R, E_L, E_R, H_L, H_R, Cp_avg, Cv_avg, & - & T_avg, eps, c_sum_Yi_Phi, T_L, T_R, Y_L, Y_R, MW_L, MW_R, R_gas_L, R_gas_R, Cp_L, Cp_R, & - & Gamm_L, Gamm_R, gamma_L, gamma_R, pi_inf_L, pi_inf_R, qv_L, qv_R, qv_avg, c_L, c_R, & - & G_L, G_R, rho_avg, H_avg, c_avg, gamma_avg, ptilde_L, ptilde_R, vel_L_rms, vel_R_rms, & - & vel_avg_rms, vel_L_tmp, vel_R_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, & - & alpha_R_sum, rho_Star, E_Star, p_Star, p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, & - & xi_M, xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, & - & Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, nbub, rho, & + & pres, E, H, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Gamm, gamma, & + & pi_inf, qv, qv_avg, c, G, rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, & + & vel_avg_rms, vel_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, rho_Star, & + & E_Star, p_Star, p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, xi_R, & + & xi_L_m1, xi_R_m1, xi_MP, xi_PP, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, & + & Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end - vel_L_rms = 0._wp; vel_R_rms = 0._wp - rho_L = 0._wp; rho_R = 0._wp - gamma_L = 0._wp; gamma_R = 0._wp - pi_inf_L = 0._wp; pi_inf_R = 0._wp - qv_L = 0._wp; qv_R = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp + rho%L = 0._wp; rho%R = 0._wp + gamma%L = 0._wp; gamma%R = 0._wp + pi_inf%L = 0._wp; pi_inf%R = 0._wp + qv%L = 0._wp; qv%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end @@ -2234,10 +2180,10 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do $:GPU_LOOP(parallelism='[seq]') @@ -2253,74 +2199,74 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + alpha_rho_L(i) - gamma_L = gamma_L + alpha_L(i)*gammas(i) - pi_inf_L = pi_inf_L + alpha_L(i)*pi_infs(i) - qv_L = qv_L + alpha_rho_L(i)*qvs(i) - - rho_R = rho_R + alpha_rho_R(i) - gamma_R = gamma_R + alpha_R(i)*gammas(i) - pi_inf_R = pi_inf_R + alpha_R(i)*pi_infs(i) - qv_R = qv_R + alpha_rho_R(i)*qvs(i) + rho%L = rho%L + alpha_rho_L(i) + gamma%L = gamma%L + alpha_L(i)*gammas(i) + pi_inf%L = pi_inf%L + alpha_L(i)*pi_infs(i) + qv%L = qv%L + alpha_rho_L(i)*qvs(i) + + rho%R = rho%R + alpha_rho_R(i) + gamma%R = gamma%R + alpha_R(i)*gammas(i) + pi_inf%R = pi_inf%R + alpha_R(i)*pi_infs(i) + qv%R = qv%R + alpha_rho_R(i)*qvs(i) end do - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1_wp*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1_wp*rho_R*vel_R_rms + qv_R + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1_wp*rho%L*vel_rms%L + qv%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1_wp*rho%R*vel_rms%R + qv%R - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R @:compute_average_state() - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, & - & c_L, qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, & + & c%L, qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, & - & c_R, qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, & + & c%R, qv%R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. - call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, vel_avg_rms, & + call s_compute_speed_of_sound(pres%R, rho_avg, gamma_avg, pi_inf%R, H_avg, alpha_R, vel_avg_rms, & & 0._wp, c_avg, qv_avg) if (wave_speeds == 1) then - s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) - s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L) + s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) & - & - rho_R*vel_R(dir_idx(1))*(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L - vel_L(dir_idx(1))) & - & - rho_R*(s_R - vel_R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & + & - rho%R*(s_R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres_L + pres_R + rho_avg*c_avg*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) pres_SR = pres_SL ! Low Mach correction: Thornber et al. JCP (2008) Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_L)/(1._wp + gamma_L))*(pres_SL/pres_L - 1._wp) & - & *pres_L/((pres_L + pi_inf_L/(1._wp + gamma_L))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_R)/(1._wp + gamma_R))*(pres_SR/pres_R - 1._wp) & - & *pres_R/((pres_R + pi_inf_R/(1._wp + gamma_R))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel_L(dir_idx(1)) - c_L*Ms_L - s_R = vel_R(dir_idx(1)) + c_R*Ms_R + s_L = vel%L(dir_idx(1)) - c%L*Ms_L + s_R = vel%R(dir_idx(1)) + c%R*Ms_R - s_S = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + (pres_L - pres_R)/(rho_avg*c_avg)) + s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -2329,20 +2275,20 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = xi_M*alpha_rho_L(i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*alpha_rho_R(i) & - & *(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i) = xi_M*alpha_rho_L(i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*alpha_rho_R(i) & + & *(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! Momentum flux. f = \rho u u + p I, q = \rho u, q_star = \xi * \rho*(s_star, v, w) $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(i) & + & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & & ) + s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & - & *vel_L(dir_idx(i))) - vel_L(dir_idx(i)))) + dir_flg(dir_idx(i))*pres_L) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(i)) & + & *vel%L(dir_idx(i))) - vel%L(dir_idx(i)))) + dir_flg(dir_idx(i))*pres%L) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) & & + s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & - & *vel_R(dir_idx(i))) - vel_R(dir_idx(i)))) + dir_flg(dir_idx(i))*pres_R) + & *vel%R(dir_idx(i))) - vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*pres%R) end do if (bubbles_euler) then @@ -2350,8 +2296,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, eqn_idx%cont%end + dir_idx(i)) = flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) + xi_M*(dir_flg(dir_idx(i))*(-1._wp*ptilde_L) & - & ) + xi_P*(dir_flg(dir_idx(i))*(-1._wp*ptilde_R)) + & eqn_idx%cont%end + dir_idx(i)) + xi_M*(dir_flg(dir_idx(i))*(-1._wp*ptilde%L) & + & ) + xi_P*(dir_flg(dir_idx(i))*(-1._wp*ptilde%R)) end do end if @@ -2360,8 +2306,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%alf, eqn_idx%alf ! only advect the void fraction flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! Advection velocity source: interface velocity for volume fraction transport @@ -2377,10 +2323,10 @@ contains if (bubbles_euler) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%bub%beg, eqn_idx%bub%end - flux_rsx_vf(${SF('')}$, i) = xi_M*nbub_L*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub_R*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + flux_rsx_vf(${SF('')}$, i) = xi_M*nbub%L*qL_prim_rsx_vf(${SF('')}$, & + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*nbub%R*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do end if @@ -2395,12 +2341,12 @@ contains end do ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho_L*(vel_L(dir_idx(1)) & - & *vel_L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & - & - dir_flg(dir_idx(1)))*vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & + & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end @@ -2415,12 +2361,12 @@ contains flux_gsrc_rsx_vf(${SF('')}$, i) = 0._wp end do flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%mom%beg + 1) = -xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(1) & + & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & - xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if #:endif @@ -2430,22 +2376,21 @@ contains $:END_GPU_PARALLEL_LOOP() else if (model_eqns == 2 .and. bubbles_euler) then ! 5-equation model with Euler-Euler bubble dynamics - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, R0_L, R0_R, V0_L, V0_R, P0_L, P0_R, pbw_L, pbw_R, vel_L, & - & vel_R, rho_avg, alpha_L, alpha_R, h_avg, gamma_avg, Re_L, Re_R, pcorr, zcoef, rho_L, & - & rho_R, pres_L, pres_R, E_L, E_R, H_L, H_R, gamma_L, gamma_R, pi_inf_L, pi_inf_R, qv_L, & - & qv_R, qv_avg, c_L, c_R, c_avg, vel_L_rms, vel_R_rms, vel_avg_rms, vel_L_tmp, vel_R_tmp, & - & Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, s_L, s_R, s_M, s_P, s_S, xi_M, & - & xi_P, xi_L, xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP, nbub_L, nbub_R, PbwR3Lbar, PbwR3Rbar, & - & R3Lbar, R3Rbar, R3V2Lbar, R3V2Rbar, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, & - & Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, R0_L, R0_R, V0_L, V0_R, P0_L, P0_R, pbw_L, pbw_R, vel, & + & rho_avg, alpha_L, alpha_R, h_avg, gamma_avg, Re_L, Re_R, pcorr, zcoef, rho, pres, E, H, & + & gamma, pi_inf, qv, qv_avg, c, c_avg, vel_rms, vel_avg_rms, vel_tmp, Ms_L, Ms_R, & + & pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, & + & xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP, nbub, PbwR3Lbar, PbwR3Rbar, R3Lbar, R3Rbar, & + & R3V2Lbar, R3V2Rbar, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, & + & Phi_avg, h_iL, h_iR, h_avg_2]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end - vel_L_rms = 0._wp; vel_R_rms = 0._wp - rho_L = 0._wp; rho_R = 0._wp - gamma_L = 0._wp; gamma_R = 0._wp - pi_inf_L = 0._wp; pi_inf_R = 0._wp - qv_L = 0._wp; qv_R = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp + rho%L = 0._wp; rho%R = 0._wp + gamma%L = 0._wp; gamma%R = 0._wp + pi_inf%L = 0._wp; pi_inf%R = 0._wp + qv%L = 0._wp; qv%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids @@ -2453,50 +2398,50 @@ contains alpha_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i) end do - vel_L_rms = 0._wp; vel_R_rms = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do ! Retain this in the refactor if (mpp_lim .and. (num_fluids > 2)) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + qL_prim_rsx_vf(${SF('')}$, i) - gamma_L = gamma_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) - pi_inf_L = pi_inf_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) - qv_L = qv_L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) - rho_R = rho_R + qR_prim_rsx_vf(${SF(' + 1')}$, i) - gamma_R = gamma_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) - pi_inf_R = pi_inf_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) - qv_R = qv_R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) + rho%L = rho%L + qL_prim_rsx_vf(${SF('')}$, i) + gamma%L = gamma%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) + pi_inf%L = pi_inf%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) + qv%L = qv%L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) + rho%R = rho%R + qR_prim_rsx_vf(${SF(' + 1')}$, i) + gamma%R = gamma%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) + pi_inf%R = pi_inf%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) + qv%R = qv%R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) end do else if (num_fluids > 2) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - 1 - rho_L = rho_L + qL_prim_rsx_vf(${SF('')}$, i) - gamma_L = gamma_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) - pi_inf_L = pi_inf_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) - qv_L = qv_L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) - rho_R = rho_R + qR_prim_rsx_vf(${SF(' + 1')}$, i) - gamma_R = gamma_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) - pi_inf_R = pi_inf_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) - qv_R = qv_R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) + rho%L = rho%L + qL_prim_rsx_vf(${SF('')}$, i) + gamma%L = gamma%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) + pi_inf%L = pi_inf%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) + qv%L = qv%L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) + rho%R = rho%R + qR_prim_rsx_vf(${SF(' + 1')}$, i) + gamma%R = gamma%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) + pi_inf%R = pi_inf%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) + qv%R = qv%R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) end do else - rho_L = qL_prim_rsx_vf(${SF('')}$, 1) - gamma_L = gammas(1) - pi_inf_L = pi_infs(1) - qv_L = qvs(1) - rho_R = qR_prim_rsx_vf(${SF(' + 1')}$, 1) - gamma_R = gammas(1) - pi_inf_R = pi_infs(1) - qv_R = qvs(1) + rho%L = qL_prim_rsx_vf(${SF('')}$, 1) + gamma%L = gammas(1) + pi_inf%L = pi_infs(1) + qv%L = qvs(1) + rho%R = qR_prim_rsx_vf(${SF(' + 1')}$, 1) + gamma%R = gammas(1) + pi_inf%R = pi_infs(1) + qv%R = qvs(1) end if if (viscous) then @@ -2523,14 +2468,14 @@ contains end if end if - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1_wp*rho_L*vel_L_rms - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1_wp*rho_R*vel_R_rms + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1_wp*rho%L*vel_rms%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1_wp*rho%R*vel_rms%R - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R if (avg_state == 2) then $:GPU_LOOP(parallelism='[seq]') @@ -2548,25 +2493,25 @@ contains if (.not. qbmm) then if (adv_n) then - nbub_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%n) - nbub_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%n) + nbub%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%n) + nbub%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%n) else - nbub_L = 0._wp - nbub_R = 0._wp + nbub%L = 0._wp + nbub%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, nb - nbub_L = nbub_L + (R0_L(i)**3._wp)*weight(i) - nbub_R = nbub_R + (R0_R(i)**3._wp)*weight(i) + nbub%L = nbub%L + (R0_L(i)**3._wp)*weight(i) + nbub%R = nbub%R + (R0_R(i)**3._wp)*weight(i) end do - nbub_L = (3._wp/(4._wp*pi))*qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + num_fluids)/nbub_L - nbub_R = (3._wp/(4._wp*pi))*qR_prim_rsx_vf(${SF(' + 1')}$, & - & eqn_idx%E + num_fluids)/nbub_R + nbub%L = (3._wp/(4._wp*pi))*qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + num_fluids)/nbub%L + nbub%R = (3._wp/(4._wp*pi))*qR_prim_rsx_vf(${SF(' + 1')}$, & + & eqn_idx%E + num_fluids)/nbub%R end if else ! nb stored in 0th moment of first R0 bin in variable conversion module - nbub_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%bub%beg) - nbub_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%bub%beg) + nbub%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%bub%beg) + nbub%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%bub%beg) end if $:GPU_LOOP(parallelism='[seq]') @@ -2609,27 +2554,27 @@ contains end do end if - rho_avg = 5.e-1_wp*(rho_L + rho_R) - H_avg = 5.e-1_wp*(H_L + H_R) - gamma_avg = 5.e-1_wp*(gamma_L + gamma_R) - qv_avg = 5.e-1_wp*(qv_L + qv_R) + rho_avg = 5.e-1_wp*(rho%L + rho%R) + H_avg = 5.e-1_wp*(H%L + H%R) + gamma_avg = 5.e-1_wp*(gamma%L + gamma%R) + qv_avg = 5.e-1_wp*(qv%L + qv%R) vel_avg_rms = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_avg_rms = vel_avg_rms + (5.e-1_wp*(vel_L(i) + vel_R(i)))**2._wp + vel_avg_rms = vel_avg_rms + (5.e-1_wp*(vel%L(i) + vel%R(i)))**2._wp end do end if - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, & - & c_L, qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, & + & c%L, qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, & - & c_R, qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, & + & c%R, qv%R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. - call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, vel_avg_rms, & + call s_compute_speed_of_sound(pres%R, rho_avg, gamma_avg, pi_inf%R, H_avg, alpha_R, vel_avg_rms, & & 0._wp, c_avg, qv_avg) if (viscous) then @@ -2645,39 +2590,39 @@ contains end if if (wave_speeds == 1) then - s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) - s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L) + s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) & - & - rho_R*vel_R(dir_idx(1))*(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L - vel_L(dir_idx(1))) & - & - rho_R*(s_R - vel_R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & + & - rho%R*(s_R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres_L + pres_R + rho_avg*c_avg*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) pres_SR = pres_SL ! Low Mach correction: Thornber et al. JCP (2008) Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_L)/(1._wp + gamma_L))*(pres_SL/pres_L - 1._wp) & - & *pres_L/((pres_L + pi_inf_L/(1._wp + gamma_L))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_R)/(1._wp + gamma_R))*(pres_SR/pres_R - 1._wp) & - & *pres_R/((pres_R + pi_inf_R/(1._wp + gamma_R))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel_L(dir_idx(1)) - c_L*Ms_L - s_R = vel_R(dir_idx(1)) + c_R*Ms_R + s_L = vel%L(dir_idx(1)) - c%L*Ms_L + s_R = vel%R(dir_idx(1)) + c%R*Ms_R - s_S = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + (pres_L - pres_R)/(rho_avg*c_avg)) + s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -2693,8 +2638,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do if (bubbles_euler .and. (num_fluids > 1)) then @@ -2708,52 +2653,52 @@ contains if (avg_state == 2) then if (alpha_L(num_fluids) < small_alf .or. R3Lbar < small_alf) then - pres_L = pres_L - alpha_L(num_fluids)*pres_L + pres%L = pres%L - alpha_L(num_fluids)*pres%L else - pres_L = pres_L - alpha_L(num_fluids)*(pres_L - PbwR3Lbar/R3Lbar - rho_L*R3V2Lbar/R3Lbar) + pres%L = pres%L - alpha_L(num_fluids)*(pres%L - PbwR3Lbar/R3Lbar - rho%L*R3V2Lbar/R3Lbar) end if if (alpha_R(num_fluids) < small_alf .or. R3Rbar < small_alf) then - pres_R = pres_R - alpha_R(num_fluids)*pres_R + pres%R = pres%R - alpha_R(num_fluids)*pres%R else - pres_R = pres_R - alpha_R(num_fluids)*(pres_R - PbwR3Rbar/R3Rbar - rho_R*R3V2Rbar/R3Rbar) + pres%R = pres%R - alpha_R(num_fluids)*(pres%R - PbwR3Rbar/R3Rbar - rho%R*R3V2Rbar/R3Rbar) end if end if $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(i) & + & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & & ) + s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & - & *vel_L(dir_idx(i))) - vel_L(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres_L)) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(i)) & + & *vel%L(dir_idx(i))) - vel%L(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres%L)) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) & & + s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & - & *vel_R(dir_idx(i))) - vel_R(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres_R)) & + & *vel%R(dir_idx(i))) - vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres%R)) & & + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr end do ! Energy flux. f = u*(E+p), q = E, q_star = \xi*E+(s-u)(\rho s_star + p/(s-u)) flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = xi_M*(vel_L(dir_idx(1))*(E_L + pres_L) + s_M*(xi_L*(E_L + (s_S & - & - vel_L(dir_idx(1)))*(rho_L*s_S + (pres_L)/(s_L - vel_L(dir_idx(1))))) - E_L)) & - & + xi_P*(vel_R(dir_idx(1))*(E_R + pres_R) + s_P*(xi_R*(E_R + (s_S - vel_R(dir_idx(1)) & - & )*(rho_R*s_S + (pres_R)/(s_R - vel_R(dir_idx(1))))) - E_R)) + (s_M/s_L)*(s_P/s_R) & + & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(xi_L*(E%L + (s_S & + & - vel%L(dir_idx(1)))*(rho%L*s_S + (pres%L)/(s_L - vel%L(dir_idx(1))))) - E%L)) & + & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(xi_R*(E%R + (s_S - vel%R(dir_idx(1)) & + & )*(rho%R*s_S + (pres%R)/(s_R - vel%R(dir_idx(1))))) - E%R)) + (s_M/s_L)*(s_P/s_R) & & *pcorr*s_S ! Volume fraction flux $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! Advection velocity source: interface velocity for volume fraction transport $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & - & dir_idx(i)) = xi_M*(vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & - & + xi_P*(vel_R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) + & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & + & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) ! IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0._wp end do @@ -2763,21 +2708,21 @@ contains ! Add advection flux for bubble variables $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%bub%beg, eqn_idx%bub%end - flux_rsx_vf(${SF('')}$, i) = xi_M*nbub_L*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub_R*qR_prim_rsx_vf(${SF(' + 1')}$, i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + flux_rsx_vf(${SF('')}$, i) = xi_M*nbub%L*qL_prim_rsx_vf(${SF('')}$, & + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*nbub%R*qR_prim_rsx_vf(${SF(' + 1')}$, i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do if (qbmm) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%bub%beg) = xi_M*nbub_L*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub_R*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%bub%beg) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end if if (adv_n) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%n) = xi_M*nbub_L*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub_R*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%n) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end if ! Geometrical source flux for cylindrical coordinates @@ -2790,12 +2735,12 @@ contains end do ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho_L*(vel_L(dir_idx(1)) & - & *vel_L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & - & - dir_flg(dir_idx(1)))*vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & + & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end @@ -2811,12 +2756,12 @@ contains end do flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%mom%beg + 1) = -xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(1) & + & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & - xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if #:endif @@ -2826,23 +2771,21 @@ contains $:END_GPU_PARALLEL_LOOP() else ! 5-equation model (model_eqns=2): mixture total energy, volume fraction advection - $:GPU_PARALLEL_LOOP(collapse=3, private='[Re_max, i, q, T_L, T_R, vel_L_rms, vel_R_rms, pres_L, pres_R, & - & rho_L, gamma_L, pi_inf_L, qv_L, rho_R, gamma_R, pi_inf_R, qv_R, alpha_L_sum, & - & alpha_R_sum, E_L, E_R, MW_L, MW_R, R_gas_L, R_gas_R, Cp_L, Cp_R, Cv_L, Cv_R, Gamm_L, & - & Gamm_R, Y_L, Y_R, H_L, H_R, qv_avg, rho_avg, gamma_avg, H_avg, c_L, c_R, c_avg, s_P, & - & s_M, xi_P, xi_M, xi_L, xi_R, xi_L_m1, xi_R_m1, Ms_L, Ms_R, pres_SL, pres_SR, vel_L, & - & vel_R, Re_L, Re_R, alpha_L, alpha_R, s_L, s_R, s_S, vel_avg_rms, pcorr, zcoef, & - & vel_L_tmp, vel_R_tmp, Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, & - & tau_e_L, tau_e_R, xi_field_L, xi_field_R, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, G_L, & - & G_R]', copyin='[is1, is2, is3]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[Re_max, i, q, T, vel_rms, pres, rho, gamma, pi_inf, qv, & + & alpha_L_sum, alpha_R_sum, E, MW, R_gas, Cp, Cv, Gamm, Y, H, qv_avg, rho_avg, gamma_avg, & + & H_avg, c, c_avg, s_P, s_M, xi_P, xi_M, xi_L, xi_R, xi_L_m1, xi_R_m1, Ms_L, Ms_R, & + & pres_SL, pres_SR, vel, Re_L, Re_R, alpha_L, alpha_R, s_L, s_R, s_S, vel_avg_rms, pcorr, & + & zcoef, vel_tmp, Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, tau_e_L, & + & tau_e_R, xi_field_L, xi_field_R, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, G]', & + & copyin='[is1, is2, is3]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end - vel_L_rms = 0._wp; vel_R_rms = 0._wp - rho_L = 0._wp; rho_R = 0._wp - gamma_L = 0._wp; gamma_R = 0._wp - pi_inf_L = 0._wp; pi_inf_R = 0._wp - qv_L = 0._wp; qv_R = 0._wp + vel_rms%L = 0._wp; vel_rms%R = 0._wp + rho%L = 0._wp; rho%R = 0._wp + gamma%L = 0._wp; gamma%R = 0._wp + pi_inf%L = 0._wp; pi_inf%R = 0._wp + qv%L = 0._wp; qv%R = 0._wp alpha_L_sum = 0._wp; alpha_R_sum = 0._wp $:GPU_LOOP(parallelism='[seq]') @@ -2853,14 +2796,14 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) - vel_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) - vel_L_rms = vel_L_rms + vel_L(i)**2._wp - vel_R_rms = vel_R_rms + vel_R(i)**2._wp + vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + i) + vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + i) + vel_rms%L = vel_rms%L + vel%L(i)**2._wp + vel_rms%R = vel_rms%R + vel%R(i)**2._wp end do - pres_L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) - pres_R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) + pres%L = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E) + pres%R = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E) ! Change this by splitting it into the cases present in the bubbles_euler if (mpp_lim) then @@ -2887,15 +2830,15 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - rho_L = rho_L + qL_prim_rsx_vf(${SF('')}$, i) - gamma_L = gamma_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) - pi_inf_L = pi_inf_L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) - qv_L = qv_L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) - - rho_R = rho_R + qR_prim_rsx_vf(${SF(' + 1')}$, i) - gamma_R = gamma_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) - pi_inf_R = pi_inf_R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) - qv_R = qv_R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) + rho%L = rho%L + qL_prim_rsx_vf(${SF('')}$, i) + gamma%L = gamma%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*gammas(i) + pi_inf%L = pi_inf%L + qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + i)*pi_infs(i) + qv%L = qv%L + qL_prim_rsx_vf(${SF('')}$, i)*qvs(i) + + rho%R = rho%R + qR_prim_rsx_vf(${SF(' + 1')}$, i) + gamma%R = gamma%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*gammas(i) + pi_inf%R = pi_inf%R + qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + i)*pi_infs(i) + qv%R = qv%R + qR_prim_rsx_vf(${SF(' + 1')}$, i)*qvs(i) end do Re_max = 0 @@ -2927,57 +2870,57 @@ contains Ys_R(i - eqn_idx%species%beg + 1) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - call get_mixture_molecular_weight(Ys_L, MW_L) - call get_mixture_molecular_weight(Ys_R, MW_R) + call get_mixture_molecular_weight(Ys_L, MW%L) + call get_mixture_molecular_weight(Ys_R, MW%R) #:if USING_AMD - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights_nonparameter(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights_nonparameter(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights_nonparameter(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights_nonparameter(:) #:else - Xs_L(:) = Ys_L(:)*MW_L/molecular_weights(:) - Xs_R(:) = Ys_R(:)*MW_R/molecular_weights(:) + Xs_L(:) = Ys_L(:)*MW%L/molecular_weights(:) + Xs_R(:) = Ys_R(:)*MW%R/molecular_weights(:) #:endif - R_gas_L = gas_constant/MW_L - R_gas_R = gas_constant/MW_R + R_gas%L = gas_constant/MW%L + R_gas%R = gas_constant/MW%R - T_L = pres_L/rho_L/R_gas_L - T_R = pres_R/rho_R/R_gas_R + T%L = pres%L/rho%L/R_gas%L + T%R = pres%R/rho%R/R_gas%R - call get_species_specific_heats_r(T_L, Cp_iL) - call get_species_specific_heats_r(T_R, Cp_iR) + call get_species_specific_heats_r(T%L, Cp_iL) + call get_species_specific_heats_r(T%R, Cp_iR) if (chem_params%gamma_method == 1) then !> gamma_method = 1: Ref. Section 2.3.1 Formulation of doi:10.7907/ZKW8-ES97. Gamma_iL = Cp_iL/(Cp_iL - 1.0_wp) Gamma_iR = Cp_iR/(Cp_iR - 1.0_wp) - gamma_L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) - gamma_R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) + gamma%L = sum(Xs_L(:)/(Gamma_iL(:) - 1.0_wp)) + gamma%R = sum(Xs_R(:)/(Gamma_iR(:) - 1.0_wp)) else if (chem_params%gamma_method == 2) then !> gamma_method = 2: c_p / c_v where c_p, c_v are specific heats. - call get_mixture_specific_heat_cp_mass(T_L, Ys_L, Cp_L) - call get_mixture_specific_heat_cp_mass(T_R, Ys_R, Cp_R) - call get_mixture_specific_heat_cv_mass(T_L, Ys_L, Cv_L) - call get_mixture_specific_heat_cv_mass(T_R, Ys_R, Cv_R) + call get_mixture_specific_heat_cp_mass(T%L, Ys_L, Cp%L) + call get_mixture_specific_heat_cp_mass(T%R, Ys_R, Cp%R) + call get_mixture_specific_heat_cv_mass(T%L, Ys_L, Cv%L) + call get_mixture_specific_heat_cv_mass(T%R, Ys_R, Cv%R) - Gamm_L = Cp_L/Cv_L; Gamm_R = Cp_R/Cv_R - gamma_L = 1.0_wp/(Gamm_L - 1.0_wp); gamma_R = 1.0_wp/(Gamm_R - 1.0_wp) + Gamm%L = Cp%L/Cv%L; Gamm%R = Cp%R/Cv%R + gamma%L = 1.0_wp/(Gamm%L - 1.0_wp); gamma%R = 1.0_wp/(Gamm%R - 1.0_wp) end if - call get_mixture_energy_mass(T_L, Ys_L, E_L) - call get_mixture_energy_mass(T_R, Ys_R, E_R) + call get_mixture_energy_mass(T%L, Ys_L, E%L) + call get_mixture_energy_mass(T%R, Ys_R, E%R) - E_L = rho_L*E_L + 5.e-1*rho_L*vel_L_rms - E_R = rho_R*E_R + 5.e-1*rho_R*vel_R_rms - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + E%L = rho%L*E%L + 5.e-1*rho%L*vel_rms%L + E%R = rho%R*E%R + 5.e-1*rho%R*vel_rms%R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R else - E_L = gamma_L*pres_L + pi_inf_L + 5.e-1*rho_L*vel_L_rms + qv_L - E_R = gamma_R*pres_R + pi_inf_R + 5.e-1*rho_R*vel_R_rms + qv_R + E%L = gamma%L*pres%L + pi_inf%L + 5.e-1*rho%L*vel_rms%L + qv%L + E%R = gamma%R*pres%R + pi_inf%R + 5.e-1*rho%R*vel_rms%R + qv%R - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R end if ! ENERGY ADJUSTMENTS FOR HYPOELASTIC ENERGY @@ -2987,23 +2930,23 @@ contains tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do - G_L = 0._wp - G_R = 0._wp + G%L = 0._wp + G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! Elastic contribution to energy if G large enough - if ((G_L > verysmall) .and. (G_R > verysmall)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + if ((G%L > verysmall) .and. (G%R > verysmall)) then + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) ! Additional terms in 2D and 3D if ((i == 2) .or. (i == 4) .or. (i == 5)) then - E_L = E_L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G_L) - E_R = E_R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G_R) + E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) + E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) end if end if end do @@ -3016,18 +2959,18 @@ contains xi_field_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) xi_field_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) end do - G_L = 0._wp - G_R = 0._wp + G%L = 0._wp + G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids ! Mixture left and right shear modulus - G_L = G_L + alpha_L(i)*Gs_rs(i) - G_R = G_R + alpha_R(i)*Gs_rs(i) + G%L = G%L + alpha_L(i)*Gs_rs(i) + G%R = G%R + alpha_R(i)*Gs_rs(i) end do ! Elastic contribution to energy if G large enough - if (G_L > verysmall .and. G_R > verysmall) then - E_L = E_L + G_L*qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%end + 1) - E_R = E_R + G_R*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%end + 1) + if (G%L > verysmall .and. G%R > verysmall) then + E%L = E%L + G%L*qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%end + 1) + E%R = E%R + G%R*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%end + 1) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, b_size - 1 @@ -3036,25 +2979,25 @@ contains end do end if - H_L = (E_L + pres_L)/rho_L - H_R = (E_R + pres_R)/rho_R + H%L = (E%L + pres%L)/rho%L + H%R = (E%R + pres%R)/rho%R @:compute_average_state() - call s_compute_speed_of_sound(pres_L, rho_L, gamma_L, pi_inf_L, H_L, alpha_L, vel_L_rms, 0._wp, & - & c_L, qv_L) + call s_compute_speed_of_sound(pres%L, rho%L, gamma%L, pi_inf%L, H%L, alpha_L, vel_rms%L, 0._wp, & + & c%L, qv%L) - call s_compute_speed_of_sound(pres_R, rho_R, gamma_R, pi_inf_R, H_R, alpha_R, vel_R_rms, 0._wp, & - & c_R, qv_R) + call s_compute_speed_of_sound(pres%R, rho%R, gamma%R, pi_inf%R, H%R, alpha_R, vel_rms%R, 0._wp, & + & c%R, qv%R) !> The computation of c_avg does not require all the variables, and therefore the non '_avg' ! variables are placeholders to call the subroutine. - call s_compute_speed_of_sound(pres_R, rho_avg, gamma_avg, pi_inf_R, H_avg, alpha_R, vel_avg_rms, & + call s_compute_speed_of_sound(pres%R, rho_avg, gamma_avg, pi_inf%R, H_avg, alpha_R, vel_avg_rms, & & c_sum_Yi_Phi, c_avg, qv_avg) if (viscous) then if (chemistry) then - call compute_viscosity_and_inversion(T_L, Ys_L, T_R, Ys_R, Re_L(1), Re_R(1)) + call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re_L(1), Re_R(1)) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 @@ -3070,53 +3013,53 @@ contains if (wave_speeds == 1) then if (elasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel_L(dir_idx(1)) - sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) + tau_e_L(dir_idx_tau(1) & - & ))/rho_L), & - & vel_R(dir_idx(1)) - sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) & - & + tau_e_R(dir_idx_tau(1)))/rho_R)) - s_R = max(vel_R(dir_idx(1)) + sqrt(c_R*c_R + (((4._wp*G_R)/3._wp) + tau_e_R(dir_idx_tau(1) & - & ))/rho_R), & - & vel_L(dir_idx(1)) + sqrt(c_L*c_L + (((4._wp*G_L)/3._wp) & - & + tau_e_L(dir_idx_tau(1)))/rho_L)) - s_S = (pres_R - tau_e_R(dir_idx_tau(1)) - pres_L + tau_e_L(dir_idx_tau(1)) & - & + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) - rho_R*vel_R(dir_idx(1)) & - & *(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L - vel_L(dir_idx(1))) - rho_R*(s_R & - & - vel_R(dir_idx(1)))) + s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1) & + & ))/rho%L), & + & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) & + & + tau_e_R(dir_idx_tau(1)))/rho%R)) + s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1) & + & ))/rho%R), & + & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) & + & + tau_e_L(dir_idx_tau(1)))/rho%L)) + s_S = (pres%R - tau_e_R(dir_idx_tau(1)) - pres%L + tau_e_L(dir_idx_tau(1)) & + & + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & + & *(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) - rho%R*(s_R & + & - vel%R(dir_idx(1)))) else - s_L = min(vel_L(dir_idx(1)) - c_L, vel_R(dir_idx(1)) - c_R) - s_R = max(vel_R(dir_idx(1)) + c_R, vel_L(dir_idx(1)) + c_L) - s_S = (pres_R - pres_L + rho_L*vel_L(dir_idx(1))*(s_L - vel_L(dir_idx(1))) & - & - rho_R*vel_R(dir_idx(1))*(s_R - vel_R(dir_idx(1))))/(rho_L*(s_L & - & - vel_L(dir_idx(1))) - rho_R*(s_R - vel_R(dir_idx(1)))) + s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L & + & - vel%L(dir_idx(1))) - rho%R*(s_R - vel%R(dir_idx(1)))) end if else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres_L + pres_R + rho_avg*c_avg*(vel_L(dir_idx(1)) - vel_R(dir_idx(1)))) + pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) pres_SR = pres_SL ! Low Mach correction: Thornber et al. JCP (2008) Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_L)/(1._wp + gamma_L))*(pres_SL/pres_L - 1._wp) & - & *pres_L/((pres_L + pi_inf_L/(1._wp + gamma_L))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma_R)/(1._wp + gamma_R))*(pres_SR/pres_R - 1._wp) & - & *pres_R/((pres_R + pi_inf_R/(1._wp + gamma_R))))) + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel_L(dir_idx(1)) - c_L*Ms_L - s_R = vel_R(dir_idx(1)) + c_R*Ms_R + s_L = vel%L(dir_idx(1)) - c%L*Ms_L + s_R = vel%R(dir_idx(1)) + c%R*Ms_R - s_S = 5.e-1_wp*((vel_L(dir_idx(1)) + vel_R(dir_idx(1))) + (pres_L - pres_R)/(rho_avg*c_avg)) + s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) ! xi_L/R - 1 = (s_S - u_L/R)/(s_L/R - s_star): avoids cancellation when xi \approx 1 - xi_L_m1 = (s_S - vel_L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel_R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) + xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -3133,8 +3076,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! MOMENTUM FLUX. f = \rho u u - \sigma, q = \rho u, q_star = \xi * \rho*(s_star, v, w) identity: @@ -3142,21 +3085,21 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(i) & + & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & & ) + s_M*(dir_flg(dir_idx(i))*s_L + (1._wp - dir_flg(dir_idx(i))) & - & *vel_L(dir_idx(i)))*xi_L_m1) + dir_flg(dir_idx(i))*(pres_L)) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(i)) + s_P*(dir_flg(dir_idx(i)) & - & *s_R + (1._wp - dir_flg(dir_idx(i)))*vel_R(dir_idx(i)))*xi_R_m1) & - & + dir_flg(dir_idx(i))*(pres_R)) + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr + & *vel%L(dir_idx(i)))*xi_L_m1) + dir_flg(dir_idx(i))*(pres%L)) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) + s_P*(dir_flg(dir_idx(i)) & + & *s_R + (1._wp - dir_flg(dir_idx(i)))*vel%R(dir_idx(i)))*xi_R_m1) & + & + dir_flg(dir_idx(i))*(pres%R)) + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr end do ! ENERGY FLUX. f = u*(E-\sigma), q = E, q_star = \xi*E+(s-u)(\rho s_star - \sigma/(s-u)) ! xi*(E+expr)-E = E*xi_m1 + xi*expr avoids E*(xi-1) cancellation flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = xi_M*(vel_L(dir_idx(1))*(E_L + pres_L) + s_M*(E_L*xi_L_m1 + xi_L*(s_S & - & - vel_L(dir_idx(1)))*(rho_L*s_S + pres_L/(s_L - vel_L(dir_idx(1)))))) & - & + xi_P*(vel_R(dir_idx(1))*(E_R + pres_R) + s_P*(E_R*xi_R_m1 + xi_R*(s_S & - & - vel_R(dir_idx(1)))*(rho_R*s_S + pres_R/(s_R - vel_R(dir_idx(1)))))) + (s_M/s_L) & + & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(E%L*xi_L_m1 + xi_L*(s_S & + & - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s_L - vel%L(dir_idx(1)))))) & + & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(E%R*xi_R_m1 + xi_R*(s_S & + & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s_R - vel%R(dir_idx(1)))))) + (s_M/s_L) & & *(s_P/s_R)*pcorr*s_S ! ELASTICITY. Elastic shear stress additions for the momentum and energy flux @@ -3169,11 +3112,11 @@ contains & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e_L(dir_idx_tau(i)) & & - xi_P*tau_e_R(dir_idx_tau(i)) ! ENERGY ELASTIC FLUX. - flux_ene_e = flux_ene_e - xi_M*(vel_L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & - & + s_M*(xi_L*((s_S - vel_L(i))*(tau_e_L(dir_idx_tau(i)) & - & /(s_L - vel_L(i)))))) - xi_P*(vel_R(dir_idx(i)) & - & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel_R(i)) & - & *(tau_e_R(dir_idx_tau(i))/(s_R - vel_R(i)))))) + flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & + & + s_M*(xi_L*((s_S - vel%L(i))*(tau_e_L(dir_idx_tau(i)) & + & /(s_L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & + & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel%R(i)) & + & *(tau_e_R(dir_idx_tau(i))/(s_R - vel%R(i)))))) end do flux_rsx_vf(${SF('')}$, eqn_idx%E) = flux_rsx_vf(${SF('')}$, eqn_idx%E) + flux_ene_e end if @@ -3183,9 +3126,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho_L*tau_e_L(i) & - & - rho_L*vel_L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho_R*tau_e_R(i) - rho_R*vel_R(dir_idx(1))*tau_e_R(i)) + & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*tau_e_L(i) & + & - rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & + & *(s_R*rho%R*tau_e_R(i) - rho%R*vel%R(dir_idx(1))*tau_e_R(i)) end do end if @@ -3193,23 +3136,23 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end do ! VOLUME FRACTION SOURCE FLUX. $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & - & dir_idx(i)) = xi_M*(vel_L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & - & + xi_P*(vel_R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) + & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & + & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) end do ! COLOR FUNCTION FLUX if (surface_tension) then flux_rsx_vf(${SF('')}$, eqn_idx%c) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & eqn_idx%c)*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%c)*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%c)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%c)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) end if ! Hyperelastic reference map flux for material deformation tracking @@ -3217,9 +3160,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho_L*xi_field_L(i) & - & - rho_L*vel_L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho_R*xi_field_R(i) - rho_R*vel_R(dir_idx(1))*xi_field_R(i)) + & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*xi_field_L(i) & + & - rho%L*vel%L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & + & *(s_R*rho%R*xi_field_R(i) - rho%R*vel%R(dir_idx(1))*xi_field_R(i)) end do end if @@ -3228,12 +3171,12 @@ contains if (chemistry) then $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%species%beg, eqn_idx%species%end - Y_L = qL_prim_rsx_vf(${SF('')}$, i) - Y_R = qR_prim_rsx_vf(${SF(' + 1')}$, i) + Y%L = qL_prim_rsx_vf(${SF('')}$, i) + Y%R = qR_prim_rsx_vf(${SF(' + 1')}$, i) flux_rsx_vf(${SF('')}$, & - & i) = xi_M*rho_L*Y_L*(vel_L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*rho_R*Y_R*(vel_R(dir_idx(1)) + s_P*xi_R_m1) + & i) = xi_M*rho%L*Y%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & + xi_P*rho%R*Y%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) flux_src_rsx_vf(${SF('')}$, i) = 0.0_wp end do end if @@ -3248,12 +3191,12 @@ contains end do ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho_L*(vel_L(dir_idx(1)) & - & *vel_L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & - & - dir_flg(dir_idx(1)))*vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & + xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & + & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end @@ -3269,12 +3212,12 @@ contains end do flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%mom%beg + 1) = -xi_M*(rho_L*(vel_L(dir_idx(1))*vel_L(dir_idx(1) & + & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_L(dir_idx(1))) - vel_L(dir_idx(1))))) & - & - xi_P*(rho_R*(vel_R(dir_idx(1))*vel_R(dir_idx(1)) & + & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & + & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & - & *vel_R(dir_idx(1))) - vel_R(dir_idx(1))))) + & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if #:endif @@ -3391,7 +3334,7 @@ contains alpha_rho_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, i) end do - ! NOTE: unlike HLL & HLLC, vel_L here is permutated by dir_idx for simpler logic + ! NOTE: unlike HLL & HLLC, vel%L here is permutated by dir_idx for simpler logic do i = 1, num_vels vel%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%cont%end + dir_idx(i)) vel%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%cont%end + dir_idx(i)) From 04a22708d2e2578073a69761c8b95bab61f3f86b Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 17:48:21 -0500 Subject: [PATCH 18/20] fix: add GPU_DECLARE for bc struct in OpenACC builds to fix CCE error Cray ftn (CCE) requires globals accessed in GPU accelerator routines to have ! declare directives. bc (type bc_xyz_info) was declared for OpenMP but omitted from the OpenACC block, causing: ftn-7066 ftn: ERROR S_SLIP_WALL: Global in accelerator routine without declare -- bc Add $:GPU_DECLARE(create='[bc]') to the MFC_OpenACC branch alongside the existing OpenMP declaration. --- src/simulation/m_global_parameters.fpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index 0f8d12f4c7..6b4d07b140 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -210,6 +210,7 @@ module m_global_parameters type(bc_dir_t) :: ib_bc_x, ib_bc_y, ib_bc_z !> @} #if defined(MFC_OpenACC) + $:GPU_DECLARE(create='[bc]') $:GPU_DECLARE(create='[ib_bc_x%beg, ib_bc_y%beg, ib_bc_z%beg]') #elif defined(MFC_OpenMP) $:GPU_DECLARE(create='[bc]') From 6d7f21d2c74667e028b3f27a4db0bd335d3044de Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 18:04:36 -0500 Subject: [PATCH 19/20] refactor: convert remaining _L/_R scalar/fixed-array vars to riemann_states structs Extend the riemann_states refactor to cover wave speeds, intermediate states, stress tensor, Reynolds numbers, and HLLD state vectors: s_L/R -> s%L/R (type riemann_states) Ms_L/R -> Ms%L/R pres_SL/SR -> pres_S%L/R flux_tau_L/R -> flux_tau%L/R xi_L/R -> xi%L/R (HLLC) xi_L/R_m1 -> xi_m1%L/R (HLLC) pTot_L/R -> pTot%L/R (HLLD) rhoL/R_star -> rho_star%L/R (HLLD) E_starL/R -> E_star%L/R (HLLD) vL/R_star -> v_star%L/R (HLLD) wL/R_star -> w_star%L/R (HLLD) tau_e_L/R(i) -> tau_e%L/R(i) (type riemann_states_arr6) Re_L/R(i) -> Re%L/R(i) (type riemann_states_arr2) xi_field_L/R -> xi_field%L/R (riemann_states_vec3) U_L/R etc. -> U%L/R etc. (type riemann_states_arr7, HLLD) Variable-size arrays (alpha_L/R, Ys_L/R, etc.) are left as-is since they require allocatable components or Fypp-conditional sizing. Also exclude fp-stability-logs/ and scripts/ from typos spell check. --- .typos.toml | 2 +- src/common/m_derived_types.fpp | 15 + src/simulation/include/inline_riemann.fpp | 4 +- src/simulation/m_riemann_solvers.fpp | 1011 ++++++++++----------- 4 files changed, 519 insertions(+), 513 deletions(-) diff --git a/.typos.toml b/.typos.toml index 595090c271..bc494096ac 100644 --- a/.typos.toml +++ b/.typos.toml @@ -31,4 +31,4 @@ tru = "tru" # typo for "true" in "when_tru" - tests dependency keys PNGs = "PNGs" [files] -extend-exclude = ["docs/documentation/references*", "docs/references.bib", "tests/", "toolchain/cce_simulation_workgroup_256.sh", "build-docs/", "build/", "build_test/"] +extend-exclude = ["docs/documentation/references*", "docs/references.bib", "tests/", "toolchain/cce_simulation_workgroup_256.sh", "build-docs/", "build/", "build_test/", "fp-stability-logs/", "scripts/"] diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index d552a3205b..e3589c2927 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -98,6 +98,21 @@ module m_derived_types real(wp) :: R(3) end type riemann_states_vec3 + !> Left and right Riemann states for 2-element fixed arrays + type riemann_states_arr2 + real(wp) :: L(2), R(2) + end type riemann_states_arr2 + + !> Left and right Riemann states for 6-element fixed arrays + type riemann_states_arr6 + real(wp) :: L(6), R(6) + end type riemann_states_arr6 + + !> Left and right Riemann states for 7-element fixed arrays + type riemann_states_arr7 + real(wp) :: L(7), R(7) + end type riemann_states_arr7 + !> Lightweight beg/end pair for equation index ranges (no BC payload). type idx_bounds_info integer :: beg diff --git a/src/simulation/include/inline_riemann.fpp b/src/simulation/include/inline_riemann.fpp index bd67afc381..609ff4a3b0 100644 --- a/src/simulation/include/inline_riemann.fpp +++ b/src/simulation/include/inline_riemann.fpp @@ -104,8 +104,8 @@ pcorr = 0._wp if (low_Mach == 1) then - pcorr = rho%L*rho%R*(s_L - vel%L(dir_idx(1)))*(s_R - vel%R(dir_idx(1)))*(vel%R(dir_idx(1)) - vel%L(dir_idx(1))) & - & /(rho%R*(s_R - vel%R(dir_idx(1))) - rho%L*(s_L - vel%L(dir_idx(1))))*(zcoef - 1._wp) + pcorr = rho%L*rho%R*(s%L - vel%L(dir_idx(1)))*(s%R - vel%R(dir_idx(1)))*(vel%R(dir_idx(1)) - vel%L(dir_idx(1))) & + & /(rho%R*(s%R - vel%R(dir_idx(1))) - rho%L*(s%L - vel%L(dir_idx(1))))*(zcoef - 1._wp) else if (low_Mach == 2) then vel_tmp%L = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + zcoef*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) vel_tmp%R = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + zcoef*(vel%R(dir_idx(1)) - vel%L(dir_idx(1)))) diff --git a/src/simulation/m_riemann_solvers.fpp b/src/simulation/m_riemann_solvers.fpp index dd9965f0f2..9b27b1cd50 100644 --- a/src/simulation/m_riemann_solvers.fpp +++ b/src/simulation/m_riemann_solvers.fpp @@ -138,7 +138,7 @@ contains ! Intercell fluxes type(scalar_field), dimension(sys_size), intent(inout) :: flux_vf, flux_src_vf, flux_gsrc_vf - real(wp) :: flux_tau_L, flux_tau_R + type(riemann_states) :: flux_tau integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz @@ -161,18 +161,19 @@ contains type(riemann_states) :: pi_inf, qv, c, G, ptilde type(riemann_states) :: vel_rms, vel_tmp real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi - real(wp), dimension(6) :: tau_e_L, tau_e_R - real(wp), dimension(2) :: Re_L, Re_R - real(wp), dimension(3) :: xi_field_L, xi_field_R + type(riemann_states_arr6) :: tau_e + type(riemann_states_arr2) :: Re + type(riemann_states_vec3) :: xi_field real(wp) :: rho_avg real(wp) :: H_avg real(wp) :: qv_avg real(wp) :: gamma_avg real(wp) :: c_avg real(wp) :: vel_avg_rms - real(wp) :: s_L, s_R, s_M, s_P, s_S + real(wp) :: s_M, s_P, s_S + type(riemann_states) :: s real(wp) :: xi_M, xi_P - real(wp) :: Ms_L, Ms_R, pres_SL, pres_SR + type(riemann_states) :: Ms, pres_S real(wp) :: alpha_L_sum, alpha_R_sum real(wp) :: zcoef, pcorr !< low Mach number correction type(riemann_states) :: c_fast, pres_mag @@ -196,13 +197,12 @@ contains #:set SV = STENCIL_VAR #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, & - & tau_e_L, tau_e_R, Re_L, Re_R, s_L, s_R, s_S, Ys_L, Ys_R, xi_field_L, xi_field_R, Cp_iL, & - & Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, c_fast, & - & pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, vel_tmp, rho, pres, E, H, Cp_avg, Cv_avg, & - & T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Cv, Gamm, gamma, pi_inf, qv, qv_avg, c, G, & - & rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, vel_avg_rms, Ms_L, Ms_R, pres_SL, & - & pres_SR, alpha_L_sum, alpha_R_sum, flux_tau_L, flux_tau_R]', copyin='[norm_dir]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, tau_e, & + & Re, s, s_S, Ys_L, Ys_R, xi_field, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, & + & Phi_avg, h_iL, h_iR, h_avg_2, c_fast, pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, & + & vel_tmp, rho, pres, E, H, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, & + & Cv, Gamm, gamma, pi_inf, qv, qv_avg, c, G, rho_avg, H_avg, c_avg, gamma_avg, ptilde, & + & vel_rms, vel_avg_rms, Ms, pres_S, alpha_L_sum, alpha_R_sum, flux_tau]', copyin='[norm_dir]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -296,20 +296,20 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_L(i) = dflt_real - Re_R(i) = dflt_real + Re%L(i) = dflt_real + Re%R(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0._wp - if (Re_size(i) > 0) Re_R(i) = 0._wp + if (Re_size(i) > 0) Re%L(i) = 0._wp + if (Re_size(i) > 0) Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re_L(i) - Re_R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re_R(i) + Re%L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re%L(i) + Re%R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do end if @@ -426,16 +426,16 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) ! Elastic contribution to energy if G large enough TODO take out if statement if stable without if ((G%L > 1000) .and. (G%R > 1000)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) ! Double for shear stresses if (any(eqn_idx%stress%beg - 1 + i == shear_indices)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) end if end if end do @@ -462,11 +462,11 @@ contains if (viscous) then if (chemistry) then - call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re_L(1), Re_R(1)) + call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re%L(1), Re%R(1)) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) + Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re%L(i) + 1._wp/Re%R(i)) end do end if @@ -474,64 +474,64 @@ contains if (wave_speeds == 1) then if (mhd) then ! MHD: use fast magnetosonic speed - s_L = min(vel%L(dir_idx(1)) - c_fast%L, vel%R(dir_idx(1)) - c_fast%R) - s_R = max(vel%R(dir_idx(1)) + c_fast%R, vel%L(dir_idx(1)) + c_fast%L) + s%L = min(vel%L(dir_idx(1)) - c_fast%L, vel%R(dir_idx(1)) - c_fast%R) + s%R = max(vel%R(dir_idx(1)) + c_fast%R, vel%L(dir_idx(1)) + c_fast%L) else if (hypoelasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1))) & + s%L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e%L(dir_idx_tau(1))) & & /rho%L), & - & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1))) & + & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e%R(dir_idx_tau(1))) & & /rho%R)) - s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1))) & + s%R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e%R(dir_idx_tau(1))) & & /rho%R), & - & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1))) & + & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e%L(dir_idx_tau(1))) & & /rho%L)) else if (hyperelasticity) then - s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (4._wp*G%L/3._wp)/rho%L), & + s%L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (4._wp*G%L/3._wp)/rho%L), & & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (4._wp*G%R/3._wp)/rho%R)) - s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (4._wp*G%R/3._wp)/rho%R), & + s%R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (4._wp*G%R/3._wp)/rho%R), & & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (4._wp*G%L/3._wp)/rho%L)) else - s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) - s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s%L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s%R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) end if if (hyper_cleaning) then ! Dedner GLM divergence cleaning, Dedner et al. JCP (2002) - s_L = min(s_L, -hyper_cleaning_speed) - s_R = max(s_R, hyper_cleaning_speed) + s%L = min(s%L, -hyper_cleaning_speed) + s%R = max(s%R, hyper_cleaning_speed) end if - s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & - & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & - & - rho%R*(s_R - vel%R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L - vel%L(dir_idx(1))) & + & - rho%R*(s%R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + pres_S%L = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) - pres_SR = pres_SL + pres_S%R = pres_S%L ! Low Mach correction: Thornber et al. JCP (2008) - Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + Ms%L = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_S%L/pres%L - 1._wp) & & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) - Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + Ms%R = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_S%R/pres%R - 1._wp) & & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel%L(dir_idx(1)) - c%L*Ms_L - s_R = vel%R(dir_idx(1)) + c%R*Ms_R + s%L = vel%L(dir_idx(1)) - c%L*Ms%L + s%R = vel%R(dir_idx(1)) + c%R*Ms%R s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if - s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) + s_M = min(0._wp, s%L); s_P = max(0._wp, s%R) - xi_M = (5.e-1_wp + sign(5.e-1_wp, s_L)) + (5.e-1_wp - sign(5.e-1_wp, s_L))*(5.e-1_wp + sign(5.e-1_wp, & - & s_R)) - xi_P = (5.e-1_wp - sign(5.e-1_wp, s_R)) + (5.e-1_wp - sign(5.e-1_wp, s_L))*(5.e-1_wp + sign(5.e-1_wp, & - & s_R)) + xi_M = (5.e-1_wp + sign(5.e-1_wp, s%L)) + (5.e-1_wp - sign(5.e-1_wp, s%L))*(5.e-1_wp + sign(5.e-1_wp, & + & s%R)) + xi_P = (5.e-1_wp - sign(5.e-1_wp, s%R)) + (5.e-1_wp - sign(5.e-1_wp, s%L))*(5.e-1_wp + sign(5.e-1_wp, & + & s%R)) - ! HLL intercell flux: F* = (s_R*F_L - s_L*F_R + s_L*s_R*(U_R - U_L)) / (s_R - s_L) Low Mach correction + ! HLL intercell flux: F* = (s%R*F%L - s%L*F%R + s%L*s%R*(U%R - U%L)) / (s%R - s%L) Low Mach correction if (low_Mach == 1) then @:compute_low_Mach_correction() else @@ -587,16 +587,16 @@ contains & + dir_flg(dir_idx(i))*(pres%R - ptilde%R)) - s_P*(rho%L*vel%L(dir_idx(1)) & & *vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres%L - ptilde%L)) & & + s_M*s_P*(rho%L*vel%L(dir_idx(i)) - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) & - & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) + & + (s_M/s%L)*(s_P/s%R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do else if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres%R - tau_e_R(dir_idx_tau(i))) & + & + dir_flg(dir_idx(i))*pres%R - tau_e%R(dir_idx_tau(i))) & & - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*pres%L & - & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - tau_e%L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) end do else @@ -606,7 +606,7 @@ contains & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & & + dir_flg(dir_idx(i))*pres%R) - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) & & + dir_flg(dir_idx(i))*pres%L) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & - & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R) & & *pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do end if @@ -630,23 +630,23 @@ contains else if (bubbles_euler) then flux_rsx_vf(${SF('')}$, & & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R - ptilde%R) - s_P*vel%L(dir_idx(1) & - & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R) & & *pcorr*(vel_rms%R - vel_rms%L)/2._wp else if (hypoelasticity) then - flux_tau_L = 0._wp; flux_tau_R = 0._wp + flux_tau%L = 0._wp; flux_tau%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel%L(dir_idx(i)) - flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel%R(dir_idx(i)) + flux_tau%L = flux_tau%L + tau_e%L(dir_idx_tau(i))*vel%L(dir_idx(i)) + flux_tau%R = flux_tau%R + tau_e%R(dir_idx_tau(i))*vel%R(dir_idx(i)) end do flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau_R) & - & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau_L) + s_M*s_P*(E%L - E%R))/(s_M & + & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau%R) & + & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau%L) + s_M*s_P*(E%L - E%R))/(s_M & & - s_P) else flux_rsx_vf(${SF('')}$, & & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R) - s_P*vel%L(dir_idx(1))*(E%L & - & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_rms%R & + & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R)*pcorr*(vel_rms%R & & - vel_rms%L)/2._wp end if @@ -654,9 +654,9 @@ contains if (hypoelasticity) then do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! TODO: this indexing may be slow flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e_R(i)) & - & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho%L*tau_e_L(i) & - & - rho%R*tau_e_R(i)))/(s_M - s_P) + & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e%R(i)) & + & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e%L(i)) + s_M*s_P*(rho%L*tau_e%L(i) & + & - rho%R*tau_e%R(i)))/(s_M - s_P) end do end if @@ -750,7 +750,7 @@ contains if (cyl_coord .and. hypoelasticity) then ! += tau_sigmasigma using HLL flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%cont%end + 2) = flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + 2) + (s_M*tau_e_R(4) - s_P*tau_e_L(4))/(s_M - s_P) + & eqn_idx%cont%end + 2) + (s_M*tau_e%R(4) - s_P*tau_e%L(4))/(s_M - s_P) $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%stress%beg, eqn_idx%stress%end @@ -807,7 +807,7 @@ contains ! Intercell fluxes type(scalar_field), dimension(sys_size), intent(inout) :: flux_vf, flux_src_vf, flux_gsrc_vf - real(wp) :: flux_tau_L, flux_tau_R + type(riemann_states) :: flux_tau integer, intent(in) :: norm_dir type(int_bounds_info), intent(in) :: ix, iy, iz @@ -833,18 +833,19 @@ contains type(riemann_states) :: pi_inf, qv, c, G, ptilde type(riemann_states) :: vel_rms, vel_tmp real(wp) :: Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi - real(wp), dimension(6) :: tau_e_L, tau_e_R - real(wp), dimension(2) :: Re_L, Re_R - real(wp), dimension(3) :: xi_field_L, xi_field_R + type(riemann_states_arr6) :: tau_e + type(riemann_states_arr2) :: Re + type(riemann_states_vec3) :: xi_field real(wp) :: rho_avg real(wp) :: H_avg real(wp) :: qv_avg real(wp) :: gamma_avg real(wp) :: c_avg real(wp) :: vel_avg_rms - real(wp) :: s_L, s_R, s_M, s_P, s_S + real(wp) :: s_M, s_P, s_S + type(riemann_states) :: s real(wp) :: xi_M, xi_P - real(wp) :: Ms_L, Ms_R, pres_SL, pres_SR + type(riemann_states) :: Ms, pres_S real(wp) :: alpha_L_sum, alpha_R_sum real(wp) :: zcoef, pcorr !< low Mach number correction type(riemann_states) :: c_fast, pres_mag @@ -869,13 +870,13 @@ contains #:set SV = STENCIL_VAR #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, & - & tau_e_L, tau_e_R, G, Re_L, Re_R, rho_avg, h_avg, gamma_avg, s_L, s_R, s_S, Ys_L, Ys_R, & - & xi_field_L, xi_field_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, & - & h_iL, h_iR, h_avg_2, c_fast, pres_mag, B, Ga, vdotB, B2, b4, cm, pcorr, zcoef, vel_grad_L, & - & vel_grad_R, idx_right_phys, vel_rms, vel_avg_rms, vel_tmp, Ms_L, Ms_R, pres_SL, pres_SR, & - & alpha_L_sum, alpha_R_sum, c_avg, pres, rho, gamma, pi_inf, qv, c, E, H, ptilde, s_M, s_P, & - & xi_M, xi_P, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, Cp, Cv, R_gas, MW, T, Y]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, tau_e, & + & G, Re, rho_avg, h_avg, gamma_avg, s, s_S, Ys_L, Ys_R, xi_field, Cp_iL, Cp_iR, Xs_L, Xs_R, & + & Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, c_fast, pres_mag, B, Ga, vdotB, & + & B2, b4, cm, pcorr, zcoef, vel_grad_L, vel_grad_R, idx_right_phys, vel_rms, vel_avg_rms, & + & vel_tmp, Ms, pres_S, alpha_L_sum, alpha_R_sum, c_avg, pres, rho, gamma, pi_inf, qv, c, E, & + & H, ptilde, s_M, s_P, xi_M, xi_P, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, Cp, Cv, R_gas, & + & MW, T, Y]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -969,20 +970,20 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_L(i) = dflt_real - Re_R(i) = dflt_real + Re%L(i) = dflt_real + Re%R(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0._wp - if (Re_size(i) > 0) Re_R(i) = 0._wp + if (Re_size(i) > 0) Re%L(i) = 0._wp + if (Re_size(i) > 0) Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re_L(i) - Re_R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re_R(i) + Re%L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re%L(i) + Re%R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do end if @@ -1096,16 +1097,16 @@ contains end if do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) ! Elastic contribution to energy if G large enough TODO take out if statement if stable without if ((G%L > 1000) .and. (G%R > 1000)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) ! Double for shear stresses if (any(eqn_idx%stress%beg - 1 + i == shear_indices)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) end if end if end do @@ -1122,22 +1123,22 @@ contains call s_compute_fast_magnetosonic_speed(rho%R, c%R, B%R, norm_dir, c_fast%R, H%R) end if - s_L = 0._wp; s_R = 0._wp + s%L = 0._wp; s%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - s_L = s_L + vel%L(i)**2._wp - s_R = s_R + vel%R(i)**2._wp + s%L = s%L + vel%L(i)**2._wp + s%R = s%R + vel%R(i)**2._wp end do - s_L = sqrt(s_L) - s_R = sqrt(s_R) + s%L = sqrt(s%L) + s%R = sqrt(s%R) - s_P = max(s_L, s_R) + max(c%L, c%R) + s_P = max(s%L, s%R) + max(c%L, c%R) s_M = -s_P - s_L = s_M - s_R = s_P + s%L = s_M + s%R = s_P ! Low Mach correction if (low_Mach == 1) then @@ -1195,16 +1196,16 @@ contains & + dir_flg(dir_idx(i))*(pres%R - ptilde%R)) - s_P*(rho%L*vel%L(dir_idx(1)) & & *vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*(pres%L - ptilde%L)) & & + s_M*s_P*(rho%L*vel%L(dir_idx(i)) - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) & - & + (s_M/s_L)*(s_P/s_R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) + & + (s_M/s%L)*(s_P/s%R)*pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do else if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_vels flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*pres%R - tau_e_R(dir_idx_tau(i))) & + & + dir_flg(dir_idx(i))*pres%R - tau_e%R(dir_idx_tau(i))) & & - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*pres%L & - & - tau_e_L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & + & - tau_e%L(dir_idx_tau(i))) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) end do else @@ -1214,7 +1215,7 @@ contains & eqn_idx%cont%end + dir_idx(i)) = (s_M*(rho%R*vel%R(dir_idx(1))*vel%R(dir_idx(i)) & & + dir_flg(dir_idx(i))*pres%R) - s_P*(rho%L*vel%L(dir_idx(1))*vel%L(dir_idx(i)) & & + dir_flg(dir_idx(i))*pres%L) + s_M*s_P*(rho%L*vel%L(dir_idx(i)) & - & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & - rho%R*vel%R(dir_idx(i))))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R) & & *pcorr*(vel%R(dir_idx(i)) - vel%L(dir_idx(i))) end do end if @@ -1238,23 +1239,23 @@ contains else if (bubbles_euler) then flux_rsx_vf(${SF('')}$, & & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R - ptilde%R) - s_P*vel%L(dir_idx(1) & - & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R) & + & )*(E%L + pres%L - ptilde%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R) & & *pcorr*(vel_rms%R - vel_rms%L)/2._wp else if (hypoelasticity) then - flux_tau_L = 0._wp; flux_tau_R = 0._wp + flux_tau%L = 0._wp; flux_tau%R = 0._wp $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - flux_tau_L = flux_tau_L + tau_e_L(dir_idx_tau(i))*vel%L(dir_idx(i)) - flux_tau_R = flux_tau_R + tau_e_R(dir_idx_tau(i))*vel%R(dir_idx(i)) + flux_tau%L = flux_tau%L + tau_e%L(dir_idx_tau(i))*vel%L(dir_idx(i)) + flux_tau%R = flux_tau%R + tau_e%R(dir_idx_tau(i))*vel%R(dir_idx(i)) end do flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau_R) & - & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau_L) + s_M*s_P*(E%L - E%R))/(s_M & + & eqn_idx%E) = (s_M*(vel%R(dir_idx(1))*(E%R + pres%R) - flux_tau%R) & + & - s_P*(vel%L(dir_idx(1))*(E%L + pres%L) - flux_tau%L) + s_M*s_P*(E%L - E%R))/(s_M & & - s_P) else flux_rsx_vf(${SF('')}$, & & eqn_idx%E) = (s_M*vel%R(dir_idx(1))*(E%R + pres%R) - s_P*vel%L(dir_idx(1))*(E%L & - & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s_L)*(s_P/s_R)*pcorr*(vel_rms%R & + & + pres%L) + s_M*s_P*(E%L - E%R))/(s_M - s_P) + (s_M/s%L)*(s_P/s%R)*pcorr*(vel_rms%R & & - vel_rms%L)/2._wp end if @@ -1262,9 +1263,9 @@ contains if (hypoelasticity) then do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! TODO: this indexing may be slow flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e_R(i)) & - & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + s_M*s_P*(rho%L*tau_e_L(i) & - & - rho%R*tau_e_R(i)))/(s_M - s_P) + & eqn_idx%stress%beg - 1 + i) = (s_M*(rho%R*vel%R(dir_idx(1))*tau_e%R(i)) & + & - s_P*(rho%L*vel%L(dir_idx(1))*tau_e%L(i)) + s_M*s_P*(rho%L*tau_e%L(i) & + & - rho%R*tau_e%R(i)))/(s_M - s_P) end do end if @@ -1343,7 +1344,7 @@ contains if (cyl_coord .and. hypoelasticity) then ! += tau_sigmasigma using HLL flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%cont%end + 2) = flux_gsrc_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + 2) + (s_M*tau_e_R(4) - s_P*tau_e_L(4))/(s_M - s_P) + & eqn_idx%cont%end + 2) + (s_M*tau_e%R(4) - s_P*tau_e%L(4))/(s_M - s_P) $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%stress%beg, eqn_idx%stress%end @@ -1360,7 +1361,7 @@ contains if (viscous) then $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, idx_right_phys, vel_grad_L, vel_grad_R, alpha_L, alpha_R, vel, & - & Re_L, Re_R]', copyin='[norm_dir]') + & Re]', copyin='[norm_dir]') do l = isz%beg, isz%end do k = isy%beg, isy%end do j = isx%beg, isx%end @@ -1408,39 +1409,39 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_L(i) = dflt_real - Re_R(i) = dflt_real + Re%L(i) = dflt_real + Re%R(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0._wp - if (Re_size(i) > 0) Re_R(i) = 0._wp + if (Re_size(i) > 0) Re%L(i) = 0._wp + if (Re_size(i) > 0) Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re_L(i) - Re_R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re_R(i) + Re%L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re%L(i) + Re%R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do if (shear_stress) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_grad_L(i, 1) = (dqL_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(1)) + vel_grad_L(i, 1) = (dqL_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(1)) vel_grad_R(i, 1) = (dqR_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(1)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(1)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (num_dims > 1) then - vel_grad_L(i, 2) = (dqL_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(1)) + vel_grad_L(i, 2) = (dqL_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(1)) vel_grad_R(i, 2) = (dqR_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(1)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(1)) end if #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then - vel_grad_L(i, 3) = (dqL_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(1)) + vel_grad_L(i, 3) = (dqL_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(1)) vel_grad_R(i, 3) = (dqR_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(1)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(1)) end if #:endif #:endif @@ -1558,21 +1559,21 @@ contains if (bulk_stress) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - vel_grad_L(i, 1) = (dqL_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(2)) + vel_grad_L(i, 1) = (dqL_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(2)) vel_grad_R(i, 1) = (dqR_prim_dx_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(2)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(2)) #:if not MFC_CASE_OPTIMIZATION or num_dims > 1 if (num_dims > 1) then - vel_grad_L(i, 2) = (dqL_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(2)) + vel_grad_L(i, 2) = (dqL_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(2)) vel_grad_R(i, 2) = (dqR_prim_dy_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(2)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(2)) end if #:endif #:if not MFC_CASE_OPTIMIZATION or num_dims > 2 if (num_dims > 2) then - vel_grad_L(i, 3) = (dqL_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re_L(2)) + vel_grad_L(i, 3) = (dqL_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)/Re%L(2)) vel_grad_R(i, 3) = (dqR_prim_dz_vf(eqn_idx%mom%beg + i - 1)%sf(idx_right_phys(1), & - & idx_right_phys(2), idx_right_phys(3))/Re_R(2)) + & idx_right_phys(2), idx_right_phys(3))/Re%R(2)) end if #:endif end do @@ -1697,33 +1698,29 @@ contains type(riemann_states) :: pi_inf, qv, c, G, ptilde, nbub type(riemann_states) :: vel_rms, vel_tmp real(wp) :: Cp_avg, Cv_avg, T_avg, c_sum_Yi_Phi, eps - real(wp), dimension(2) :: Re_L, Re_R - real(wp), dimension(6) :: tau_e_L, tau_e_R - #:if not MFC_CASE_OPTIMIZATION and USING_AMD - real(wp), dimension(3) :: xi_field_L, xi_field_R - #:else - real(wp), dimension(num_dims) :: xi_field_L, xi_field_R - #:endif - real(wp) :: rho_avg - real(wp) :: H_avg - real(wp) :: gamma_avg - real(wp) :: qv_avg - real(wp) :: c_avg - real(wp) :: vel_avg_rms - real(wp) :: s_L, s_R, s_M, s_P, s_S - real(wp) :: xi_L, xi_R !< Left and right wave speeds functions - real(wp) :: xi_L_m1, xi_R_m1 !< xi_L/R - 1, computed without cancellation - real(wp) :: xi_M, xi_P - real(wp) :: xi_MP, xi_PP - real(wp) :: alpha_L_sum, alpha_R_sum - real(wp) :: PbwR3Lbar, PbwR3Rbar - real(wp) :: R3Lbar, R3Rbar - real(wp) :: R3V2Lbar, R3V2Rbar - real(wp) :: rho_Star, E_Star, p_Star, p_K_Star, vel_K_star - real(wp) :: pres_SL, pres_SR, Ms_L, Ms_R - real(wp) :: flux_ene_e - real(wp) :: zcoef, pcorr !< low Mach number correction - integer :: Re_max, i, j, k, l, q !< Generic loop iterators + type(riemann_states_arr2) :: Re + type(riemann_states_arr6) :: tau_e + type(riemann_states_vec3) :: xi_field + real(wp) :: rho_avg + real(wp) :: H_avg + real(wp) :: gamma_avg + real(wp) :: qv_avg + real(wp) :: c_avg + real(wp) :: vel_avg_rms + real(wp) :: s_M, s_P, s_S + type(riemann_states) :: s + type(riemann_states) :: xi, xi_m1 !< Left and right wave speeds functions / xi - 1 + real(wp) :: xi_M, xi_P + real(wp) :: xi_MP, xi_PP + real(wp) :: alpha_L_sum, alpha_R_sum + real(wp) :: PbwR3Lbar, PbwR3Rbar + real(wp) :: R3Lbar, R3Rbar + real(wp) :: R3V2Lbar, R3V2Rbar + real(wp) :: rho_Star, E_Star, p_Star, p_K_Star, vel_K_star + type(riemann_states) :: pres_S, Ms + real(wp) :: flux_ene_e + real(wp) :: zcoef, pcorr !< low Mach number correction + integer :: Re_max, i, j, k, l, q !< Generic loop iterators ! Populating the buffers of the left and right Riemann problem states variables, based on the choice of boundary conditions call s_populate_riemann_states_variables_buffers(qL_prim_rsx_vf, dqL_prim_dx_vf, dqL_prim_dy_vf, dqL_prim_dz_vf, & @@ -1743,14 +1740,13 @@ contains ! 6-EQUATION MODEL WITH HLLC HLLC star-state flux with contact wave speed s_S if (model_eqns == 3) then ! 6-equation model (model_eqns=3): separate phasic internal energies - $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, vel, Re_L, Re_R, alpha_L, alpha_R, Ys_L, Ys_R, Xs_L, & - & Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, tau_e_L, & - & tau_e_R, flux_ene_e, xi_field_L, xi_field_R, pcorr, zcoef, rho, pres, E, H, Cp_avg, & - & Cv_avg, T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Cv, Gamm, gamma, pi_inf, qv, & - & qv_avg, c, G, rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, vel_avg_rms, vel_tmp, & - & Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, rho_Star, E_Star, p_Star, & - & p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, xi_R, xi_L_m1, & - & xi_R_m1, xi_MP, xi_PP]') + $:GPU_PARALLEL_LOOP(collapse=3, private='[i, j, k, l, q, vel, Re, alpha_L, alpha_R, Ys_L, Ys_R, Xs_L, Xs_R, & + & Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, tau_e, & + & flux_ene_e, xi_field, pcorr, zcoef, rho, pres, E, H, Cp_avg, Cv_avg, T_avg, eps, & + & c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Cv, Gamm, gamma, pi_inf, qv, qv_avg, c, G, rho_avg, & + & H_avg, c_avg, gamma_avg, ptilde, vel_rms, vel_avg_rms, vel_tmp, Ms, pres_S, & + & alpha_L_sum, alpha_R_sum, rho_Star, E_Star, p_Star, p_K_Star, vel_K_star, s, s_M, s_P, & + & s_S, xi_M, xi_P, xi, xi_m1, xi_MP, xi_PP]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -1830,18 +1826,18 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_L(i) = dflt_real - Re_R(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0._wp - if (Re_size(i) > 0) Re_R(i) = 0._wp + Re%L(i) = dflt_real + Re%R(i) = dflt_real + if (Re_size(i) > 0) Re%L(i) = 0._wp + if (Re_size(i) > 0) Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + Re_idx(i, q))/Res_gs(i, q) + Re_L(i) - Re_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + Re_idx(i, q))/Res_gs(i, & - & q) + Re_R(i) + Re%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + Re_idx(i, q))/Res_gs(i, q) + Re%L(i) + Re%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + Re_idx(i, q))/Res_gs(i, & + & q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do end if @@ -1852,8 +1848,8 @@ contains if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') @@ -1865,12 +1861,12 @@ contains do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! Elastic contribution to energy if G large enough if ((G%L > verysmall) .and. (G%R > verysmall)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) ! Additional terms in 2D and 3D if ((i == 2) .or. (i == 4) .or. (i == 5)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) end if end if end do @@ -1880,8 +1876,8 @@ contains if (hyperelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - xi_field_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) - xi_field_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) + xi_field%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) + xi_field%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) end do G%L = 0._wp; G%R = 0._wp $:GPU_LOOP(parallelism='[seq]') @@ -1897,8 +1893,8 @@ contains end if $:GPU_LOOP(parallelism='[seq]') do i = 1, b_size - 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do end if @@ -1921,7 +1917,7 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) + Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re%L(i) + 1._wp/Re%R(i)) end do end if @@ -1934,68 +1930,68 @@ contains if (wave_speeds == 1) then if (elasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1) & + s%L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e%L(dir_idx_tau(1) & & ))/rho%L), & & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) & - & + tau_e_R(dir_idx_tau(1)))/rho%R)) - s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1) & + & + tau_e%R(dir_idx_tau(1)))/rho%R)) + s%R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e%R(dir_idx_tau(1) & & ))/rho%R), & & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) & - & + tau_e_L(dir_idx_tau(1)))/rho%L)) - s_S = (pres%R - tau_e_R(dir_idx_tau(1)) - pres%L + tau_e_L(dir_idx_tau(1)) & - & + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & - & *(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) - rho%R*(s_R & + & + tau_e%L(dir_idx_tau(1)))/rho%L)) + s_S = (pres%R - tau_e%R(dir_idx_tau(1)) - pres%L + tau_e%L(dir_idx_tau(1)) & + & + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & + & *(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L - vel%L(dir_idx(1))) - rho%R*(s%R & & - vel%R(dir_idx(1)))) else - s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) - s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & - & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L & - & - vel%L(dir_idx(1))) - rho%R*(s_R - vel%R(dir_idx(1)))) + s%L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s%R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L & + & - vel%L(dir_idx(1))) - rho%R*(s%R - vel%R(dir_idx(1)))) end if else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + pres_S%L = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) - pres_SR = pres_SL + pres_S%R = pres_S%L ! Low Mach correction: Thornber et al. JCP (2008) - Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + Ms%L = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_S%L/pres%L - 1._wp) & & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) - Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + Ms%R = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_S%R/pres%R - 1._wp) & & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel%L(dir_idx(1)) - c%L*Ms_L - s_R = vel%R(dir_idx(1)) + c%R*Ms_R + s%L = vel%L(dir_idx(1)) - c%L*Ms%L + s%R = vel%R(dir_idx(1)) + c%R*Ms%R s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if - ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) - s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) + ! follows Einfeldt et al. s_M/P = min/max(0.,s%L/R) + s_M = min(0._wp, s%L); s_P = max(0._wp, s%R) - ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + ! goes with q_star_L/R = xi%L/R * (variable) xi%L/R = ( ( s%L/R - u_L/R )/(s%L/R - s_star) ) + xi%L = (s%L - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi%R = (s%R - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) + xi_m1%L = (s_S - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi_m1%R = (s_S - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) ! goes with numerical star velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(0.5_wp, s_S)) xi_P = (5.e-1_wp - sign(0.5_wp, s_S)) ! goes with the numerical velocity in x/y/z directions xi_P/M (pressure) = min/max(0. sgn(1,sL/sR)) - xi_MP = -min(0._wp, sign(1._wp, s_L)) - xi_PP = max(0._wp, sign(1._wp, s_R)) + xi_MP = -min(0._wp, sign(1._wp, s%L)) + xi_PP = max(0._wp, sign(1._wp, s%R)) - E_star = xi_M*(E%L + xi_MP*(xi_L*(E%L + (s_S - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s_L & - & - vel%L(dir_idx(1))))) - E%L)) + xi_P*(E%R + xi_PP*(xi_R*(E%R + (s_S & - & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s_R - vel%R(dir_idx(1))))) - E%R)) - p_Star = xi_M*(pres%L + xi_MP*(rho%L*(s_L - vel%L(dir_idx(1)))*(s_S - vel%L(dir_idx(1))))) & - & + xi_P*(pres%R + xi_PP*(rho%R*(s_R - vel%R(dir_idx(1)))*(s_S - vel%R(dir_idx(1))))) + E_star = xi_M*(E%L + xi_MP*(xi%L*(E%L + (s_S - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s%L & + & - vel%L(dir_idx(1))))) - E%L)) + xi_P*(E%R + xi_PP*(xi%R*(E%R + (s_S & + & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s%R - vel%R(dir_idx(1))))) - E%R)) + p_Star = xi_M*(pres%L + xi_MP*(rho%L*(s%L - vel%L(dir_idx(1)))*(s_S - vel%L(dir_idx(1))))) & + & + xi_P*(pres%R + xi_PP*(rho%R*(s%R - vel%R(dir_idx(1)))*(s_S - vel%R(dir_idx(1))))) - rho_Star = xi_M*(rho%L*(xi_MP*xi_L + 1._wp - xi_MP)) + xi_P*(rho%R*(xi_PP*xi_R + 1._wp - xi_PP)) + rho_Star = xi_M*(rho%L*(xi_MP*xi%L + 1._wp - xi_MP)) + xi_P*(rho%R*(xi_PP*xi%R + 1._wp - xi_PP)) vel_K_Star = vel%L(dir_idx(1))*(1._wp - xi_MP) + xi_MP*vel%R(dir_idx(1)) + xi_MP*xi_PP*(s_S & & - vel%R(dir_idx(1))) @@ -2011,8 +2007,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! MOMENTUM FLUX. f = \rho u u - \sigma, q = \rho u, q_star = \xi * \rho*(s_star, v, w) @@ -2021,12 +2017,12 @@ contains flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = rho_Star*vel_K_Star*(dir_flg(dir_idx(i)) & & *vel_K_Star + (1._wp - dir_flg(dir_idx(i)))*(xi_M*vel%L(dir_idx(i)) & - & + xi_P*vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star + (s_M/s_L)*(s_P/s_R) & + & + xi_P*vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*p_Star + (s_M/s%L)*(s_P/s%R) & & *dir_flg(dir_idx(i))*pcorr end do ! ENERGY FLUX. f = u*(E-\sigma), q = E, q_star = \xi*E+(s-u)(\rho s_star - \sigma/(s-u)) - flux_rsx_vf(${SF('')}$, eqn_idx%E) = (E_star + p_Star)*vel_K_Star + (s_M/s_L)*(s_P/s_R)*pcorr*s_S + flux_rsx_vf(${SF('')}$, eqn_idx%E) = (E_star + p_Star)*vel_K_Star + (s_M/s%L)*(s_P/s%R)*pcorr*s_S ! ELASTICITY. Elastic shear stress additions for the momentum and energy flux if (elasticity) then @@ -2035,14 +2031,14 @@ contains do i = 1, num_dims ! MOMENTUM ELASTIC FLUX. flux_rsx_vf(${SF('')}$, eqn_idx%cont%end + dir_idx(i)) = flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e_L(dir_idx_tau(i)) & - & - xi_P*tau_e_R(dir_idx_tau(i)) + & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e%L(dir_idx_tau(i)) & + & - xi_P*tau_e%R(dir_idx_tau(i)) ! ENERGY ELASTIC FLUX. - flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & - & + s_M*(xi_L*((s_S - vel%L(i))*(tau_e_L(dir_idx_tau(i)) & - & /(s_L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & - & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel%R(i)) & - & *(tau_e_R(dir_idx_tau(i))/(s_R - vel%R(i)))))) + flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e%L(dir_idx_tau(i)) & + & + s_M*(xi%L*((s_S - vel%L(i))*(tau_e%L(dir_idx_tau(i)) & + & /(s%L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & + & *tau_e%R(dir_idx_tau(i)) + s_P*(xi%R*((s_S - vel%R(i)) & + & *(tau_e%R(dir_idx_tau(i))/(s%R - vel%R(i)))))) end do flux_rsx_vf(${SF('')}$, eqn_idx%E) = flux_rsx_vf(${SF('')}$, eqn_idx%E) + flux_ene_e end if @@ -2059,18 +2055,18 @@ contains do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i)) & - & *(s_S*(xi_MP*xi_L_m1 + 1) - vel%L(dir_idx(i)))) + xi_P*(vel%R(dir_idx(i)) & - & + dir_flg(dir_idx(i))*(s_S*(xi_PP*xi_R_m1 + 1) - vel%R(dir_idx(i)))) + & *(s_S*(xi_MP*xi_m1%L + 1) - vel%L(dir_idx(i)))) + xi_P*(vel%R(dir_idx(i)) & + & + dir_flg(dir_idx(i))*(s_S*(xi_PP*xi_m1%R + 1) - vel%R(dir_idx(i)))) end do ! INTERNAL ENERGIES ADVECTION FLUX. K-th pressure and velocity in preparation for the internal ! energy flux $:GPU_LOOP(parallelism='[seq]') do i = 1, num_fluids - p_K_Star = xi_M*(xi_MP*((pres%L + pi_infs(i)/(1._wp + gammas(i)))*xi_L**(1._wp/gammas(i) & + p_K_Star = xi_M*(xi_MP*((pres%L + pi_infs(i)/(1._wp + gammas(i)))*xi%L**(1._wp/gammas(i) & & + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres%L) + pres%L) & & + xi_P*(xi_PP*((pres%R + pi_infs(i)/(1._wp + gammas(i))) & - & *xi_R**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres%R) & + & *xi%R**(1._wp/gammas(i) + 1._wp) - pi_infs(i)/(1._wp + gammas(i)) - pres%R) & & + pres%R) flux_rsx_vf(${SF('')}$, i + eqn_idx%int_en%beg - 1) = ((xi_M*qL_prim_rsx_vf(${SF('')}$, & @@ -2078,7 +2074,7 @@ contains & i + eqn_idx%adv%beg - 1))*(gammas(i)*p_K_Star + pi_infs(i)) & & + (xi_M*qL_prim_rsx_vf(${SF('')}$, & & i + eqn_idx%cont%beg - 1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i + eqn_idx%cont%beg - 1))*qvs(i))*vel_K_Star + (s_M/s_L)*(s_P/s_R) & + & i + eqn_idx%cont%beg - 1))*qvs(i))*vel_K_Star + (s_M/s%L)*(s_P/s%R) & & *pcorr*s_S*(xi_M*qL_prim_rsx_vf(${SF('')}$, & & i + eqn_idx%adv%beg - 1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & & i + eqn_idx%adv%beg - 1)) @@ -2091,9 +2087,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*tau_e_L(i) & - & - rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho%R*tau_e_R(i) - rho%R*vel%R(dir_idx(1))*tau_e_R(i)) + & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s%L - s_S))*(s%L*rho%L*tau_e%L(i) & + & - rho%L*vel%L(dir_idx(1))*tau_e%L(i)) + xi_P*(s_S/(s%R - s_S)) & + & *(s%R*rho%R*tau_e%R(i) - rho%R*vel%R(dir_idx(1))*tau_e%R(i)) end do end if @@ -2102,9 +2098,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*xi_field_L(i) & - & - rho%L*vel%L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho%R*xi_field_R(i) - rho%R*vel%R(dir_idx(1))*xi_field_R(i)) + & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s%L - s_S))*(s%L*rho%L*xi_field%L(i) & + & - rho%L*vel%L(dir_idx(1))*xi_field%L(i)) + xi_P*(s_S/(s%R - s_S)) & + & *(s%R*rho%R*xi_field%R(i) - rho%R*vel%R(dir_idx(1))*xi_field%R(i)) end do end if @@ -2159,10 +2155,9 @@ contains $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, nbub, rho, & & pres, E, H, Cp_avg, Cv_avg, T_avg, eps, c_sum_Yi_Phi, T, Y, MW, R_gas, Cp, Gamm, gamma, & & pi_inf, qv, qv_avg, c, G, rho_avg, H_avg, c_avg, gamma_avg, ptilde, vel_rms, & - & vel_avg_rms, vel_tmp, Ms_L, Ms_R, pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, rho_Star, & - & E_Star, p_Star, p_K_Star, vel_K_star, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, xi_R, & - & xi_L_m1, xi_R_m1, xi_MP, xi_PP, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, & - & Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') + & vel_avg_rms, vel_tmp, Ms, pres_S, alpha_L_sum, alpha_R_sum, rho_Star, E_Star, p_Star, & + & p_K_Star, vel_K_star, s, s_M, s_P, s_S, xi_M, xi_P, xi, xi_m1, xi_MP, xi_PP, Ys_L, & + & Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -2234,39 +2229,39 @@ contains & 0._wp, c_avg, qv_avg) if (wave_speeds == 1) then - s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) - s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s%L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s%R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & - & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & - & - rho%R*(s_R - vel%R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L - vel%L(dir_idx(1))) & + & - rho%R*(s%R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + pres_S%L = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) - pres_SR = pres_SL + pres_S%R = pres_S%L ! Low Mach correction: Thornber et al. JCP (2008) - Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + Ms%L = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_S%L/pres%L - 1._wp) & & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) - Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + Ms%R = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_S%R/pres%R - 1._wp) & & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel%L(dir_idx(1)) - c%L*Ms_L - s_R = vel%R(dir_idx(1)) + c%R*Ms_R + s%L = vel%L(dir_idx(1)) - c%L*Ms%L + s%R = vel%R(dir_idx(1)) + c%R*Ms%R s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if - ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) - s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) + ! follows Einfeldt et al. s_M/P = min/max(0.,s%L/R) + s_M = min(0._wp, s%L); s_P = max(0._wp, s%R) - ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + ! goes with q_star_L/R = xi%L/R * (variable) xi%L/R = ( ( s%L/R - u_L/R )/(s%L/R - s_star) ) + xi%L = (s%L - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi%R = (s%R - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) + xi_m1%L = (s_S - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi_m1%R = (s_S - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -2275,8 +2270,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, & - & i) = xi_M*alpha_rho_L(i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*alpha_rho_R(i) & - & *(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i) = xi_M*alpha_rho_L(i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*alpha_rho_R(i) & + & *(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! Momentum flux. f = \rho u u + p I, q = \rho u, q_star = \xi * \rho*(s_star, v, w) @@ -2284,10 +2279,10 @@ contains do i = 1, num_dims flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & - & ) + s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & + & ) + s_M*(xi%L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & & *vel%L(dir_idx(i))) - vel%L(dir_idx(i)))) + dir_flg(dir_idx(i))*pres%L) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) & - & + s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & + & + s_P*(xi%R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & & *vel%R(dir_idx(i))) - vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*pres%R) end do @@ -2306,8 +2301,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%alf, eqn_idx%alf ! only advect the void fraction flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! Advection velocity source: interface velocity for volume fraction transport @@ -2324,9 +2319,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%bub%beg, eqn_idx%bub%end flux_rsx_vf(${SF('')}$, i) = xi_M*nbub%L*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & & + xi_P*nbub%R*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do end if @@ -2342,10 +2337,10 @@ contains ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & - & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & *vel%L(dir_idx(1)) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp & & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') @@ -2362,10 +2357,10 @@ contains end do flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & - & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & ) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if @@ -2377,12 +2372,11 @@ contains else if (model_eqns == 2 .and. bubbles_euler) then ! 5-equation model with Euler-Euler bubble dynamics $:GPU_PARALLEL_LOOP(collapse=3, private='[i, q, R0_L, R0_R, V0_L, V0_R, P0_L, P0_R, pbw_L, pbw_R, vel, & - & rho_avg, alpha_L, alpha_R, h_avg, gamma_avg, Re_L, Re_R, pcorr, zcoef, rho, pres, E, H, & - & gamma, pi_inf, qv, qv_avg, c, c_avg, vel_rms, vel_avg_rms, vel_tmp, Ms_L, Ms_R, & - & pres_SL, pres_SR, alpha_L_sum, alpha_R_sum, s_L, s_R, s_M, s_P, s_S, xi_M, xi_P, xi_L, & - & xi_R, xi_L_m1, xi_R_m1, xi_MP, xi_PP, nbub, PbwR3Lbar, PbwR3Rbar, R3Lbar, R3Rbar, & - & R3V2Lbar, R3V2Rbar, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Yi_avg, & - & Phi_avg, h_iL, h_iR, h_avg_2]') + & rho_avg, alpha_L, alpha_R, h_avg, gamma_avg, Re, pcorr, zcoef, rho, pres, E, H, gamma, & + & pi_inf, qv, qv_avg, c, c_avg, vel_rms, vel_avg_rms, vel_tmp, Ms, pres_S, alpha_L_sum, & + & alpha_R_sum, s, s_M, s_P, s_S, xi_M, xi_P, xi, xi_m1, xi_MP, xi_PP, nbub, PbwR3Lbar, & + & PbwR3Rbar, R3Lbar, R3Rbar, R3V2Lbar, R3V2Rbar, Ys_L, Ys_R, Cp_iL, Cp_iR, Xs_L, Xs_R, & + & Gamma_iL, Gamma_iR, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -2448,22 +2442,22 @@ contains if (num_fluids == 1) then ! Need to consider case with num_fluids >= 2 $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_L(i) = dflt_real - Re_R(i) = dflt_real + Re%L(i) = dflt_real + Re%R(i) = dflt_real - if (Re_size(i) > 0) Re_L(i) = 0._wp - if (Re_size(i) > 0) Re_R(i) = 0._wp + if (Re_size(i) > 0) Re%L(i) = 0._wp + if (Re_size(i) > 0) Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = (1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + Re_idx(i, & - & q)))/Res_gs(i, q) + Re_L(i) - Re_R(i) = (1._wp - qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + Re_idx(i, & - & q)))/Res_gs(i, q) + Re_R(i) + Re%L(i) = (1._wp - qL_prim_rsx_vf(${SF('')}$, eqn_idx%E + Re_idx(i, & + & q)))/Res_gs(i, q) + Re%L(i) + Re%R(i) = (1._wp - qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%E + Re_idx(i, & + & q)))/Res_gs(i, q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do end if end if @@ -2580,7 +2574,7 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) + Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re%L(i) + 1._wp/Re%R(i)) end do end if @@ -2590,39 +2584,39 @@ contains end if if (wave_speeds == 1) then - s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) - s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s%L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s%R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & - & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) & - & - rho%R*(s_R - vel%R(dir_idx(1)))) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L - vel%L(dir_idx(1))) & + & - rho%R*(s%R - vel%R(dir_idx(1)))) else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + pres_S%L = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) - pres_SR = pres_SL + pres_S%R = pres_S%L ! Low Mach correction: Thornber et al. JCP (2008) - Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + Ms%L = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_S%L/pres%L - 1._wp) & & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) - Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + Ms%R = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_S%R/pres%R - 1._wp) & & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel%L(dir_idx(1)) - c%L*Ms_L - s_R = vel%R(dir_idx(1)) + c%R*Ms_R + s%L = vel%L(dir_idx(1)) - c%L*Ms%L + s%R = vel%R(dir_idx(1)) + c%R*Ms%R s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if - ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) - s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) + ! follows Einfeldt et al. s_M/P = min/max(0.,s%L/R) + s_M = min(0._wp, s%L); s_P = max(0._wp, s%R) - ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + ! goes with q_star_L/R = xi%L/R * (variable) xi%L/R = ( ( s%L/R - u_L/R )/(s%L/R - s_star) ) + xi%L = (s%L - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi%R = (s%R - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) + xi_m1%L = (s_S - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi_m1%R = (s_S - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -2638,8 +2632,8 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do if (bubbles_euler .and. (num_fluids > 1)) then @@ -2669,36 +2663,36 @@ contains do i = 1, num_dims flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & - & ) + s_M*(xi_L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & + & ) + s_M*(xi%L*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & & *vel%L(dir_idx(i))) - vel%L(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres%L)) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) & - & + s_P*(xi_R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & + & + s_P*(xi%R*(dir_flg(dir_idx(i))*s_S + (1._wp - dir_flg(dir_idx(i))) & & *vel%R(dir_idx(i))) - vel%R(dir_idx(i)))) + dir_flg(dir_idx(i))*(pres%R)) & - & + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr + & + (s_M/s%L)*(s_P/s%R)*dir_flg(dir_idx(i))*pcorr end do ! Energy flux. f = u*(E+p), q = E, q_star = \xi*E+(s-u)(\rho s_star + p/(s-u)) flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(xi_L*(E%L + (s_S & - & - vel%L(dir_idx(1)))*(rho%L*s_S + (pres%L)/(s_L - vel%L(dir_idx(1))))) - E%L)) & - & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(xi_R*(E%R + (s_S - vel%R(dir_idx(1)) & - & )*(rho%R*s_S + (pres%R)/(s_R - vel%R(dir_idx(1))))) - E%R)) + (s_M/s_L)*(s_P/s_R) & + & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(xi%L*(E%L + (s_S & + & - vel%L(dir_idx(1)))*(rho%L*s_S + (pres%L)/(s%L - vel%L(dir_idx(1))))) - E%L)) & + & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(xi%R*(E%R + (s_S - vel%R(dir_idx(1)) & + & )*(rho%R*s_S + (pres%R)/(s%R - vel%R(dir_idx(1))))) - E%R)) + (s_M/s%L)*(s_P/s%R) & & *pcorr*s_S ! Volume fraction flux $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! Advection velocity source: interface velocity for volume fraction transport $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & - & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & - & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) + & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_m1%L) & + & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_m1%R) ! IF ( (model_eqns == 4) .or. (num_fluids==1) ) vel_src_rs_vf(dir_idx(i))%sf(j,k,l) = 0._wp end do @@ -2709,20 +2703,20 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%bub%beg, eqn_idx%bub%end flux_rsx_vf(${SF('')}$, i) = xi_M*nbub%L*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub%R*qR_prim_rsx_vf(${SF(' + 1')}$, i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & + & + xi_P*nbub%R*qR_prim_rsx_vf(${SF(' + 1')}$, i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do if (qbmm) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%bub%beg) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%bub%beg) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & + & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end if if (adv_n) then flux_rsx_vf(${SF('')}$, & - & eqn_idx%n) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%n) = xi_M*nbub%L*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & + & + xi_P*nbub%R*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end if ! Geometrical source flux for cylindrical coordinates @@ -2736,10 +2730,10 @@ contains ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & - & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & *vel%L(dir_idx(1)) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp & & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') @@ -2757,10 +2751,10 @@ contains flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & - & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & ) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if @@ -2773,10 +2767,9 @@ contains ! 5-equation model (model_eqns=2): mixture total energy, volume fraction advection $:GPU_PARALLEL_LOOP(collapse=3, private='[Re_max, i, q, T, vel_rms, pres, rho, gamma, pi_inf, qv, & & alpha_L_sum, alpha_R_sum, E, MW, R_gas, Cp, Cv, Gamm, Y, H, qv_avg, rho_avg, gamma_avg, & - & H_avg, c, c_avg, s_P, s_M, xi_P, xi_M, xi_L, xi_R, xi_L_m1, xi_R_m1, Ms_L, Ms_R, & - & pres_SL, pres_SR, vel, Re_L, Re_R, alpha_L, alpha_R, s_L, s_R, s_S, vel_avg_rms, pcorr, & - & zcoef, vel_tmp, Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, tau_e_L, & - & tau_e_R, xi_field_L, xi_field_R, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, G]', & + & H_avg, c, c_avg, s_P, s_M, xi_P, xi_M, xi, xi_m1, Ms, pres_S, vel, Re, alpha_L, & + & alpha_R, s, s_S, vel_avg_rms, pcorr, zcoef, vel_tmp, Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, & + & Gamma_iR, Cp_iL, Cp_iR, tau_e, xi_field, Yi_avg, Phi_avg, h_iL, h_iR, h_avg_2, G]', & & copyin='[is1, is2, is3]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end @@ -2848,17 +2841,17 @@ contains if (viscous) then $:GPU_LOOP(parallelism='[seq]') do i = 1, Re_max - Re_L(i) = 0._wp - Re_R(i) = 0._wp + Re%L(i) = 0._wp + Re%R(i) = 0._wp $:GPU_LOOP(parallelism='[seq]') do q = 1, Re_size(i) - Re_L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re_L(i) - Re_R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re_R(i) + Re%L(i) = alpha_L(Re_idx(i, q))/Res_gs(i, q) + Re%L(i) + Re%R(i) = alpha_R(Re_idx(i, q))/Res_gs(i, q) + Re%R(i) end do - Re_L(i) = 1._wp/max(Re_L(i), sgm_eps) - Re_R(i) = 1._wp/max(Re_R(i), sgm_eps) + Re%L(i) = 1._wp/max(Re%L(i), sgm_eps) + Re%R(i) = 1._wp/max(Re%R(i), sgm_eps) end do end if @@ -2927,8 +2920,8 @@ contains if (hypoelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do G%L = 0._wp G%R = 0._wp @@ -2941,12 +2934,12 @@ contains do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 ! Elastic contribution to energy if G large enough if ((G%L > verysmall) .and. (G%R > verysmall)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) ! Additional terms in 2D and 3D if ((i == 2) .or. (i == 4) .or. (i == 5)) then - E%L = E%L + (tau_e_L(i)*tau_e_L(i))/(4._wp*G%L) - E%R = E%R + (tau_e_R(i)*tau_e_R(i))/(4._wp*G%R) + E%L = E%L + (tau_e%L(i)*tau_e%L(i))/(4._wp*G%L) + E%R = E%R + (tau_e%R(i)*tau_e%R(i))/(4._wp*G%R) end if end if end do @@ -2956,8 +2949,8 @@ contains if (hyperelasticity) then $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims - xi_field_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) - xi_field_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) + xi_field%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%xi%beg - 1 + i) + xi_field%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%xi%beg - 1 + i) end do G%L = 0._wp G%R = 0._wp @@ -2974,8 +2967,8 @@ contains end if $:GPU_LOOP(parallelism='[seq]') do i = 1, b_size - 1 - tau_e_L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) - tau_e_R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) + tau_e%L(i) = qL_prim_rsx_vf(${SF('')}$, eqn_idx%stress%beg - 1 + i) + tau_e%R(i) = qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%stress%beg - 1 + i) end do end if @@ -2997,11 +2990,11 @@ contains if (viscous) then if (chemistry) then - call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re_L(1), Re_R(1)) + call compute_viscosity_and_inversion(T%L, Ys_L, T%R, Ys_R, Re%L(1), Re%R(1)) end if $:GPU_LOOP(parallelism='[seq]') do i = 1, 2 - Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re_L(i) + 1._wp/Re_R(i)) + Re_avg_rsx_vf(${SF('')}$, i) = 2._wp/(1._wp/Re%L(i) + 1._wp/Re%R(i)) end do end if @@ -3013,53 +3006,53 @@ contains if (wave_speeds == 1) then if (elasticity) then ! Elastic wave speed, Rodriguez et al. JCP (2019) - s_L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e_L(dir_idx_tau(1) & + s%L = min(vel%L(dir_idx(1)) - sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) + tau_e%L(dir_idx_tau(1) & & ))/rho%L), & & vel%R(dir_idx(1)) - sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) & - & + tau_e_R(dir_idx_tau(1)))/rho%R)) - s_R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e_R(dir_idx_tau(1) & + & + tau_e%R(dir_idx_tau(1)))/rho%R)) + s%R = max(vel%R(dir_idx(1)) + sqrt(c%R*c%R + (((4._wp*G%R)/3._wp) + tau_e%R(dir_idx_tau(1) & & ))/rho%R), & & vel%L(dir_idx(1)) + sqrt(c%L*c%L + (((4._wp*G%L)/3._wp) & - & + tau_e_L(dir_idx_tau(1)))/rho%L)) - s_S = (pres%R - tau_e_R(dir_idx_tau(1)) - pres%L + tau_e_L(dir_idx_tau(1)) & - & + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & - & *(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L - vel%L(dir_idx(1))) - rho%R*(s_R & + & + tau_e%L(dir_idx_tau(1)))/rho%L)) + s_S = (pres%R - tau_e%R(dir_idx_tau(1)) - pres%L + tau_e%L(dir_idx_tau(1)) & + & + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) - rho%R*vel%R(dir_idx(1)) & + & *(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L - vel%L(dir_idx(1))) - rho%R*(s%R & & - vel%R(dir_idx(1)))) else - s_L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) - s_R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) - s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s_L - vel%L(dir_idx(1))) & - & - rho%R*vel%R(dir_idx(1))*(s_R - vel%R(dir_idx(1))))/(rho%L*(s_L & - & - vel%L(dir_idx(1))) - rho%R*(s_R - vel%R(dir_idx(1)))) + s%L = min(vel%L(dir_idx(1)) - c%L, vel%R(dir_idx(1)) - c%R) + s%R = max(vel%R(dir_idx(1)) + c%R, vel%L(dir_idx(1)) + c%L) + s_S = (pres%R - pres%L + rho%L*vel%L(dir_idx(1))*(s%L - vel%L(dir_idx(1))) & + & - rho%R*vel%R(dir_idx(1))*(s%R - vel%R(dir_idx(1))))/(rho%L*(s%L & + & - vel%L(dir_idx(1))) - rho%R*(s%R - vel%R(dir_idx(1)))) end if else if (wave_speeds == 2) then - pres_SL = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) + pres_S%L = 5.e-1_wp*(pres%L + pres%R + rho_avg*c_avg*(vel%L(dir_idx(1)) - vel%R(dir_idx(1)))) - pres_SR = pres_SL + pres_S%R = pres_S%L ! Low Mach correction: Thornber et al. JCP (2008) - Ms_L = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_SL/pres%L - 1._wp) & + Ms%L = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%L)/(1._wp + gamma%L))*(pres_S%L/pres%L - 1._wp) & & *pres%L/((pres%L + pi_inf%L/(1._wp + gamma%L))))) - Ms_R = max(1._wp, & - & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_SR/pres%R - 1._wp) & + Ms%R = max(1._wp, & + & sqrt(1._wp + ((5.e-1_wp + gamma%R)/(1._wp + gamma%R))*(pres_S%R/pres%R - 1._wp) & & *pres%R/((pres%R + pi_inf%R/(1._wp + gamma%R))))) - s_L = vel%L(dir_idx(1)) - c%L*Ms_L - s_R = vel%R(dir_idx(1)) + c%R*Ms_R + s%L = vel%L(dir_idx(1)) - c%L*Ms%L + s%R = vel%R(dir_idx(1)) + c%R*Ms%R s_S = 5.e-1_wp*((vel%L(dir_idx(1)) + vel%R(dir_idx(1))) + (pres%L - pres%R)/(rho_avg*c_avg)) end if - ! follows Einfeldt et al. s_M/P = min/max(0.,s_L/R) - s_M = min(0._wp, s_L); s_P = max(0._wp, s_R) + ! follows Einfeldt et al. s_M/P = min/max(0.,s%L/R) + s_M = min(0._wp, s%L); s_P = max(0._wp, s%R) - ! goes with q_star_L/R = xi_L/R * (variable) xi_L/R = ( ( s_L/R - u_L/R )/(s_L/R - s_star) ) - xi_L = (s_L - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R = (s_R - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) - ! xi_L/R - 1 = (s_S - u_L/R)/(s_L/R - s_star): avoids cancellation when xi \approx 1 - xi_L_m1 = (s_S - vel%L(dir_idx(1)))/min(s_L - s_S, -sgm_eps) - xi_R_m1 = (s_S - vel%R(dir_idx(1)))/max(s_R - s_S, sgm_eps) + ! goes with q_star_L/R = xi%L/R * (variable) xi%L/R = ( ( s%L/R - u_L/R )/(s%L/R - s_star) ) + xi%L = (s%L - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi%R = (s%R - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) + ! xi%L/R - 1 = (s_S - u_L/R)/(s%L/R - s_star): avoids cancellation when xi \approx 1 + xi_m1%L = (s_S - vel%L(dir_idx(1)))/min(s%L - s_S, -sgm_eps) + xi_m1%R = (s_S - vel%R(dir_idx(1)))/max(s%R - s_S, sgm_eps) ! goes with numerical velocity in x/y/z directions xi_P/M = 0.5 +/m sgn(0.5,s_star) xi_M = (5.e-1_wp + sign(5.e-1_wp, s_S)) @@ -3076,31 +3069,31 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%cont%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! MOMENTUM FLUX. f = \rho u u - \sigma, q = \rho u, q_star = \xi * \rho*(s_star, v, w) identity: - ! xi*(dir_flg*s_S+(1-dir_flg)*u_i)-u_i = (dir_flg*s_L/R+(1-dir_flg)*u_i)*xi_m1 + ! xi*(dir_flg*s_S+(1-dir_flg)*u_i)-u_i = (dir_flg*s%L/R+(1-dir_flg)*u_i)*xi_m1 $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(i)) = xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(i) & - & ) + s_M*(dir_flg(dir_idx(i))*s_L + (1._wp - dir_flg(dir_idx(i))) & - & *vel%L(dir_idx(i)))*xi_L_m1) + dir_flg(dir_idx(i))*(pres%L)) & + & ) + s_M*(dir_flg(dir_idx(i))*s%L + (1._wp - dir_flg(dir_idx(i))) & + & *vel%L(dir_idx(i)))*xi_m1%L) + dir_flg(dir_idx(i))*(pres%L)) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(i)) + s_P*(dir_flg(dir_idx(i)) & - & *s_R + (1._wp - dir_flg(dir_idx(i)))*vel%R(dir_idx(i)))*xi_R_m1) & - & + dir_flg(dir_idx(i))*(pres%R)) + (s_M/s_L)*(s_P/s_R)*dir_flg(dir_idx(i))*pcorr + & *s%R + (1._wp - dir_flg(dir_idx(i)))*vel%R(dir_idx(i)))*xi_m1%R) & + & + dir_flg(dir_idx(i))*(pres%R)) + (s_M/s%L)*(s_P/s%R)*dir_flg(dir_idx(i))*pcorr end do ! ENERGY FLUX. f = u*(E-\sigma), q = E, q_star = \xi*E+(s-u)(\rho s_star - \sigma/(s-u)) ! xi*(E+expr)-E = E*xi_m1 + xi*expr avoids E*(xi-1) cancellation flux_rsx_vf(${SF('')}$, & - & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(E%L*xi_L_m1 + xi_L*(s_S & - & - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s_L - vel%L(dir_idx(1)))))) & - & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(E%R*xi_R_m1 + xi_R*(s_S & - & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s_R - vel%R(dir_idx(1)))))) + (s_M/s_L) & - & *(s_P/s_R)*pcorr*s_S + & eqn_idx%E) = xi_M*(vel%L(dir_idx(1))*(E%L + pres%L) + s_M*(E%L*xi_m1%L + xi%L*(s_S & + & - vel%L(dir_idx(1)))*(rho%L*s_S + pres%L/(s%L - vel%L(dir_idx(1)))))) & + & + xi_P*(vel%R(dir_idx(1))*(E%R + pres%R) + s_P*(E%R*xi_m1%R + xi%R*(s_S & + & - vel%R(dir_idx(1)))*(rho%R*s_S + pres%R/(s%R - vel%R(dir_idx(1)))))) + (s_M/s%L) & + & *(s_P/s%R)*pcorr*s_S ! ELASTICITY. Elastic shear stress additions for the momentum and energy flux if (elasticity) then @@ -3109,14 +3102,14 @@ contains do i = 1, num_dims ! MOMENTUM ELASTIC FLUX. flux_rsx_vf(${SF('')}$, eqn_idx%cont%end + dir_idx(i)) = flux_rsx_vf(${SF('')}$, & - & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e_L(dir_idx_tau(i)) & - & - xi_P*tau_e_R(dir_idx_tau(i)) + & eqn_idx%cont%end + dir_idx(i)) - xi_M*tau_e%L(dir_idx_tau(i)) & + & - xi_P*tau_e%R(dir_idx_tau(i)) ! ENERGY ELASTIC FLUX. - flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e_L(dir_idx_tau(i)) & - & + s_M*(xi_L*((s_S - vel%L(i))*(tau_e_L(dir_idx_tau(i)) & - & /(s_L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & - & *tau_e_R(dir_idx_tau(i)) + s_P*(xi_R*((s_S - vel%R(i)) & - & *(tau_e_R(dir_idx_tau(i))/(s_R - vel%R(i)))))) + flux_ene_e = flux_ene_e - xi_M*(vel%L(dir_idx(i))*tau_e%L(dir_idx_tau(i)) & + & + s_M*(xi%L*((s_S - vel%L(i))*(tau_e%L(dir_idx_tau(i)) & + & /(s%L - vel%L(i)))))) - xi_P*(vel%R(dir_idx(i)) & + & *tau_e%R(dir_idx_tau(i)) + s_P*(xi%R*((s_S - vel%R(i)) & + & *(tau_e%R(dir_idx_tau(i))/(s%R - vel%R(i)))))) end do flux_rsx_vf(${SF('')}$, eqn_idx%E) = flux_rsx_vf(${SF('')}$, eqn_idx%E) + flux_ene_e end if @@ -3126,9 +3119,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, eqn_idx%stress%end - eqn_idx%stress%beg + 1 flux_rsx_vf(${SF('')}$, & - & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*tau_e_L(i) & - & - rho%L*vel%L(dir_idx(1))*tau_e_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho%R*tau_e_R(i) - rho%R*vel%R(dir_idx(1))*tau_e_R(i)) + & eqn_idx%stress%beg - 1 + i) = xi_M*(s_S/(s%L - s_S))*(s%L*rho%L*tau_e%L(i) & + & - rho%L*vel%L(dir_idx(1))*tau_e%L(i)) + xi_P*(s_S/(s%R - s_S)) & + & *(s%R*rho%R*tau_e%R(i) - rho%R*vel%R(dir_idx(1))*tau_e%R(i)) end do end if @@ -3136,23 +3129,23 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = eqn_idx%adv%beg, eqn_idx%adv%end flux_rsx_vf(${SF('')}$, i) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & i)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & - & i)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, & + & i)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end do ! VOLUME FRACTION SOURCE FLUX. $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims vel_src_rsx_vf(${SF('')}$, & - & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_L_m1) & - & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_R_m1) + & dir_idx(i)) = xi_M*(vel%L(dir_idx(i)) + dir_flg(dir_idx(i))*s_M*xi_m1%L) & + & + xi_P*(vel%R(dir_idx(i)) + dir_flg(dir_idx(i))*s_P*xi_m1%R) end do ! COLOR FUNCTION FLUX if (surface_tension) then flux_rsx_vf(${SF('')}$, eqn_idx%c) = xi_M*qL_prim_rsx_vf(${SF('')}$, & - & eqn_idx%c)*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%c)*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & eqn_idx%c)*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & + & + xi_P*qR_prim_rsx_vf(${SF(' + 1')}$, eqn_idx%c)*(vel%R(dir_idx(1)) + s_P*xi_m1%R) end if ! Hyperelastic reference map flux for material deformation tracking @@ -3160,9 +3153,9 @@ contains $:GPU_LOOP(parallelism='[seq]') do i = 1, num_dims flux_rsx_vf(${SF('')}$, & - & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s_L - s_S))*(s_L*rho%L*xi_field_L(i) & - & - rho%L*vel%L(dir_idx(1))*xi_field_L(i)) + xi_P*(s_S/(s_R - s_S)) & - & *(s_R*rho%R*xi_field_R(i) - rho%R*vel%R(dir_idx(1))*xi_field_R(i)) + & eqn_idx%xi%beg - 1 + i) = xi_M*(s_S/(s%L - s_S))*(s%L*rho%L*xi_field%L(i) & + & - rho%L*vel%L(dir_idx(1))*xi_field%L(i)) + xi_P*(s_S/(s%R - s_S)) & + & *(s%R*rho%R*xi_field%R(i) - rho%R*vel%R(dir_idx(1))*xi_field%R(i)) end do end if @@ -3175,8 +3168,8 @@ contains Y%R = qR_prim_rsx_vf(${SF(' + 1')}$, i) flux_rsx_vf(${SF('')}$, & - & i) = xi_M*rho%L*Y%L*(vel%L(dir_idx(1)) + s_M*xi_L_m1) & - & + xi_P*rho%R*Y%R*(vel%R(dir_idx(1)) + s_P*xi_R_m1) + & i) = xi_M*rho%L*Y%L*(vel%L(dir_idx(1)) + s_M*xi_m1%L) & + & + xi_P*rho%R*Y%R*(vel%R(dir_idx(1)) + s_P*xi_m1%R) flux_src_rsx_vf(${SF('')}$, i) = 0.0_wp end do end if @@ -3192,10 +3185,10 @@ contains ! Recalculating the radial momentum geometric source flux flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%cont%end + dir_idx(1)) = xi_M*(rho%L*(vel%L(dir_idx(1)) & - & *vel%L(dir_idx(1)) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp & + & *vel%L(dir_idx(1)) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp & & - dir_flg(dir_idx(1)))*vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & + xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) ! Geometrical source of the void fraction(s) is zero $:GPU_LOOP(parallelism='[seq]') @@ -3213,10 +3206,10 @@ contains flux_gsrc_rsx_vf(${SF('')}$, & & eqn_idx%mom%beg + 1) = -xi_M*(rho%L*(vel%L(dir_idx(1))*vel%L(dir_idx(1) & - & ) + s_M*(xi_L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & ) + s_M*(xi%L*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%L(dir_idx(1))) - vel%L(dir_idx(1))))) & & - xi_P*(rho%R*(vel%R(dir_idx(1))*vel%R(dir_idx(1)) & - & + s_P*(xi_R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & + & + s_P*(xi%R*(dir_flg(dir_idx(1))*s_S + (1._wp - dir_flg(dir_idx(1))) & & *vel%R(dir_idx(1))) - vel%R(dir_idx(1))))) flux_gsrc_rsx_vf(${SF('')}$, eqn_idx%mom%end) = flux_rsx_vf(${SF('')}$, eqn_idx%mom%beg + 1) end if @@ -3293,18 +3286,17 @@ contains type(riemann_states) :: c, c_fast, pres_mag ! HLLD speeds and intermediate state variables: - real(wp) :: s_L, s_R, s_M, s_starL, s_starR - real(wp) :: pTot_L, pTot_R, p_star, rhoL_star, rhoR_star, E_starL, E_starR - real(wp), dimension(7) :: U_L, U_R, U_starL, U_starR, U_doubleL, U_doubleR - real(wp), dimension(7) :: F_L, F_R, F_starL, F_starR, F_hlld + type(riemann_states) :: s, pTot + real(wp) :: p_star, s_M, s_starL, s_starR, denom_ds, sign_Bx + type(riemann_states) :: rho_star, E_star, v_star, w_star, sqrt_rho_star, E_double_lr + type(riemann_states_arr7) :: U, U_star, U_double, F, F_star + real(wp), dimension(7) :: F_hlld ! Indices for U and F: (rho, rho*vel(1), rho*vel(2), rho*vel(3), By, Bz, E) Note: vel and B are permutated, so vel(1) is the ! normal velocity, and x is the normal direction Note: Bx is omitted as the magnetic flux is always zero in the normal ! direction - real(wp) :: sqrt_rhoL_star, sqrt_rhoR_star, denom_ds, sign_Bx - real(wp) :: vL_star, vR_star, wL_star, wR_star - real(wp) :: v_double, w_double, By_double, Bz_double, E_doubleL, E_doubleR, E_double + real(wp) :: v_double, w_double, By_double, Bz_double, E_double integer :: i, j, k, l call s_populate_riemann_states_variables_buffers(qL_prim_rsx_vf, dqL_prim_dx_vf, dqL_prim_dy_vf, dqL_prim_dz_vf, & @@ -3320,11 +3312,10 @@ contains #:set SF = lambda offs: COORDS.format(STENCIL_IDX = SV + offs) if (norm_dir == ${NORM_DIR}$) then $:GPU_PARALLEL_LOOP(collapse=3, private='[alpha_rho_L, alpha_rho_R, vel, alpha_L, alpha_R, rho, pres, E, & - & H_no_mag, gamma, pi_inf, qv, vel_rms, B, c, c_fast, pres_mag, U_L, U_R, U_starL, U_starR, & - & U_doubleL, U_doubleR, F_L, F_R, F_starL, F_starR, F_hlld, s_L, s_R, s_M, s_starL, s_starR, & - & pTot_L, pTot_R, p_star, rhoL_star, rhoR_star, E_starL, E_starR, sqrt_rhoL_star, & - & sqrt_rhoR_star, denom_ds, sign_Bx, vL_star, vR_star, wL_star, wR_star, v_double, w_double, & - & By_double, Bz_double, E_doubleL, E_doubleR, E_double]', copyin='[norm_dir]') + & H_no_mag, gamma, pi_inf, qv, vel_rms, B, c, c_fast, pres_mag, U, U_star, U_double, F, & + & F_star, F_hlld, s, s_M, s_starL, s_starR, pTot, p_star, rho_star, E_star, sqrt_rho_star, & + & denom_ds, sign_Bx, v_star, w_star, v_double, w_double, By_double, Bz_double, E_double_lr, & + & E_double]', copyin='[norm_dir]') do l = ${Z_BND}$%beg, ${Z_BND}$%end do k = ${Y_BND}$%beg, ${Y_BND}$%end do j = ${X_BND}$%beg, ${X_BND}$%end @@ -3401,85 +3392,85 @@ contains call s_compute_fast_magnetosonic_speed(rho%R, c%R, B%R, norm_dir, c_fast%R, H_no_mag%R) ! (3) Compute contact speed s_M [Miyoshi Equ. (38)] - s_L = min(vel%L(1) - c_fast%L, vel%R(1) - c_fast%R) - s_R = max(vel%R(1) + c_fast%R, vel%L(1) + c_fast%L) + s%L = min(vel%L(1) - c_fast%L, vel%R(1) - c_fast%R) + s%R = max(vel%R(1) + c_fast%R, vel%L(1) + c_fast%L) - pTot_L = pres%L + pres_mag%L - pTot_R = pres%R + pres_mag%R + pTot%L = pres%L + pres_mag%L + pTot%R = pres%R + pres_mag%R - s_M = (((s_R - vel%R(1))*rho%R*vel%R(1) - (s_L - vel%L(1))*rho%L*vel%L(1) - pTot_R + pTot_L)/((s_R & - & - vel%R(1))*rho%R - (s_L - vel%L(1))*rho%L)) + s_M = (((s%R - vel%R(1))*rho%R*vel%R(1) - (s%L - vel%L(1))*rho%L*vel%L(1) - pTot%R + pTot%L)/((s%R & + & - vel%R(1))*rho%R - (s%L - vel%L(1))*rho%L)) ! (4) Compute star state variables - rhoL_star = rho%L*(s_L - vel%L(1))/(s_L - s_M) - rhoR_star = rho%R*(s_R - vel%R(1))/(s_R - s_M) - p_star = pTot_L + rho%L*(s_L - vel%L(1))*(s_M - vel%L(1))/(s_L - s_M) - E_starL = ((s_L - vel%L(1))*E%L - pTot_L*vel%L(1) + p_star*s_M)/(s_L - s_M) - E_starR = ((s_R - vel%R(1))*E%R - pTot_R*vel%R(1) + p_star*s_M)/(s_R - s_M) + rho_star%L = rho%L*(s%L - vel%L(1))/(s%L - s_M) + rho_star%R = rho%R*(s%R - vel%R(1))/(s%R - s_M) + p_star = pTot%L + rho%L*(s%L - vel%L(1))*(s_M - vel%L(1))/(s%L - s_M) + E_star%L = ((s%L - vel%L(1))*E%L - pTot%L*vel%L(1) + p_star*s_M)/(s%L - s_M) + E_star%R = ((s%R - vel%R(1))*E%R - pTot%R*vel%R(1) + p_star*s_M)/(s%R - s_M) ! (5) Compute left/right state vectors and fluxes - U_L = [rho%L, rho%L*vel%L(1:3), B%L(2:3), E%L] - U_starL = [rhoL_star, rhoL_star*s_M, rhoL_star*vel%L(2:3), B%L(2:3), E_starL] - U_R = [rho%R, rho%R*vel%R(1:3), B%R(2:3), E%R] - U_starR = [rhoR_star, rhoR_star*s_M, rhoR_star*vel%R(2:3), B%R(2:3), E_starR] + U%L = [rho%L, rho%L*vel%L(1:3), B%L(2:3), E%L] + U_star%L = [rho_star%L, rho_star%L*s_M, rho_star%L*vel%L(2:3), B%L(2:3), E_star%L] + U%R = [rho%R, rho%R*vel%R(1:3), B%R(2:3), E%R] + U_star%R = [rho_star%R, rho_star%R*s_M, rho_star%R*vel%R(2:3), B%R(2:3), E_star%R] ! Compute the left/right fluxes - F_L(1) = U_L(2) - F_L(2) = U_L(2)*vel%L(1) - B%L(1)*B%L(1) + pTot_L - F_L(3:4) = U_L(2)*vel%L(2:3) - B%L(1)*B%L(2:3) - F_L(5:6) = vel%L(1)*B%L(2:3) - vel%L(2:3)*B%L(1) - F_L(7) = (E%L + pTot_L)*vel%L(1) - B%L(1)*(vel%L(1)*B%L(1) + vel%L(2)*B%L(2) + vel%L(3)*B%L(3)) - - F_R(1) = U_R(2) - F_R(2) = U_R(2)*vel%R(1) - B%R(1)*B%R(1) + pTot_R - F_R(3:4) = U_R(2)*vel%R(2:3) - B%R(1)*B%R(2:3) - F_R(5:6) = vel%R(1)*B%R(2:3) - vel%R(2:3)*B%R(1) - F_R(7) = (E%R + pTot_R)*vel%R(1) - B%R(1)*(vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3)) + F%L(1) = U%L(2) + F%L(2) = U%L(2)*vel%L(1) - B%L(1)*B%L(1) + pTot%L + F%L(3:4) = U%L(2)*vel%L(2:3) - B%L(1)*B%L(2:3) + F%L(5:6) = vel%L(1)*B%L(2:3) - vel%L(2:3)*B%L(1) + F%L(7) = (E%L + pTot%L)*vel%L(1) - B%L(1)*(vel%L(1)*B%L(1) + vel%L(2)*B%L(2) + vel%L(3)*B%L(3)) + + F%R(1) = U%R(2) + F%R(2) = U%R(2)*vel%R(1) - B%R(1)*B%R(1) + pTot%R + F%R(3:4) = U%R(2)*vel%R(2:3) - B%R(1)*B%R(2:3) + F%R(5:6) = vel%R(1)*B%R(2:3) - vel%R(2:3)*B%R(1) + F%R(7) = (E%R + pTot%R)*vel%R(1) - B%R(1)*(vel%R(1)*B%R(1) + vel%R(2)*B%R(2) + vel%R(3)*B%R(3)) ! HLLD star-state fluxes via HLL jump relation - F_starL = F_L + s_L*(U_starL - U_L) - F_starR = F_R + s_R*(U_starR - U_R) + F_star%L = F%L + s%L*(U_star%L - U%L) + F_star%R = F%R + s%R*(U_star%R - U%R) ! Alfven wave speeds bounding the rotational discontinuities - s_starL = s_M - abs(B%L(1))/sqrt(rhoL_star) - s_starR = s_M + abs(B%L(1))/sqrt(rhoR_star) + s_starL = s_M - abs(B%L(1))/sqrt(rho_star%L) + s_starR = s_M + abs(B%L(1))/sqrt(rho_star%R) ! HLLD double-star (intermediate) states across rotational discontinuities - sqrt_rhoL_star = sqrt(rhoL_star); sqrt_rhoR_star = sqrt(rhoR_star) - vL_star = vel%L(2); wL_star = vel%L(3) - vR_star = vel%R(2); wR_star = vel%R(3) + sqrt_rho_star%L = sqrt(rho_star%L); sqrt_rho_star%R = sqrt(rho_star%R) + v_star%L = vel%L(2); w_star%L = vel%L(3) + v_star%R = vel%R(2); w_star%R = vel%R(3) ! (6) Compute the double-star states [Miyoshi Eqns. (59)-(62)] - denom_ds = sqrt_rhoL_star + sqrt_rhoR_star + denom_ds = sqrt_rho_star%L + sqrt_rho_star%R sign_Bx = sign(1._wp, B%L(1)) - v_double = (sqrt_rhoL_star*vL_star + sqrt_rhoR_star*vR_star + (B%R(2) - B%L(2))*sign_Bx)/denom_ds - w_double = (sqrt_rhoL_star*wL_star + sqrt_rhoR_star*wR_star + (B%R(3) - B%L(3))*sign_Bx)/denom_ds - By_double = (sqrt_rhoL_star*B%R(2) + sqrt_rhoR_star*B%L(2) + sqrt_rhoL_star*sqrt_rhoR_star*(vR_star & - & - vL_star)*sign_Bx)/denom_ds - Bz_double = (sqrt_rhoL_star*B%R(3) + sqrt_rhoR_star*B%L(3) + sqrt_rhoL_star*sqrt_rhoR_star*(wR_star & - & - wL_star)*sign_Bx)/denom_ds - - E_doubleL = E_starL - sqrt_rhoL_star*((vL_star*B%L(2) + wL_star*B%L(3)) - (v_double*By_double & - & + w_double*Bz_double))*sign_Bx - E_doubleR = E_starR + sqrt_rhoR_star*((vR_star*B%R(2) + wR_star*B%R(3)) - (v_double*By_double & - & + w_double*Bz_double))*sign_Bx - E_double = 0.5_wp*(E_doubleL + E_doubleR) - - U_doubleL = [rhoL_star, rhoL_star*s_M, rhoL_star*v_double, rhoL_star*w_double, By_double, Bz_double, & - & E_double] - U_doubleR = [rhoR_star, rhoR_star*s_M, rhoR_star*v_double, rhoR_star*w_double, By_double, Bz_double, & - & E_double] + v_double = (sqrt_rho_star%L*v_star%L + sqrt_rho_star%R*v_star%R + (B%R(2) - B%L(2))*sign_Bx)/denom_ds + w_double = (sqrt_rho_star%L*w_star%L + sqrt_rho_star%R*w_star%R + (B%R(3) - B%L(3))*sign_Bx)/denom_ds + By_double = (sqrt_rho_star%L*B%R(2) + sqrt_rho_star%R*B%L(2) & + & + sqrt_rho_star%L*sqrt_rho_star%R*(v_star%R - v_star%L)*sign_Bx)/denom_ds + Bz_double = (sqrt_rho_star%L*B%R(3) + sqrt_rho_star%R*B%L(3) & + & + sqrt_rho_star%L*sqrt_rho_star%R*(w_star%R - w_star%L)*sign_Bx)/denom_ds + + E_double_lr%L = E_star%L - sqrt_rho_star%L*((v_star%L*B%L(2) + w_star%L*B%L(3)) - (v_double*By_double & + & + w_double*Bz_double))*sign_Bx + E_double_lr%R = E_star%R + sqrt_rho_star%R*((v_star%R*B%R(2) + w_star%R*B%R(3)) - (v_double*By_double & + & + w_double*Bz_double))*sign_Bx + E_double = 0.5_wp*(E_double_lr%L + E_double_lr%R) + + U_double%L = [rho_star%L, rho_star%L*s_M, rho_star%L*v_double, rho_star%L*w_double, By_double, & + & Bz_double, E_double] + U_double%R = [rho_star%R, rho_star%R*s_M, rho_star%R*v_double, rho_star%R*w_double, By_double, & + & Bz_double, E_double] ! Select HLLD flux region - if (0.0_wp <= s_L) then - F_hlld = F_L + if (0.0_wp <= s%L) then + F_hlld = F%L else if (0.0_wp <= s_starL) then - F_hlld = F_L + s_L*(U_starL - U_L) + F_hlld = F%L + s%L*(U_star%L - U%L) else if (0.0_wp <= s_M) then - F_hlld = F_starL + s_starL*(U_doubleL - U_starL) + F_hlld = F_star%L + s_starL*(U_double%L - U_star%L) else if (0.0_wp <= s_starR) then - F_hlld = F_starR + s_starR*(U_doubleR - U_starR) - else if (0.0_wp <= s_R) then - F_hlld = F_R + s_R*(U_starR - U_R) + F_hlld = F_star%R + s_starR*(U_double%R - U_star%R) + else if (0.0_wp <= s%R) then + F_hlld = F%R + s%R*(U_star%R - U%R) else - F_hlld = F_R + F_hlld = F%R end if ! (12) Write HLLD flux to output arrays From 3d7b107b809e59578dc451c12692c2d00f542fe1 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Wed, 13 May 2026 20:09:38 -0500 Subject: [PATCH 20/20] style: use Fypp loop for fixed-size riemann_states_arr types --- src/common/m_derived_types.fpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/common/m_derived_types.fpp b/src/common/m_derived_types.fpp index e3589c2927..07f7d1d49a 100644 --- a/src/common/m_derived_types.fpp +++ b/src/common/m_derived_types.fpp @@ -98,20 +98,12 @@ module m_derived_types real(wp) :: R(3) end type riemann_states_vec3 - !> Left and right Riemann states for 2-element fixed arrays - type riemann_states_arr2 - real(wp) :: L(2), R(2) - end type riemann_states_arr2 - - !> Left and right Riemann states for 6-element fixed arrays - type riemann_states_arr6 - real(wp) :: L(6), R(6) - end type riemann_states_arr6 - - !> Left and right Riemann states for 7-element fixed arrays - type riemann_states_arr7 - real(wp) :: L(7), R(7) - end type riemann_states_arr7 + !> Left and right Riemann states for fixed-size arrays + #:for n in [2, 6, 7] + type riemann_states_arr${n}$ + real(wp) :: L(${n}$), R(${n}$) + end type riemann_states_arr${n}$ + #:endfor !> Lightweight beg/end pair for equation index ranges (no BC payload). type idx_bounds_info