Skip to content

Commit 9f7d0e0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into BCRefactorFix
2 parents 6c659b7 + 54aa379 commit 9f7d0e0

16 files changed

Lines changed: 538 additions & 117 deletions

File tree

.github/workflows/deploy-tap.yml

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ on:
1313
paths:
1414
- 'packaging/homebrew/mfc.rb'
1515
- 'packaging/homebrew/README.md'
16-
# Deploy to tap when a tag is created (no paths filter on tag creation)
17-
create:
16+
# Note: tag releases are deployed to the tap by homebrew-release.yml, not here.
1817
workflow_dispatch:
1918

2019
permissions:
@@ -24,7 +23,6 @@ jobs:
2423
deploy-tap:
2524
name: Audit and deploy formula
2625
runs-on: macos-14
27-
if: github.event_name != 'create' || github.event.ref_type == 'tag'
2826
permissions:
2927
contents: write
3028
pull-requests: write
@@ -44,12 +42,8 @@ jobs:
4442
EVENT_NAME="${{ github.event_name }}"
4543
REF_NAME="${{ github.ref_name }}"
4644
47-
if [[ "${EVENT_NAME}" == "create" ]]; then
48-
# Tag creation event
49-
VERSION="${REF_NAME#v}"
50-
URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
51-
elif [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
52-
# Tag push event
45+
if [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
46+
# Manual dispatch from a tag ref
5347
VERSION="${REF_NAME#v}"
5448
URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
5549
else
@@ -71,7 +65,7 @@ jobs:
7165
fi
7266
7367
- name: Update formula (for tag events)
74-
if: github.event_name == 'create' || github.ref_type == 'tag'
68+
if: github.ref_type == 'tag'
7569
run: |
7670
/usr/bin/sed -i '' "s@^ url \".*\"@ url \"${{ steps.meta.outputs.url }}\"@" packaging/homebrew/mfc.rb
7771
/usr/bin/sed -i '' "s@^ sha256 \".*\"@ sha256 \"${{ steps.meta.outputs.sha256 }}\"@" packaging/homebrew/mfc.rb
@@ -110,11 +104,41 @@ jobs:
110104
fi
111105
112106
- name: Copy formula and README into tap
107+
id: merge
113108
if: github.event_name != 'pull_request'
114109
run: |
110+
set -euo pipefail
115111
mkdir -p tap-repo/Formula
116-
cp packaging/homebrew/mfc.rb tap-repo/Formula/mfc.rb
112+
SRC=packaging/homebrew/mfc.rb
113+
TAP=tap-repo/Formula/mfc.rb
114+
get_ver() { grep -Eo '/archive/refs/tags/v[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz' "$1" | head -n 1 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'; }
115+
MERGED="$(mktemp)"
116+
cp "${SRC}" "${MERGED}"
117+
if [[ -f "${TAP}" ]]; then
118+
SRC_VER="$(get_ver "${SRC}" || true)"
119+
TAP_VER="$(get_ver "${TAP}" || true)"
120+
# homebrew-release.yml bumps the tap directly on releases, so the in-repo
121+
# formula can lag behind. Never downgrade: if the tap pins a newer release,
122+
# keep the tap's url/sha256 while still syncing the rest of the formula.
123+
if [[ -n "${SRC_VER}" && -n "${TAP_VER}" && "${SRC_VER}" != "${TAP_VER}" ]] \
124+
&& [[ "$(printf '%s\n%s\n' "${SRC_VER}" "${TAP_VER}" | sort -V | tail -n 1)" == "${TAP_VER}" ]]; then
125+
TAP_URL_LINE="$(grep -E '^ url ' "${TAP}")"
126+
TAP_SHA_LINE="$(grep -E '^ sha256 "' "${TAP}" | head -n 1)"
127+
awk -v url="${TAP_URL_LINE}" -v sha="${TAP_SHA_LINE}" \
128+
'/^ url / { print url; next } /^ sha256 "/ { print sha; next } { print }' \
129+
"${SRC}" > "${MERGED}"
130+
fi
131+
# If the pinned release is unchanged, keep the tap's existing bottle block so a
132+
# formula-only push to master doesn't delete bottles already built for this version.
133+
if [[ "$(grep -E '^ url ' "${MERGED}")" == "$(grep -E '^ url ' "${TAP}")" ]] && grep -q '^ bottle do' "${TAP}"; then
134+
awk '/^ bottle do/,/^ end$/' "${TAP}" > /tmp/bottle.block
135+
awk '{ print } /^ head / { print ""; while ((getline line < "/tmp/bottle.block") > 0) print line }' \
136+
"${MERGED}" > "${MERGED}.tmp" && mv "${MERGED}.tmp" "${MERGED}"
137+
fi
138+
fi
139+
mv "${MERGED}" "${TAP}"
117140
cp packaging/homebrew/README.md tap-repo/README.md
141+
echo "version=$(get_ver "${TAP}" || true)" >> "$GITHUB_OUTPUT"
118142
119143
- name: Commit & push if changed
120144
if: github.event_name != 'pull_request'
@@ -128,6 +152,6 @@ jobs:
128152
exit 0
129153
fi
130154
git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" \
131-
commit -m "mfc: v${{ steps.meta.outputs.version }}"
155+
commit -m "mfc: v${{ steps.merge.outputs.version || steps.meta.outputs.version }}"
132156
git push origin HEAD:main
133157

docs/documentation/case.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ MPI topology is automatically optimized to maximize the parallel efficiency for
197197

198198
The Table lists the patch parameters.
199199
The parameters define the geometries and physical parameters of fluid components (patch) in the domain at initial condition.
200-
Note that the domain must be fully filled with patche(s).
200+
Note that the domain must be fully filled with patches.
201201
The code outputs error messages when an empty region is left in the domain.
202202

203203
- `tau_e(i)` is the `i`-th component of the elastic stress tensor, ordered as `tau_xx`, `tau_xy`, `tau_yy`, `tau_xz`, `tau_yz`, and `tau_zz`. 1D simulation requires `tau(1)`, 2D `tau(1:3)`, and 3D `tau(1:6)`.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
"""
2+
Case file to demonstrate and test the periodic collision of immersed boundaries.
3+
This file was generated by Conrad Delgado as a minimum reproducer to prevent regression
4+
of periodic immersed boundaries.
5+
"""
6+
7+
import json
8+
import math
9+
10+
import numpy as np
11+
12+
gam_a = 1.4
13+
14+
# particle diameter
15+
D = 0.1
16+
R = D / 2.0
17+
18+
# particle params
19+
rho_s = 10.0
20+
vol_s = 4.0 / 3.0 * np.pi * R**3
21+
mass_s = rho_s * vol_s
22+
N_s = 2
23+
24+
# fluid params
25+
M = 2.0
26+
Re = 500.0
27+
P = 101325
28+
rho = 1.225
29+
v1 = M * np.sqrt(gam_a * P / rho)
30+
mu = rho * v1 * D / Re
31+
32+
# timestep
33+
dt = 1.0e-05
34+
Nt = 50
35+
t_save = 5
36+
37+
# grid
38+
Nx = 31
39+
Ny = 63
40+
Nz = 31
41+
42+
# immersed boundary dictionary
43+
ib_dict = {}
44+
ib_dict.update(
45+
{
46+
f"patch_ib({1})%geometry": 8,
47+
f"patch_ib({1})%x_centroid": 0.0,
48+
f"patch_ib({1})%y_centroid": -2.1 * D,
49+
f"patch_ib({1})%z_centroid": 0.0,
50+
f"patch_ib({1})%vel(2)": -100.0,
51+
f"patch_ib({1})%radius": D / 2,
52+
f"patch_ib({1})%slip": "F",
53+
f"patch_ib({1})%moving_ibm": 2,
54+
f"patch_ib({1})%mass": mass_s,
55+
f"patch_ib({2})%geometry": 8,
56+
f"patch_ib({2})%x_centroid": 0.0,
57+
f"patch_ib({2})%y_centroid": 1.8 * D,
58+
f"patch_ib({2})%z_centroid": 0.0,
59+
f"patch_ib({2})%vel(2)": +100.0,
60+
f"patch_ib({2})%radius": D / 2,
61+
f"patch_ib({2})%slip": "F",
62+
f"patch_ib({2})%moving_ibm": 2,
63+
f"patch_ib({2})%mass": mass_s,
64+
}
65+
)
66+
67+
# Configuring case dictionary
68+
case_dict = {
69+
# Logistics
70+
"run_time_info": "T",
71+
# Computational Domain Parameters
72+
# x direction
73+
"x_domain%beg": -1.25 * D,
74+
"x_domain%end": 1.25 * D,
75+
# y direction
76+
"y_domain%beg": -2.5 * D,
77+
"y_domain%end": 2.5 * D,
78+
# z direction
79+
"z_domain%beg": -1.25 * D,
80+
"z_domain%end": 1.25 * D,
81+
"cyl_coord": "F",
82+
"m": Nx,
83+
"n": Ny,
84+
"p": Nz,
85+
"dt": dt,
86+
"t_step_start": 0,
87+
"t_step_stop": Nt,
88+
"t_step_save": t_save,
89+
# Simulation Algorithm Parameters
90+
# Only one patches are necessary, the air tube
91+
"num_patches": 1,
92+
# Use the 5 equation model
93+
"model_eqns": 2,
94+
# 6 equations model does not need the K \div(u) term
95+
"alt_soundspeed": "F",
96+
# One fluids: air
97+
"num_fluids": 1,
98+
# time step
99+
"mpp_lim": "F",
100+
# Correct errors when computing speed of sound
101+
"mixture_err": "T",
102+
# Use TVD RK3 for time marching
103+
"time_stepper": 3,
104+
# Reconstruct the primitive variables to minimize spurious
105+
# Use WENO5
106+
"weno_order": 5,
107+
"weno_eps": 1.0e-16,
108+
"weno_Re_flux": "T",
109+
"weno_avg": "T",
110+
"avg_state": 2,
111+
"null_weights": "F",
112+
"mp_weno": "T",
113+
"riemann_solver": 2,
114+
"wave_speeds": 1,
115+
# periodic bc
116+
"bc_x%beg": -3,
117+
"bc_x%end": -3,
118+
"bc_y%beg": -1,
119+
"bc_y%end": -1,
120+
"bc_z%beg": -3,
121+
"bc_z%end": -3,
122+
# Set IB to True and add 1 patch
123+
"ib": "T",
124+
"num_ibs": N_s,
125+
"viscous": "T",
126+
# Formatted Database Files Structure Parameters
127+
"format": 1,
128+
"precision": 2,
129+
"prim_vars_wrt": "T",
130+
"E_wrt": "T",
131+
"parallel_io": "T",
132+
"ib_state_wrt": "T",
133+
"fd_order": 4,
134+
# Patch: Constant Tube filled with air
135+
# Specify the cylindrical air tube grid geometry
136+
"patch_icpp(1)%geometry": 9,
137+
"patch_icpp(1)%x_centroid": 0.0,
138+
# Uniform medium density, centroid is at the center of the domain
139+
"patch_icpp(1)%y_centroid": 0.0,
140+
"patch_icpp(1)%z_centroid": 0.0,
141+
"patch_icpp(1)%length_x": 2.5 * D,
142+
"patch_icpp(1)%length_y": 5.0 * D,
143+
"patch_icpp(1)%length_z": 2.5 * D,
144+
# Specify the patch primitive variables
145+
"patch_icpp(1)%vel(1)": 0.0e00,
146+
"patch_icpp(1)%vel(2)": 0.0e00,
147+
"patch_icpp(1)%vel(3)": 0.0e00,
148+
"patch_icpp(1)%pres": P,
149+
"patch_icpp(1)%alpha_rho(1)": rho,
150+
"patch_icpp(1)%alpha(1)": 1.0e00,
151+
# Patch: Sphere Immersed Boundary
152+
# Fluids Physical Parameters
153+
"fluid_pp(1)%gamma": 1.0e00 / (gam_a - 1.0e00), # 2.50(Not 1.40)
154+
"fluid_pp(1)%pi_inf": 0,
155+
"fluid_pp(1)%Re(1)": 1.0 / mu,
156+
"collision_model": 1, # soft-sphere collision model
157+
"ib_coefficient_of_friction": 0.1,
158+
"collision_time": 20.0 * dt,
159+
"coefficient_of_restitution": 0.9, # almost perfectly elastic
160+
}
161+
162+
case_dict.update(ib_dict)
163+
164+
print(json.dumps(case_dict))

packaging/homebrew/mfc.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class Mfc < Formula
77
desc "Exascale multiphase/multiphysics compressible flow solver"
88
homepage "https://mflowcode.github.io/"
9-
url "https://github.com/MFlowCode/MFC/archive/refs/tags/v5.2.0.tar.gz"
10-
sha256 "aaee855302950cb6bd8497170a6737214ed9a47ad3d109258f5b27ee2b78fe3d"
9+
url "https://github.com/MFlowCode/MFC/archive/refs/tags/v5.5.0.tar.gz"
10+
sha256 "05499f28291654ee5cc7f4344c85b5b12707e43e8408e7a28b96e43020e42959"
1111
license "MIT"
1212
head "https://github.com/MFlowCode/MFC.git", branch: "master"
1313

@@ -28,7 +28,7 @@ class Mfc < Formula
2828
def install
2929
# Create Python virtual environment inside libexec (inside Cellar for proper bottling)
3030
venv = libexec/"venv"
31-
system Formula["python@3.12"].opt_bin/"python3.12", "-m", "venv", venv
31+
system formula_opt_bin("python@3.12")/"python3.12", "-m", "venv", venv
3232
system venv/"bin/pip", "install", "--upgrade",
3333
"pip", "setuptools", "wheel",
3434
"setuptools-scm",

src/common/m_global_parameters_common.fpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ module m_global_parameters_common
109109

110110
!> @name Processor coordinates and parallel-IO addressing (identical declaration across all three targets)
111111
!> @{
112-
integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM
113-
integer, allocatable, dimension(:) :: start_idx !< Starting cell-center index of local processor in global grid
112+
integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM
113+
integer, allocatable, dimension(:) :: start_idx !< Starting cell-center index of local processor in global grid
114+
integer :: num_procs_x = 1 !< Number of MPI ranks in x-direction
115+
integer :: num_procs_y = 1 !< Number of MPI ranks in y-direction
116+
integer :: num_procs_z = 1 !< Number of MPI ranks in z-direction
114117
!> @}
115118

116119
!> @name MPI info for parallel IO with Lustre file systems (identical across all three targets)

src/common/m_mpi_common.fpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ contains
10211021
subroutine s_mpi_decompose_computational_domain
10221022

10231023
#ifdef MFC_MPI
1024-
integer :: num_procs_x, num_procs_y, num_procs_z !< Optimal number of processors in the x-, y- and z-directions
10251024
!> Non-optimal number of processors in the x-, y- and z-directions
10261025
real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z
10271026
real(wp) :: fct_min !< Processor factorization (fct) minimization parameter

src/post_process/m_start_up.fpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ module m_start_up
4242
complex(c_double_complex), allocatable :: data_cmplx(:,:,:), data_cmplx_y(:,:,:), data_cmplx_z(:,:,:)
4343
real(wp), allocatable, dimension(:,:,:) :: En_real
4444
real(wp), allocatable, dimension(:) :: En
45-
integer :: num_procs_x, num_procs_y, num_procs_z
4645
integer :: Nx, Ny, Nz, Nxloc, Nyloc, Nyloc2, Nzloc, Nf
4746
integer :: ierr
4847
integer :: MPI_COMM_CART, MPI_COMM_CART12, MPI_COMM_CART13

0 commit comments

Comments
 (0)