Skip to content

Commit acc8228

Browse files
committed
merge w/ master
2 parents 03b5f72 + bf37331 commit acc8228

Some content is hidden

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

47 files changed

+1239
-505
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/tests/**/* linguist-generated=true
2+
/toolchain/mechanisms/* linguist-generated=true

.github/workflows/cleanness.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Cleanness
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
cleanness:
7+
name: Code Cleanness Test
8+
runs-on: "ubuntu-latest"
9+
env:
10+
pr_everything: 0
11+
master_everything: 0
12+
steps:
13+
- name: Clone - PR
14+
uses: actions/checkout@v3
15+
with:
16+
path: pr
17+
- name: Clone - Master
18+
uses: actions/checkout@v3
19+
with:
20+
repository: MFlowCode/MFC
21+
ref: master
22+
path: master
23+
24+
- name: Setup Ubuntu
25+
run: |
26+
sudo apt update -y
27+
sudo apt install -y tar wget make cmake gcc g++ python3 python3-dev "openmpi-*" libopenmpi-dev
28+
29+
30+
- name: Build
31+
run: |
32+
(cd pr && /bin/bash mfc.sh build -j $(nproc) --debug 2> ../pr.txt)
33+
(cd master && /bin/bash mfc.sh build -j $(nproc) --debug 2> ../master.txt)
34+
sed -i '/\/pr\//d' pr.txt
35+
sed -i '/\/master\//d' master.txt
36+
37+
- name: Unused Variables Diff
38+
run: |
39+
grep -F 'Wunused-variable' master.txt -B 4 > mUnused.txt
40+
grep -F 'Wunused-variable' pr.txt -B 4 > prUnused.txt
41+
diff prUnused.txt mUnused.txt || true
42+
43+
- name: Unused Dummy Arguments Diff
44+
run: |
45+
grep -F 'Wunused-dummy-argument' pr.txt -B 4 > prDummy.txt
46+
grep -F 'Wunused-dummy-argument' master.txt -B 4 > mDummy.txt
47+
diff prDummy.txt mDummy.txt || true
48+
49+
- name: Unused Value Diff
50+
run: |
51+
grep -F 'Wunused-value' pr.txt -B 4 > prUnused_val.txt
52+
grep -F 'Wunused-value' master.txt -B 4 > mUnused_val.txt
53+
diff prUnused_val.txt mUnused_val.txt || true
54+
55+
- name: Maybe Uninitialized Variables Diff
56+
run: |
57+
grep -F 'Wmaybe-uninitialized' pr.txt -B 4 > prMaybe.txt
58+
grep -F 'Wmaybe-uninitialized' master.txt -B 4 > mMaybe.txt
59+
diff prMaybe.txt mMaybe.txt || true
60+
61+
62+
- name: Everything Diff
63+
run: |
64+
grep '\-W' pr.txt -B 4 > pr_every.txt
65+
grep '\-W' master.txt -B 4 > m_every.txt
66+
diff pr_every.txt m_every.txt || true
67+
68+
- name: List of Warnings
69+
run: |
70+
cat pr_every.txt
71+
72+
73+
- name: Summary
74+
run: |
75+
pr_variable=$(grep -c -F 'Wunused-variable' pr.txt -B 4)
76+
pr_argument=$(grep -c -F 'Wunused-dummy-argument' pr.txt -B 4)
77+
pr_value=$(grep -c -F 'Wunused-value' pr.txt -B 4)
78+
pr_uninit=$(grep -c -F 'Wmaybe-uninitialized' pr.txt -B 4)
79+
pr_everything=$(grep -c '\-W' pr.txt -B 4)
80+
81+
master_variable=$(grep -c -F 'Wunused-variable' master.txt -B 4)
82+
master_argument=$(grep -c -F 'Wunused-dummy-argument' master.txt -B 4)
83+
master_value=$(grep -c -F 'Wunused-value' master.txt -B 4)
84+
master_uninit=$(grep -c -F 'Wmaybe-uninitialized' master.txt -B 4)
85+
master_everything=$(grep -c '\-W' master.txt -B 4)
86+
87+
echo "pr_everything=$pr_everything" >> $GITHUB_ENV
88+
echo "master_everything=$master_everything" >> $GITHUB_ENV
89+
90+
echo "Difference is how many warnings were added or removed from master to pr, negative numbers are better since you are removing warnings"
91+
echo "Unused Variable Count: $pr_variable, Difference: $((pr_variable - master_variable))"
92+
echo "Unused Dummy Argument: $pr_argument, Difference: $((pr_argument - master_argument))"
93+
echo "Unused Value: $pr_value, Difference: $((pr_value - master_value))"
94+
echo "Maybe Uninitialized: $pr_uninit, Difference: $((pr_uninit - master_uninit))"
95+
echo "Everything: $pr_everything, Difference: $((pr_everything - master_everything))"
96+
97+
98+
- name: Check Differences
99+
if: env.pr_everything > env.master_everything
100+
run: |
101+
echo "Difference between warning count in PR is greater than in master."
102+
exit 1
103+
104+

.github/workflows/docs.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
name: Documentation
22

3-
on:
4-
push:
5-
branches:
6-
- master
7-
8-
workflow_dispatch:
3+
on: [push, pull_request, workflow_dispatch]
94

105
jobs:
116
docs:
127
name: Build & Publish
138
runs-on: ubuntu-latest
149

15-
if: github.repository == 'MFlowCode/MFC'
1610
concurrency:
1711
group: docs-publish
1812
cancel-in-progress: true
@@ -53,6 +47,7 @@ jobs:
5347
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
5448
5549
- name: Publish Documentation
50+
if: github.repository == 'MFlowCode/MFC' && github.ref == 'refs/heads/master' && github.event_name == 'push'
5651
run: |
5752
set +e
5853
git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ jobs:
4949
- name: Setup MacOS
5050
if: matrix.os == 'macos'
5151
run: |
52-
brew install coreutils python cmake fftw hdf5 gcc@14 open-mpi
52+
brew install coreutils python cmake fftw hdf5 gcc@14 boost open-mpi
5353
echo "FC=gfortran-14" >> $GITHUB_ENV
54+
echo "BOOST_INCLUDE=/opt/homebrew/include/" >> $GITHUB_ENV
5455
5556
- name: Setup Ubuntu
5657
if: matrix.os == 'ubuntu' && matrix.intel == false
@@ -138,4 +139,3 @@ jobs:
138139
with:
139140
name: logs
140141
path: test-${{ matrix.device }}.out
141-

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ macro(HANDLE_SOURCES target useCommon)
370370
-D MFC_${${target}_UPPER}
371371
-D MFC_COMPILER="${CMAKE_Fortran_COMPILER_ID}"
372372
-D MFC_CASE_OPTIMIZATION=False
373+
-D chemistry=False
373374
--line-numbering
374375
--no-folding
375376
"${fpp}" "${f90}"

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,20 @@ It's rather straightforward.
5858
We'll give a brief intro. here for MacOS.
5959
Using [brew](https://brew.sh), install MFC's dependencies:
6060
```shell
61-
brew install coreutils python cmake fftw hdf5 gcc open-mpi
61+
brew install coreutils python cmake fftw hdf5 gcc boost open-mpi
6262
```
6363
You're now ready to build and test MFC!
6464
Put it to a convenient directory via
6565
```shell
6666
git clone https://github.com/MFlowCode/MFC
6767
cd MFC
6868
```
69+
and be sure MFC knows where to find Boost by appending to your dotfiles and sourcing them again
70+
```shell
71+
echo -e 'export BOOST_INCLUDE=/opt/homebrew/' | tee -a ~/.bash_profile ~/.zshrc
72+
. ~/.bash_profile 2>/dev/null || . ~/.zshrc 2>/dev/null
73+
! [ -z "${BOOST_INCLUDE+x}" ] && echo 'Environment is ready!' || echo 'Error: $BOOST_INCLUDE is unset. Please adjust the previous commands to fit with your environment.'
74+
```
6975
then you can build MFC and run the test suite!
7076
```shell
7177
./mfc.sh build -j $(nproc)

docs/documentation/case.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ The code outputs error messages when an empty region is left in the domain.
182182
Some parameters, as described above, can be defined by analytical functions in the input file. For example, one can define the following patch:
183183

184184
```shell
185-
'patch_icpp(2)%geometry' : 15,
185+
'patch_icpp(2)%geometry' : 1,
186186
'patch_icpp(2)%x_centroid' : 0.25,
187187
'patch_icpp(2)%length_x' : 9.5,
188188
'patch_icpp(2)%vel(1)' : 0.,
@@ -228,7 +228,7 @@ For example, to add a 2D Hardcoded patch with an id of 200, one would add the fo
228228

229229
and use `patch_icpp(i)%%geometry = 7` and `patch_icpp(i)%%hcid = 200` in the input file.
230230
Additional variables can be declared in `Hardcoded1[2,3]DVariables` and used in `hardcoded1[2,3]D`.
231-
As a convention, any hard coded patches that are part of the MFC master branch should be identified as 1[2,3]xx where the first digit indites the number of dimensions.
231+
As a convention, any hard coded patches that are part of the MFC master branch should be identified as 1[2,3]xx where the first digit indicates the number of dimensions.
232232

233233
#### Parameter Descriptions
234234

@@ -353,9 +353,9 @@ Details of implementation of viscosity in MFC can be found in [Coralic (2015)](r
353353
| `mp_weno` | Logical | Monotonicity preserving WENO |
354354
| `riemann_solver` | Integer | Riemann solver algorithm: [1] HLL*; [2] HLLC; [3] Exact* |
355355
| `low_Mach` | Integer | Low Mach number correction for HLLC Riemann solver: [0] None; [1] Pressure (Chen et al. 2022); [2] Velocity (Thornber et al. 2008) |
356-
| `avg_state` | Integer | Averaged state evaluation method: [1] Roe averagen*; [2] Arithmetic mean |
356+
| `avg_state` | Integer | Averaged state evaluation method: [1] Roe average*; [2] Arithmetic mean |
357357
| `wave_speeds` | Integer | Wave-speed estimation: [1] Direct (Batten et al. 1997); [2] Pressure-velocity* (Toro 1999) |
358-
| `weno_Re_flux` | Logical | Compute velocity gradient using scaler divergence theorem |
358+
| `weno_Re_flux` | Logical | Compute velocity gradient using scalar divergence theorem |
359359
| `weno_avg` | Logical | Arithmetic mean of left and right, WENO-reconstructed, cell-boundary values |
360360
| `dt` | Real | Time step size |
361361
| `t_step_start` | Integer | Simulation starting time step |
@@ -434,7 +434,7 @@ Practically, `weno_eps` $<10^{-6}$ is used.
434434
- `wave_speeds` specifies the choice of the method to compute the left, right, and middle wave speeds in the Riemann solver by an integer of 1 and 2.
435435
`wave_speeds = 1` and `2` correspond to the direct method ([Batten et al., 1997](references.md#Batten97)), and indirect method that approximates the pressures and velocity ([Toro, 2013](references.md#Toro13)), respectively.
436436

437-
- `weno_Re_flux` activates the scaler divergence theorem in computing the velocity gradients using WENO-reconstructed cell boundary values.
437+
- `weno_Re_flux` activates the scalar divergence theorem in computing the velocity gradients using WENO-reconstructed cell boundary values.
438438
If this option is false, velocity gradient is computed using finite difference scheme of order 2 which is independent of the WENO order.
439439

440440
- `weno_avg` it activates the arithmetic average of the left and right, WENO-reconstructed, cell-boundary values.
@@ -592,7 +592,7 @@ Details of the transducer acoustic source model can be found in [Maeda and Colon
592592

593593
- `%%element_on` specifies the element number of the transducer array that is on. The element number starts from 1. If all elements are on, set `%%element_on` to 0.
594594

595-
- `%%element_spacing_angle` specifies the spacing angle between adjacent transducer in radian. The total aperture (`%%aperture`) is set, so each transducer element is smaller if `%%element_spacing_angle` is larger.
595+
- `%%element_spacing_angle` specifies the spacing angle between adjacent transducer in radians. The total aperture (`%%aperture`) is set, so each transducer element is smaller if `%%element_spacing_angle` is larger.
596596

597597
- `%%element_polygon_ratio` specifies the ratio of the polygon side length to the aperture diameter of each transducer element in a circular 3D transducer array. The polygon side length is calculated by using the total aperture (`%%aperture`) as the circumcicle diameter, and `%%num_elements` as the number of sides of the polygon. The ratio is used specify the aperture size of each transducer element in the array, as a ratio of the total aperture.
598598

@@ -678,7 +678,7 @@ Implementation of the parameters into the model follow [Ando (2010)](references.
678678

679679
| Parameter | Type | Description |
680680
| ---: | :----: | :--- |
681-
| `perturb_flow` | Logical | Perturb the initlal velocity field by random noise |
681+
| `perturb_flow` | Logical | Perturb the initlial velocity field by random noise |
682682
| `perturb_flow_fluid` | Integer | Fluid density whose flow is to be perturbed |
683683
| `perturb_flow_mag` | Real | Set the magnitude of flow perturbations |
684684
| `perturb_sph` | Logical | Perturb the initial partial density by random noise |
@@ -789,15 +789,15 @@ The entries labeled "Characteristic." are characteristic boundary conditions bas
789789
| 4 | Sweep line | 2 | Y | Not coordinate aligned. Requires `[x,y]_centroid` and `normal(i)`. |
790790
| 5 | Ellipse | 2 | Y | Requires `[x,y]_centroid` and `radii(i)`. |
791791
| 6 | N/A | 2 | N | No longer exists. Empty. |
792-
| 7 | 2D analytical | 2 | N | Assigns the primitive variables as analytical functions. |
792+
| 7 | 2D Hardcoded | 2 | N | Assigns the primitive variables as analytical functions. |
793793
| 8 | Sphere | 3 | Y | Requires `[x,y,z]_centroid` and `radius` |
794794
| 9 | Cuboid | 3 | N | Coordinate-aligned. Requires `[x,y,z]_centroid` and `length_[x,y,z]`. |
795795
| 10 | Cylinder | 3 | Y | Requires `[x,y,z]_centroid`, `radius`, and `length_[x,y,z]`. |
796796
| 11 | Sweep plane | 3 | Y | Not coordinate-aligned. Requires `x[y,z]_centroid` and `normal(i)`. |
797797
| 12 | Ellipsoid | 3 | Y | Requires `[x,y,z]_centroid` and `radii(i)`. |
798-
| 13 | 3D analytical | 3 | N | Assigns the primitive variables as analytical functions |
798+
| 13 | 3D Hardcoded | 3 | N | Assigns the primitive variables as analytical functions |
799799
| 14 | Spherical Harmonic | 3 | N | Requires `[x,y,z]_centroid`, `radius`, `epsilon`, `beta` |
800-
| 15 | 1D analytical | 1 | N | Assigns the primitive variables as analytical functions |
800+
| 15 | 1D Hardcoded | 1 | N | Assigns the primitive variables as analytical functions |
801801
| 16 | 1D bubble pulse | 1 | N | Requires `x_centroid`, `length_x` |
802802
| 17 | Spiral | 2 | N | Requires `[x,y]_centroid` |
803803
| 18 | 2D Varcircle | 2 | Y | Requires `[x,y]_centroid`, `radius`, and `thickness` |

docs/documentation/getting-started.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ You will also have access to the `.sln` Microsoft Visual Studio solution files f
101101
<details>
102102
<summary><h3>MacOS</h3></summary>
103103

104-
Using [Homebrew](https://brew.sh/) you can install the necessary dependencies:
104+
Using [Homebrew](https://brew.sh/) you can install the necessary dependencies
105+
before configuring your environment:
105106

106107
```shell
107-
brew install coreutils python cmake fftw hdf5 gcc open-mpi
108+
brew install coreutils python cmake fftw hdf5 gcc boost open-mpi
109+
echo -e 'export BOOST_INCLUDE=/opt/homebrew/' | tee -a ~/.bash_profile ~/.zshrc
110+
. ~/.bash_profile 2>/dev/null || . ~/.zshrc 2>/dev/null
111+
! [ -z "${BOOST_INCLUDE+x}" ] && echo 'Environment is ready!' || echo 'Error: $BOOST_INCLUDE is unset. Please adjust the previous commands to fit with your environment.'
108112
```
109113

110114
They will download the dependencies MFC requires to build itself.

misc/fpp_to_fypp.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
for file in $(find src -type f | grep -Ev 'autogen' | grep -E '\.fpp$'); do
4+
echo "$file"
5+
mv "$file" "$(echo "$file" | sed s/\.fpp/\.fypp/)"
6+
done

src/common/include/macros.fpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,19 @@
140140
#endif
141141
#:enddef
142142

143-
#:def PROHIBIT(*args)
144-
#:set condition = args[0]
145-
#:if len(args) == 1
146-
#:set message = '""'
147-
#:else
148-
#:set message = args[1]
149-
#:endif
143+
#:def PROHIBIT(condition, message = None)
150144
if (${condition}$) then
151-
call s_prohibit_abort("${condition}$", ${message}$)
145+
call s_prohibit_abort("${condition}$", ${message or '""'}$)
152146
end if
153147
#:enddef
154148

155149
#define t_vec3 real(kind(0d0)), dimension(1:3)
156150
#define t_mat4x4 real(kind(0d0)), dimension(1:4,1:4)
151+
152+
#:def ASSERT(predicate, message = None)
153+
if (.not. (${predicate}$)) then
154+
call s_mpi_abort("${_FILE_.split('/')[-1]}$:${_LINE_}$: "// &
155+
"Assertion failed: ${predicate}$. " &
156+
//${message or '"No error description."'}$)
157+
end if
158+
#:enddef

0 commit comments

Comments
 (0)