Skip to content

Commit 7b0dfbf

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master'
2 parents e647ae7 + 31c938f commit 7b0dfbf

File tree

90 files changed

+5004
-2942
lines changed

Some content is hidden

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

90 files changed

+5004
-2942
lines changed

.github/workflows/deploy-tap.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ on:
77
paths:
88
- 'packaging/homebrew/mfc.rb'
99
- 'packaging/homebrew/README.md'
10-
# Deploy to tap on push to master
10+
# Deploy to tap on push to master (only when formula files changed)
1111
push:
12-
branches: [ master, homebrew-new ]
12+
branches: [ master ]
1313
paths:
1414
- 'packaging/homebrew/mfc.rb'
1515
- 'packaging/homebrew/README.md'
16-
tags:
17-
- 'v*.*.*'
18-
# Allow manual trigger for testing
16+
# Deploy to tap when a tag is created (no paths filter on tag creation)
17+
create:
1918
workflow_dispatch:
2019

2120
permissions:
@@ -25,6 +24,7 @@ jobs:
2524
deploy-tap:
2625
name: Audit and deploy formula
2726
runs-on: macos-14
27+
if: github.event_name != 'create' || github.event.ref_type == 'tag'
2828
permissions:
2929
contents: write
3030
pull-requests: write
@@ -37,28 +37,38 @@ jobs:
3737
- name: Determine event metadata
3838
id: meta
3939
run: |
40-
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
41-
VERSION="${GITHUB_REF_NAME#v}"
40+
set -euo pipefail
41+
EVENT_NAME="${{ github.event_name }}"
42+
REF_NAME="${{ github.ref_name }}"
43+
44+
if [[ "${EVENT_NAME}" == "create" ]]; then
45+
# Tag creation event
46+
VERSION="${REF_NAME#v}"
47+
URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
48+
elif [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
49+
# Tag push event
50+
VERSION="${REF_NAME#v}"
4251
URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
4352
else
4453
# Extract URL from current formula to re-audit and sync
45-
URL="$(grep -Eo 'https://github.com/.*/archive/refs/tags/v[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz' packaging/homebrew/mfc.rb | head -n1)"
54+
URL="$(grep -Eo 'https://github.com/[^"]+/archive/refs/tags/v[0-9]+\.[0-9]+\.[0-9]+\.tar\.gz' packaging/homebrew/mfc.rb | tail -n 1)"
4655
VERSION="$(echo "${URL}" | sed -E 's/.*v([0-9]+\.[0-9]+\.[0-9]+)\.tar\.gz/\1/')"
4756
fi
57+
4858
SHASUM="$(curl -sL "${URL}" | shasum -a 256 | awk '{print $1}')"
4959
echo "version=${VERSION}" >> $GITHUB_OUTPUT
5060
echo "url=${URL}" >> $GITHUB_OUTPUT
5161
echo "sha256=${SHASUM}" >> $GITHUB_OUTPUT
52-
echo "Event: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
62+
echo "Event: ${EVENT_NAME}" >> $GITHUB_STEP_SUMMARY
5363
echo "Version: ${VERSION}" >> $GITHUB_STEP_SUMMARY
54-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
64+
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
5565
echo "Mode: Audit only (PR)" >> $GITHUB_STEP_SUMMARY
5666
else
5767
echo "Mode: Audit and deploy" >> $GITHUB_STEP_SUMMARY
5868
fi
5969
6070
- name: Update formula (for tag events)
61-
if: github.ref_type == 'tag'
71+
if: github.event_name == 'create' || github.ref_type == 'tag'
6272
run: |
6373
/usr/bin/sed -i '' "s@^ url \".*\"@ url \"${{ steps.meta.outputs.url }}\"@" packaging/homebrew/mfc.rb
6474
/usr/bin/sed -i '' "s@^ sha256 \".*\"@ sha256 \"${{ steps.meta.outputs.sha256 }}\"@" packaging/homebrew/mfc.rb

docs/documentation/case.md

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,12 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
384384
- `fluid_pp(i)%%G` is required for `hypoelasticity`.
385385

