Skip to content

Commit

Permalink
Merge branch 'master' into sbryngelson-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryngelson authored Jan 7, 2024
2 parents f5032c7 + 4833971 commit 5c90159
Show file tree
Hide file tree
Showing 324 changed files with 11,620 additions and 6,158 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ jobs:
OPT1: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }}

- name: Ensure empty diff
run: git diff --exit-code tests/

docker:
name: Github | Docker
runs-on: ubuntu-latest
Expand All @@ -100,6 +103,9 @@ jobs:
- name: Test
run: sudo ./mfc.sh docker ./mfc.sh test -j $(nproc) -a

- name: Ensure empty diff
run: git diff --exit-code tests/

self:
name: Georgia Tech | Phoenix (NVHPC)
if: github.repository == 'MFlowCode/MFC'
Expand All @@ -125,8 +131,10 @@ jobs:
mv misc/run-phoenix-release-${{ matrix.device }}.sh ./
sbatch run-phoenix-release-${{ matrix.device }}.sh
- name: Ensure empty diff
run: exit $(git status --porcelain tests/ | wc -l)

- name: Print
if: always()
run: |
cat test.out
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on:
push:

pull_request:

workflow_dispatch:

jobs:
docs:
name: Lint Toolchain
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Lint the toolchain
run: ./mfc.sh lint
21 changes: 21 additions & 0 deletions .github/workflows/pretty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pretty

on:
push:

pull_request:

workflow_dispatch:

