Skip to content

Commit

Permalink
MERGE
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Radhakrishnan committed Apr 1, 2024
2 parents 7e23721 + ddb3edd commit 978c840
Show file tree
Hide file tree
Showing 36 changed files with 803 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# We build doxygen from source because of
# https://github.com/doxygen/doxygen/issues/9016
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Lint the toolchain
run: ./mfc.sh lint
6 changes: 5 additions & 1 deletion .github/workflows/phoenix/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ if [ "$job_device" == "gpu" ]; then
device_opts="--gpu -g $gpu_ids"
fi

./mfc.sh bench -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
if ["$job_device" == "gpu"]; then
./mfc.sh bench --mem 8 -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
else
./mfc.sh bench --mem 1 -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
fi
4 changes: 2 additions & 2 deletions .github/workflows/pretty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check formatting
run: |
./mfc.sh format
./mfc.sh format -j $(nproc)
git diff --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Spell Check
uses: crate-ci/typos@master
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup MacOS
if: matrix.os == 'macos'
Expand All @@ -46,10 +46,7 @@ jobs:
- name: (MacOS) Build OpenMPI
if: matrix.os == 'macos' && matrix.mpi == 'mpi'
run: |
echo "OMPI_FC=gfortran-13" >> $GITHUB_ENV
echo "OMPI_CXX=g++-13" >> $GITHUB_ENV
echo "OMPI_MPICC=gcc-13" >> $GITHUB_ENV
HOMEBREW_MAKE_JOBS=$(nproc) brew install --cc=gcc-13 --verbose --build-from-source open-mpi
brew install mpich
- name: Setup Ubuntu
if: matrix.os == 'ubuntu' && matrix.intel == false
Expand Down Expand Up @@ -96,7 +93,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Test
run: sudo ./mfc.sh docker ./mfc.sh test -j $(nproc) -a
Expand Down
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,30 @@ examples/*/*.err
examples/*/viz/
examples/*.jpg
examples/*.png

benchmarks/*batch/*/
benchmarks/*/D/*
benchmarks/*/p*
benchmarks/*/D_*
benchmarks/*/*.inf
benchmarks/*/*.inp
benchmarks/*/*.dat
benchmarks/*/*.o*
benchmarks/*/silo*
benchmarks/*/restart_data*
benchmarks/*/*.out
benchmarks/*/binary
benchmarks/*/fort.1
benchmarks/*/*.sh
benchmarks/*/*.err
benchmarks/*/viz/
benchmarks/*.jpg
benchmarks/*.png

*.mod

# Video Files
*.mp4
*.mov
*.mkv
*.avi
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

"cmake.configureOnOpen": false,

"python.defaultInterpreterPath": "${workspaceFolder}/build/venv/bin/python3",

"fortran.preferredCase": "lowercase",
"fortran.linter.includePaths": [ "${workspacefolder}/src/**" ],
"fortran.linter.fypp.enabled": true
}
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
-fcheck=all,no-array-temps
-fbacktrace
-fimplicit-none
)
#-ffpe-trap=invalid,zero,denormal,overflow
)
endif()

if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 10)
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,37 @@ MFC can execute high-fidelity simulations of shock-droplet interaction (see `exa
<img src="docs/res/shockdrop.png" alt="Shock Droplet Example" width="700"/>
</p>

Another example is the high-Mach flow over an airfoil, shown below.

<p align="center">
<img src="docs/res/airfoil.png" alt="Airfoil Example" width="700"/><br/>
</p>


## Getting started

You can navigate [to this webpage](https://mflowcode.github.io/documentation/md_getting-started.html) to get started using MFC!
It's rather straightforward.

We'll give a brief intro. here for MacOS.
Using [brew](https://brew.sh), install MFC's modest set of dependencies:
```console
brew install wget make python make cmake coreutils gcc openmpi
brew install wget python cmake gcc@13 mpich
```
You're now ready to build and test MFC!
Clone it to a convenient directory via
Put it to a convenient directory via
```console
git clone https://github.com/mflowcode/MFC.git
cd MFC
```
then build and test!
and make sure MFC knows what compilers to use by putting the following in your `~/.profile`
```console
export CC=gcc-13
export CXX=g++-13
export FC=gfortran-13
```
and source that file, build, and test!
```console
source ~/.profile
./mfc.sh build -j 8
./mfc.sh test -j 8
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
#!/usr/bin/env python3

import math
import json
# Benchmark model_equations_2_time_stepper_3_weno_order_3_riemann_solver_2
# Additional Benchmarked Features
# - model_equations : 2
# - time_stepper : 3
# - weno_order : 3
# - riemann_solver : 2

import json, math, argparse

parser = argparse.ArgumentParser(
prog="Benchmarking Case 1",
description="This MFC case was created for the purposes of benchmarking MFC.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("dict", type=str, metavar="DICT", help=argparse.SUPPRESS)
parser.add_argument("gbpp", type=int, metavar="MEM", default=16, help="Adjusts the problem size per rank to fit into [MEM] GB of GPU memory per GPU.")

ARGS = vars(parser.parse_args())
DICT = json.loads(ARGS["dict"])

size = 1 if DICT["gpu"] else 0

ppg = 8000000 / 16.0
procs = DICT["nodes"] * DICT["tasks_per_node"]
ncells = math.floor(ppg * procs * ARGS["gbpp"])
s = math.floor((ncells / 2.0) ** (1/3))
Nx, Ny, Nz = 2*s, s, s

# athmospheric pressure - Pa (used as reference value)
patm = 101325
Expand All @@ -13,10 +38,9 @@
CtD = 0.06

# cavity relative eccentricity (distance between radii)
ecc = 0.564
ecc = 0.564

# initial shock distance from the y axis. Note that the droplet center is located at y = 0.
# Thus, the distance from the shock to
# initial shock distance from the y axis. Note that the droplet center is located at y = 0. Thus, the distance from the shock to
# the droplet is about D0/8
ISD = 5.0/8 * D0

Expand All @@ -26,10 +50,10 @@
p0a = patm

# density - kg/m3
rho0a = 1.204
rho0a = 1.204

# gamma
gama = 1.40
gama = 1.40

# pi infinity - Pa
pia = 0
Expand All @@ -52,15 +76,15 @@
rho0w = 1000

# gama
gamw = 6.12
gamw = 6.12

# pi infty - Pa
piw = 3.43E+08

# speed of sound - m/s
c_w = math.sqrt( gamw * ( p0w + piw ) / rho0w )

# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either
# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either
# Min or psOp0a. Just comment/uncomment appropriatelly
Min = 2.4

Expand All @@ -71,7 +95,7 @@
# psOp0a = 4.5

# density
rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a )
rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a )

# Mach number of the shocked region - just a checker, as it must return "Min"
Ms = math.sqrt( ( gama + 1. ) / ( 2. * gama ) * ( psOp0a - 1. ) * ( p0a / ( p0a + pia ) ) + 1. )
Expand All @@ -88,7 +112,7 @@
rhos = rhosOrho0a * rho0a

# post shock speed of sound - m/s
c_s = math.sqrt( gama * (ps + pia) / rhos )
c_s = math.sqrt( gama * (ps + pia) / rhos )

# velocity at the post shock - m/s
vel = c_a/gama * (psOp0a - 1.) * p0a / ( p0a + pia ) / Ms
Expand All @@ -111,21 +135,12 @@
ze = 10 * D0

# Stretching factor, to make sure the domaing is sufficiently large after the mesh stretch
StF = 4.0

# number of elements into y direction
Ny = 100

# number of elements into z direction
Nz = 100

# number of elements into x direction
Nx = Ny * 2
StF = 4.0

# grid delta x if mesh were uniform in x direction - m. Note that I do not need a measure for dy
dx = ( xe - xb ) / Nx

# I calculating tend twice; first is an estimate, second is
# I calculate tend twice; first is an estimate, second is
# the actual value used. This is because I am getting errors in the
# post process part every time I approximate the actual Nt by an integer
# number (think of a smarter way).
Expand All @@ -137,12 +152,10 @@
# mismatches in simulation and post_process parts. Note that I wrote it this way so I have better control over the # of autosaves
tendA = ttilde * D0 / vel

# "CFL" number that I use to control both temporal and spatial discretizations, such that the ratio dx/dt remains constant for a given
# simulation
cfl = 0.05
cfl = 0.1

# time-step - s
dt = cfl * dx/ ss
dt = dx * cfl/ ss

# Save Frequency. Note that the number of autosaves will be SF + 1, as th IC (0.dat) is also saved
SF = 400
Expand Down Expand Up @@ -173,26 +186,14 @@
'y_domain%end' : ye,
'z_domain%beg' : zb,
'z_domain%end' : ze,
'stretch_x' : 'T',
'a_x' : 20,
'x_a' : -1.2 * D0,
'x_b' : 1.2 * D0,
'stretch_y' : 'T',
'a_y' : 20,
'y_a' : -0.0 * D0,
'y_b' : 1.2 * D0,
'stretch_z' : 'T',
'a_z' : 20,
'z_a' : -0.0 * D0,
'z_b' : 1.2 * D0,
'm' : Nx,
'n' : Ny,
'p' : Nz,
'cyl_coord' : 'F',
'dt' : dt,
't_step_start' : 0,
't_step_stop' : 100,
't_step_save' : 100,
't_step_stop' : int(60*(95*size + 5)),
't_step_save' : int(12*(95*size + 5)),
# ==========================================================

# Simulation Algorithm Parameters ==========================
Expand All @@ -211,7 +212,7 @@
'mapped_weno' : 'T',
'riemann_solver' : 2,
'wave_speeds' : 1,
'avg_state' : 2,
'avg_state' : 2,
'bc_x%beg' : -6,
'bc_x%end' : -6,
'bc_y%beg' : -2,
Expand All @@ -226,7 +227,7 @@
'prim_vars_wrt' :'T',
'parallel_io' :'T',
# ==========================================================
# I will use 1 for WATER properties, and 2 for AIR properties
# I will use 1 for WATER properties, and 2 for AIR properties
# Patch 1: Background (AIR - 2) =============================
'patch_icpp(1)%geometry' : 9,
'patch_icpp(1)%x_centroid' : (xb+xe) / 2 * StF,
Expand Down Expand Up @@ -280,7 +281,6 @@
'patch_icpp(3)%alpha(1)' : 1.0E+00,
'patch_icpp(3)%alpha(2)' : 0.0E+00,
# ==========================================================


# Fluids Physical Parameters ===============================
'fluid_pp(1)%gamma' : 1.0E+00/(gamw-1),
Expand All @@ -291,3 +291,4 @@
}))

# ==============================================================================

Loading

0 comments on commit 978c840

Please sign in to comment.