386386
### 6. Simulation Algorithm
387-
.
388-
| Parameter . | Type | Description |
389-
| ---: . | :----: | :--- |
390-
| `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)) |
391-
| `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` |
392-
| `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` |
387+
388+
| Parameter | Type | Description |
389+
| ---: | :----: | :--- |
390+
| `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)) |
391+
| `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` |
392+
| `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` |
393393
| `model_eqns` | Integer | Multicomponent model: [1] $\Gamma/\Pi_\infty$; [2] 5-equation; [3] 6-equation; [4] 4-equation |
394394
| `alt_soundspeed` * | Logical | Alternate sound speed and $K \nabla \cdot u$ for 5-equation model |
395395
| `adv_n` | Logical | Solving directly for the number density (in the method of classes) and compute void fraction from the number density |
@@ -752,29 +752,29 @@ Details of the transducer acoustic source model can be found in [Maeda and Colon
752752

753753
| Parameter | Type | Description |
754754
| ---: | :----: | :--- |
755-
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
756-
| `bubbles_lagrange` | Logical | Volume-averaged bubble modeling |
757-
| `bubble_model` | Integer | [1] Gilmore; [2] Keller--Miksis; [3] Rayleigh-Plesset |
758-
| `bub_pp%R0ref`*†‡ | Real | Reference bubble radius |
759-
| `bub_pp%p0ref`*†‡ | Real | Reference pressure |
760-
| `bub_pp%rho0ref`*†‡| Real | Reference density |
761-
| `bub_pp%T0ref`†‡ | Real | Reference temperature |
762-
| `bub_pp%ss`*†‡ | Real | Surface tension between host and gas (bubble) |
763-
| `bub_pp%pv`*†‡ | Real | Vapor pressure of host |
764-
| `bub_pp%vd`† ‡ | Real | Vapor diffusivity in gas (bubble) |
765-
| `bub_pp%mu_l`*†‡ | Real | Viscosity of host in liquid state |
766-
| `bub_pp%mu_v`| Real | Viscosity of host in vapor state |
767-
| `bub_pp%mu_g`| Real | Viscosity of gas (bubble) |
768-
| `bub_pp%gam_v`†‡ | Real | Specific heat ratio of host in vapor state |
769-
| `bub_pp%gam_g`*†‡ | Real | Specific heat ratio of gas (bubble) |
770-
| `bub_pp%M_v`†‡ | Real | Molecular weight of host |
771-
| `bub_pp%M_g`†‡ | Real | Molecular weight of gas (bubble) |
772-
| `bub_pp%k_v`†‡ | Real | Thermal conductivity of host in vapor state |
773-
| `bub_pp%k_g`†‡ | Real | Thermal conductivity of gas (bubble) |
774-
| `bub_pp%cp_v`| Real | Specific heat capacity in constant pressure of host in vapor state |
775-
| `bub_pp%cp_g`| Real | Specific heat capacity in constant pressure of gas (bubble) |
776-
| `bub_pp%R_v`†‡ | Real | Gas constant of host in vapor state |
777-
| `bub_pp%R_g`†‡ | Real | Gas constant of gas (bubble) |
755+
| `bubbles_euler` | Logical | Ensemble-averaged bubble modeling |
756+
| `bubbles_lagrange` | Logical | Volume-averaged bubble modeling |
757+
| `bubble_model` | Integer | [1] Gilmore; [2] Keller--Miksis; [3] Rayleigh-Plesset |
758+
| `bub_pp%%R0ref`*†‡ | Real | Reference bubble radius |
759+
| `bub_pp%%p0ref`*†‡ | Real | Reference pressure |
760+
| `bub_pp%%rho0ref`*†‡| Real | Reference density |
761+
| `bub_pp%%T0ref`†‡ | Real | Reference temperature |
762+
| `bub_pp%%ss`*†‡ | Real | Surface tension between host and gas (bubble) |
763+
| `bub_pp%%pv`*†‡ | Real | Vapor pressure of host |
764+
| `bub_pp%%vd`† ‡ | Real | Vapor diffusivity in gas (bubble) |
765+
| `bub_pp%%mu_l`*†‡ | Real | Viscosity of host in liquid state |
766+
| `bub_pp%%mu_v`| Real | Viscosity of host in vapor state |
767+
| `bub_pp%%mu_g`| Real | Viscosity of gas (bubble) |
768+
| `bub_pp%%gam_v`†‡ | Real | Specific heat ratio of host in vapor state |
769+
| `bub_pp%%gam_g`*†‡ | Real | Specific heat ratio of gas (bubble) |
770+
| `bub_pp%%M_v`†‡ | Real | Molecular weight of host |
771+
| `bub_pp%%M_g`†‡ | Real | Molecular weight of gas (bubble) |
772+
| `bub_pp%%k_v`†‡ | Real | Thermal conductivity of host in vapor state |
773+
| `bub_pp%%k_g`†‡ | Real | Thermal conductivity of gas (bubble) |
774+
| `bub_pp%%cp_v`| Real | Specific heat capacity in constant pressure of host in vapor state |
775+
| `bub_pp%%cp_g`| Real | Specific heat capacity in constant pressure of gas (bubble) |
776+
| `bub_pp%%R_v`†‡ | Real | Gas constant of host in vapor state |
777+
| `bub_pp%%R_g`†‡ | Real | Gas constant of gas (bubble) |
778778

779779
- \* These parameters are required for ensemble-averaged bubble model.
780780
- † These parameters are required for ensemble-averaged bubble model with `polytropic = F`.
@@ -993,6 +993,22 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met:
993993

994994
- `bc_y%beg = -2` to enable reflective boundary conditions
995995

996+
### 17. Chemistry
997+
998+
| Parameter | Type | Description |
999+
| ---: | :---: | :--- |
1000+
| `chemistry` | Logical | Enable chemistry simulation |
1001+
| `chem_params%diffusion` | Logical | Enable multispecies diffusion |
1002+
| `chem_params%reactions` | Logical | Enable chemical reactions |
1003+
| `chem_params%gamma_method` | Integer | Methodology for calculating the heat capacity ratio |
1004+
| `chem_params%transport_model` | Integer | Methodology for calculating the diffusion coefficients |
1005+
| `cantera_file` | String | Cantera-format mechanism file (e.g., .yaml) |
1006+
1007+
- `chem_params%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties, `1` for mixture-average, `2` for Unity-Lewis
1008+
1009+
- `cantera_file` specifies the chemical mechanism file. If the file is part of the standard Cantera library, only the filename is required. Otherwise, the file must be located in the same directory as your `case.py` file
1010+
1011+
9961012
## Enumerations
9971013

9981014
### Boundary conditions

examples/1D_exp_tube_phasechange/case.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env python3
2-
import math, json
2+
import math, json, argparse
3+
4+
parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
5+
parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.")
6+
parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.")
7+
args = parser.parse_args()
38

49
# Pressure
510
p01 = 1.175435854855077e05
@@ -123,7 +128,7 @@
123128
"t_step_save": AS,
124129
# Simulation Algorithm Parameters
125130
"num_patches": 2,
126-
"model_eqns": 3,
131+
"model_eqns": args.model_eqns,
127132
"num_fluids": 3,
128133
"mpp_lim": "T",
129134
"mixture_err": "T",
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env python3
2+
# References:
3+
# + https://doi.org/10.1016/j.compfluid.2013.10.014: 4.4. Multicomponent diffusion test case
4+
5+
import json
6+
import argparse
7+
import math
8+
import cantera as ct
9+
10+
ctfile = "gri30.yaml"
11+
sol_L = ct.Solution(ctfile)
12+
sol_L.TPX = 300, 8000, "O2:2,N2:2,H2O:5"
13+
14+
L = 0.05
15+
Nx = 100
16+
dx = L / Nx
17+
dt = 0.3e-6
18+
Tend = 0.05
19+
20+
NT = int(Tend / dt)
21+
SAVE_COUNT = 2000
22+
NS = 2000
23+
case = {
24+
"run_time_info": "T",
25+
"x_domain%beg": 0,
26+
"x_domain%end": +L,
27+
"m": Nx,
28+
"n": 0,
29+
"p": 0,
30+
"dt": float(dt),
31+
"t_step_start": 0,
32+
"t_step_stop": NT,
33+
"t_step_save": NS,
34+
"t_step_print": NS,
35+
"parallel_io": "F",
36+
"model_eqns": 2,
37+
"num_fluids": 1,
38+
"num_patches": 1,
39+
"mpp_lim": "F",
40+
"mixture_err": "F",
41+
"time_stepper": 3,
42+
"weno_order": 5,
43+
"weno_eps": 1e-16,
44+
"weno_avg": "F",
45+
"mapped_weno": "T",
46+
"mp_weno": "T",
47+
"riemann_solver": 2,
48+
"wave_speeds": 2,
49+
"avg_state": 1,
50+
"bc_x%beg": -1,
51+
"bc_x%end": -1,
52+
"viscous": "F",
53+
"chemistry": "T",
54+
"chem_params%diffusion": "T",
55+
"chem_params%reactions": "F",
56+
"chem_params%transport_model": 2, # Unity-Lewis
57+
"format": 1,
58+
"precision": 2,
59+
"prim_vars_wrt": "T",
60+
"chem_wrt_T": "T",
61+
"patch_icpp(1)%geometry": 1,
62+
"patch_icpp(1)%hcid": 182,
63+
"patch_icpp(1)%x_centroid": L / 2,
64+
"patch_icpp(1)%length_x": L,
65+
"patch_icpp(1)%vel(1)": "0",
66+
"patch_icpp(1)%pres": 1.01325e5,
67+
"patch_icpp(1)%alpha(1)": 1,
68+
"patch_icpp(1)%alpha_rho(1)": 1,
69+
"fluid_pp(1)%gamma": 1.0e00 / (1.9326e00 - 1.0e00),
70+
"fluid_pp(1)%pi_inf": 0,
71+
"cantera_file": ctfile,
72+
}
73+
74+
for i in range(len(sol_L.Y)):
75+
case[f"chem_wrt_Y({i + 1})"] = "T"
76+
case[f"patch_icpp(1)%Y({i+1})"] = 0.0
77+
if __name__ == "__main__":
78+
print(json.dumps(case))

examples/2D_lagrange_bubblescreen/case.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
R_uni = 8314 # Universal gas constant - J/kmol/K
2727
MW_g = 28.0 # Molar weight of the gas - kg/kmol
2828
MW_v = 18.0 # Molar weight of the vapor - kg/kmol
29-
gamma_g = 1.4 # Specific heat ratio of the gas
30-
gamma_v = 1.333 # Specific heat ratio of the vapor
29+
gam_g = 1.4 # Specific heat ratio of the gas
30+
gam_v = 1.333 # Specific heat ratio of the vapor
3131
pv = 2350 # Vapor pressure of the host - Pa
3232
cp_g = 1.0e3 # Specific heat of the gas - J/kg/K
3333
cp_v = 2.1e3 # Specific heat of the vapor - J/kg/K
@@ -128,6 +128,8 @@
128128
# Lagrangian Bubbles
129129
"bubbles_lagrange": "T",
130130
"bubble_model": 2, # Keller-Miksis model
131+
"thermal": 3,
132+
"polytropic": "F",
131133
"lag_params%nBubs_glb": 1194, # Number of bubbles
132134
"lag_params%solver_approach": 2,
133135
"lag_params%cluster_type": 2,
@@ -139,33 +141,34 @@
139141
"lag_params%valmaxvoid": 0.9,
140142
"lag_params%write_bubbles": "F",
141143
"lag_params%write_bubbles_stats": "F",
142-
"lag_params%c0": c0,
143-
"lag_params%rho0": rho0,
144-
"lag_params%T0": T0,
145-
"lag_params%x0": x0,
146-
"lag_params%diffcoefvap": diffVapor,
147-
"lag_params%Thost": T_host,
148-
"lag_params%charwidth": z_virtual / x0,
144+
# Bubble parameters
145+
"bub_pp%R0ref": 1.0,
146+
"bub_pp%p0ref": 1.0,
147+
"bub_pp%rho0ref": 1.0,
148+
"bub_pp%T0ref": 1.0,
149+
"bub_pp%ss": sigBubble / (rho0 * x0 * c0 * c0),
150+
"bub_pp%pv": pv / p0,
151+
"bub_pp%vd": diffVapor / (x0 * c0),
152+
"bub_pp%mu_l": mu_host / (rho0 * x0 * c0),
153+
"bub_pp%gam_v": gam_v,
154+
"bub_pp%gam_g": gam_g,
155+
"bub_pp%M_v": MW_v,
156+
"bub_pp%M_g": MW_g,
157+
"bub_pp%k_v": k_v * (T0 / (x0 * rho0 * c0 * c0 * c0)),
158+
"bub_pp%k_g": k_g * (T0 / (x0 * rho0 * c0 * c0 * c0)),
159+
"bub_pp%cp_v": cp_v * (T0 / (c0 * c0)),
160+
"bub_pp%cp_g": cp_g * (T0 / (c0 * c0)),
161+
"bub_pp%R_v": (R_uni / MW_v) * (T0 / (c0 * c0)),
162+
"bub_pp%R_g": (R_uni / MW_g) * (T0 / (c0 * c0)),
149163
# Fluids Physical Parameters
150164
# Host medium
151165
"fluid_pp(1)%gamma": 1.0 / (gamma_host - 1.0),
152166
"fluid_pp(1)%pi_inf": gamma_host * (pi_inf_host / p0) / (gamma_host - 1.0),
153167
"fluid_pp(1)%Re(1)": 1.0 / (mu_host / (rho0 * c0 * x0)),
154-
"fluid_pp(1)%mul0": mu_host,
155-
"fluid_pp(1)%ss": sigBubble,
156-
"fluid_pp(1)%pv": pv,
157-
"fluid_pp(1)%gamma_v": gamma_v,
158-
"fluid_pp(1)%M_v": MW_v,
159-
"fluid_pp(1)%k_v": k_v,
160-
"fluid_pp(1)%cp_v": cp_v,
161168
# Bubble gas state
162-
"fluid_pp(2)%gamma": 1.0 / (gamma_g - 1.0),
169+
"fluid_pp(2)%gamma": 1.0 / (gam_g - 1.0),
163170
"fluid_pp(2)%pi_inf": 0.0e00,
164171
"fluid_pp(2)%Re(1)": 1.0 / (mu_g / (rho0 * c0 * x0)),
165-
"fluid_pp(2)%gamma_v": gamma_g,
166-
"fluid_pp(2)%M_v": MW_g,
167-
"fluid_pp(2)%k_v": k_g,
168-
"fluid_pp(2)%cp_v": cp_g,
169172
}
170173
)
171174
)

examples/2D_phasechange_bubble/case.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env python3
2-
import math, json
2+
import math, json, argparse
3+
4+
parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
5+
parser.add_argument("--mfc", type=json.loads, default={}, metavar="DICT", help="MFC's toolchain's internal state.")
6+
parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.")
7+
args = parser.parse_args()
38

49
## 1 FOR BACKGROUND, 2 FOR BUBBLE
510
# Pressure [Pa]
@@ -9,7 +14,6 @@
914
# Temperature [K]
1015
T01 = 298.15
1116
T02 = 298.15
12-
# T02 = 7.914
1317

1418
#### FLUID PROPERTIES ####
1519

@@ -202,7 +206,7 @@
202206
"t_step_save": AS,
203207
# Simulation Algorithm Parameters
204208
"num_patches": 2,
205-
"model_eqns": 3,
209+
"model_eqns": args.model_eqns,
206210
"num_fluids": 3,
207211
"mpp_lim": "T",
208212
"mixture_err": "T",

examples/2D_phasechange_bubble/casefile.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
#!/usr/bin/env python3
2-
import math, json
1+
#!/usr/bin/env python3
2+
import math, json, argparse
3+
4+
parser = argparse.ArgumentParser(prog="phasechange", description="phase change considering both 5 and 6 equation models.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
5+
parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.")
6+
parser.add_argument("-me", "--model_eqns", type=int, metavar="MODEL EQN", choices=[2, 3], default=3, help="choose `2' for 5-equation model or `3' for 6-equation model.")
7+
args = parser.parse_args()
38

49
## 1 FOR BACKGROUND, 2 FOR BUBBLE
510
# Pressure [Pa]
@@ -209,7 +214,7 @@
209214
"t_step_save": AS,
210215
# Simulation Algorithm Parameters
211216
"num_patches": 2,
212-
"model_eqns": 3,
217+
"model_eqns": args.model_eqns,
213218
"num_fluids": 3,
214219
"mpp_lim": "T",
215220
"mixture_err": "T",

0 commit comments

Comments
 (0)