jobs:
docs:
name: Code formatting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check formatting
run: |
./mfc.sh format
git diff --exit-code
26 changes: 25 additions & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ There are multiple sets of parameters that must be specified in the python input
7. [(Optional) Acoustic Source Parameters](#7-acoustic-source)
8. [(Optional) Ensemble-Averaged Bubble Model Parameters](#8-ensemble-averaged-bubble-model)
9. [(Optional) Velocity Field Setup Parameters](#9-velocity-field-setup)
10. [(Optional) Phase Change Parameters](#10-Phase-Change-Model)

Items 7, 8, and 9 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, and initial velocity field setup, respectively.
Items 7, 8, 9, and 10 are optional sets of parameters that activate the acoustic source model, ensemble-averaged bubble model, initial velocity field setup, and phase change, respectively.
Definition of the parameters is described in the following subsections.

### 1. Runtime
Expand Down Expand Up @@ -276,20 +277,28 @@ See also `adv_alphan` in table [Simulation Algorithm Parameters](#5-simulation-a
| `pi_inf` | Real | Stiffened-gas parameter $\Pi_\infty$ of fluid. |
| `Re(1)` * | Real | Shear viscosity of fluid. |
| `Re(2)` * | Real | Volume viscosity of fluid. |
| `cv` ** | Real | Sffened-gas parameter $c_v$ of fluid. |
| `qv` ** | Real | Stiffened-gas parameter $q$ of fluid. |
| `qvp` ** | Real | Stiffened-gas parameter $q'$ of fluid. |

Fluid material's parameters. All parameters should be prepended with `fluid_pp(i)` where $i$ is the fluid index.

*: Parameters that work only with `model_eqns`=2.

**: Parameters that work only with `model_eqns`=3.

The table lists the fluid material's parameters.
The parameters define material's property of compressible fluids that are used in simulation.

- `fluid_pp(i)%gamma` and `fluid_pp(i)%pi_inf` define $\Gamma$ and $\Pi$ as parameters of $i$-th fluid that are used in stiffened gas equation of state.

- `fluid_pp(i)%Re(1)` and `fluid_pp(i)%Re(2)` define the shear and volume viscosities of $i$-th fluid, respectively.

When these parameters are undefined, fluids are treated as inviscid.
Details of implementation of viscosity in MFC can be found in [Coralic (2015)](references.md#Coralic15).

- `fluid_pp(i)%cv`, `fluid_pp(i)%qv`, and `fluid_pp(i)%qvp` define $c_v$, $q$, and $q'$ as parameters of $i$-th fluid that are used in stiffened gas equation of state.

### 5. Simulation Algorithm

| Parameter | Type | Description |
Expand Down Expand Up @@ -578,6 +587,21 @@ The parameters are optionally used to define initial velocity profiles and pertu
- `instability_wave` activates the perturbation of initial velocity by instability waves obtained from linear stability analysis for a mixing layer with hyperbolic tangent mean streamwise velocity profile.
This option only works for 2D and 3D cases, together with `vel_profile = TRUE`.

### 10. Phase Change Model
| Parameter | Type | Description |
| ---: | :----: | :--- |
| `relax` | Logical | Activates Phase Change model |
| `relax_model` | Integer | Phase change model: [5] pT-equilibrium; [6] pTg-equilibrium |
| `palpha_eps` | Real | tolerance of the Newton Solver to activate pT-equilibrium |
| `ptgalpha_eps` | Real | tolerance of the Newton Solver to activate pTg-equilibrium |

- `relax` Activates the Phase Change model.

- `relax_model` Specifies the phase change model to be used: [5] enables pT-equilibrium, while [6] activates pTg-equilibrium (if criteria are met).

- `palpha_eps` Specifies the tolerance used for the Newton Solvers used in the pT-equilibrium model.

- `ptgalpha_eps` Specifies the tolerance used for the Newton Solvers used in the pTg-equilibrium model.

## Enumerations

Expand Down
196 changes: 196 additions & 0 deletions examples/1D_exp_tube_phasechange/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#!/usr/bin/env python3
import math, json

# Pressure
p01 = 1.175435854855077e+05

# AIR
#density
rho0a1 = 1.077440586592175

# pi infinity
pia = 0
# qv
qva = 0E0
# qv'
qvpa = 0E0
# cv
cva = 717.5
# cp
cpa = 1006
# gamma
gama = cpa / cva
# Speed of sound
c_a = math.sqrt( gama * ( p01 + pia ) / rho0a1 )

# liquid water
# density
rho0wl1 = 1.079065851351639e+03

# pi infty
piwl = 1.0E+09
# qv
qvwl = -1167000
# qv'
qvpwl = 0.0E0
# cv
cvwl = 1816
# cp
cpwl = 4267
# gamma
gamwl = cpwl / cvwl
# speed of sound
c_wl = math.sqrt( gamwl * ( p01 + piwl ) / rho0wl1 )

# Vapor water
# density
rho0wv1 = 0.695395098952667

# pi infinity
piwv = 0
# qv
qvwv = 2030000
# qv'
qvpwv = -23400
# cv
cvwv = 1040
# cp
cpwv = 1487
# gamma
gamwv = cpwv / cvwv
# speed of sound
c_wv = math.sqrt( gamwv * ( p01 + piwv ) / rho0wv1 )

# Mach number of the shocked region - this should agree with Min, if everything is correct
Ms = 2.0

ss = Ms * c_a

vel = 2.0E+0

# domain boundaries
xb = 0.0
xe = 1.0

# CFL
cfl = 0.40

# Number of elements into the x direction
Nx = 200

dx = ( xe - xb ) / Nx
dt = cfl * dx / ss

# save frequency = SF + 1 (because the initial state, 0.dat, is also saved)
SF = 200

# making Nt divisible by SF
tendA = ( xe - xb ) / ss * 0.25

# 1 - ensure NtA is sufficient to go a little beyond tendA
NtA = int( tendA//dt + 1 )

# Array of saves. it is the same as Nt/Sf = t_step_save
AS = int( NtA // SF + 1 )

# Nt = total number of steps. Ensure Nt > NtA (so the total tendA is covered)
Nt = AS * SF

tend = Nt * dt

# patch properties: aFN in which F is the Fluid and N is the patch number
awl1 = 0.849964400537437

awv1 = 0.029353906292532

aa1 = 1 - awl1 - awv1

# Configuring case dictionary ==================================================
print(json.dumps({
# Logistics ================================================
'run_time_info': 'T',
# ==========================================================
# Computational Domain Parameters ==========================
'x_domain%beg' : xb,
'x_domain%end' : xe,
'm' : Nx,
'n' : 0,
'p' : 0,
'dt' : dt,
't_step_start' : 0,
't_step_stop' : Nt,
't_step_save' : AS,
# ==========================================================
# Simulation Algorithm Parameters ==========================
'num_patches' : 2,
'model_eqns' : 3,
'num_fluids' : 3,
'adv_alphan' : 'T',
'mpp_lim' : 'T',
'mixture_err' : 'T',
'relax' : 'T',
'relax_model' : 6,
'palpha_eps' : 1.0E-2,
'ptgalpha_eps' : 1.0E-2,
'time_stepper' : 3,
'weno_order' : 3,
'weno_eps' : 1.0E-16,
'mapped_weno' : 'T',
'null_weights' : 'F',
'mp_weno' : 'F',
'riemann_solver' : 2,
'wave_speeds' : 1,
'avg_state' : 2,
'bc_x%beg' : -3,
'bc_x%end' : -3,
# ==========================================================
# Formatted Database Files Structure Parameters ============
'format' : 1,
'precision' : 2,
'prim_vars_wrt':'T',
'parallel_io' :'T',
# ==========================================================
# Patch 1 - Shocked Stated ====================================
'patch_icpp(1)%geometry' : 1,
'patch_icpp(1)%x_centroid' : ( xe + xb ) * 1 / 4,
'patch_icpp(1)%length_x' : ( xe - xb ) * 1 / 2,
'patch_icpp(1)%vel(1)' : -vel,
'patch_icpp(1)%pres' : p01,
'patch_icpp(1)%alpha_rho(1)' : awl1 * rho0wl1,
'patch_icpp(1)%alpha_rho(2)' : awv1 * rho0wv1,
'patch_icpp(1)%alpha_rho(3)' : aa1 * rho0a1,
'patch_icpp(1)%alpha(1)' : awl1,
'patch_icpp(1)%alpha(2)' : awv1,
'patch_icpp(1)%alpha(3)' : aa1,
# ==========================================================
# Patch 2 R ================================================
'patch_icpp(2)%geometry' : 1,
'patch_icpp(2)%x_centroid' : ( xe + xb ) * 3 / 4,
'patch_icpp(2)%length_x' : ( xe - xb ) * 1 / 2,
'patch_icpp(2)%vel(1)' : vel,
'patch_icpp(2)%pres' : p01,
'patch_icpp(2)%alpha_rho(1)' : awl1 * rho0wl1,
'patch_icpp(2)%alpha_rho(2)' : awv1 * rho0wv1,
'patch_icpp(2)%alpha_rho(3)' : aa1 * rho0a1,
'patch_icpp(2)%alpha(1)' : awl1,
'patch_icpp(2)%alpha(2)' : awv1,
'patch_icpp(2)%alpha(3)' : aa1,
# ==========================================================
# Fluids Physical Parameters ===============================
'fluid_pp(1)%gamma' : 1.0E+00 / ( gamwl - 1 ),
'fluid_pp(1)%pi_inf' : gamwl * piwl / ( gamwl - 1 ),
'fluid_pp(1)%cv' : cvwl,
'fluid_pp(1)%qv' : qvwl,
'fluid_pp(1)%qvp' : qvpwl,
'fluid_pp(2)%gamma' : 1.0E+00 / ( gamwv - 1 ),
'fluid_pp(2)%pi_inf' : gamwv * piwv / ( gamwv - 1 ),
'fluid_pp(2)%cv' : cvwv,
'fluid_pp(2)%qv' : qvwv,
'fluid_pp(2)%qvp' : qvpwv,
'fluid_pp(3)%gamma' : 1.0E+00 / ( gama - 1 ),
'fluid_pp(3)%pi_inf' : gama * pia / ( gama - 1 ),
'fluid_pp(3)%cv' : cva,
'fluid_pp(3)%qv' : qva,
'fluid_pp(3)%qvp' : qvpa,
# ==========================================================
}))
Loading

0 comments on commit 5c90159

Please sign in to comment.