Skip to content

Commit

Permalink
Upstream non-Phase Change additions from #179 (#223)
Browse files Browse the repository at this point in the history
Co-authored-by: JRChreim <jrchreim@outlook.com>
  • Loading branch information
henryleberre and JRChreim authored Nov 11, 2023
1 parent ebdfce8 commit dddba82
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/tests/**/* linguist-generated=true
6 changes: 4 additions & 2 deletions mfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ if [ "$1" == 'load' ]; then

return
elif [ "$1" == "format" ]; then
shift

if ! command -v fprettify > /dev/null 2>&1; then
pip3 install --upgrade fprettify
fi

fprettify src --exclude "src/*/autogen" --recursive \
fprettify ${@:-src} --exclude "src/*/autogen" --recursive --silent \
--indent 4 --c-relations --enable-replacements --enable-decl \
--whitespace-comma 1 --whitespace-multdiv 0 --whitespace-plusminus 1 \
--whitespace-comma 1 --whitespace-multdiv 1 --whitespace-plusminus 1 \
--case 1 1 1 1 --strict-indent
ret="$?"

Expand Down
24 changes: 12 additions & 12 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,11 @@ contains
q_cons_vf(i)%sf(j, k, l) = q_prim_vf(i)%sf(j, k, l)
end do

! Transferring the advection equation(s) variable(s)
do i = adv_idx%beg, adv_idx%end
q_cons_vf(i)%sf(j, k, l) = q_prim_vf(i)%sf(j, k, l)
end do

! Zeroing out the dynamic pressure since it is computed
! iteratively by cycling through the velocity equations
dyn_pres = 0d0
Expand Down Expand Up @@ -1030,19 +1035,15 @@ contains

! Computing the internal energies from the pressure and continuities
if (model_eqns == 3) then
do i = internalEnergies_idx%beg, internalEnergies_idx%end
q_cons_vf(i)%sf(j, k, l) = q_cons_vf(i - adv_idx%end)%sf(j, k, l)* &
fluid_pp(i - adv_idx%end)%gamma* &
q_prim_vf(E_idx)%sf(j, k, l) + &
fluid_pp(i - adv_idx%end)%pi_inf
do i = 1, num_fluids
! internal energy calculation for each of the fluids
q_cons_vf(i + internalEnergies_idx%beg - 1)%sf(j, k, l) = &
q_cons_vf(i + adv_idx%beg - 1)%sf(j, k, l)* &
(fluid_pp(i)%gamma*q_prim_vf(E_idx)%sf(j, k, l) + &
fluid_pp(i)%pi_inf)
end do
end if

! Transferring the advection equation(s) variable(s)
do i = adv_idx%beg, adv_idx%end
q_cons_vf(i)%sf(j, k, l) = q_prim_vf(i)%sf(j, k, l)
end do

if (bubbles) then
! From prim: Compute nbub = (3/4pi) * \alpha / \bar{R^3}
do i = 1, nb
Expand All @@ -1061,8 +1062,7 @@ contains
!Initialize nb
nbub = 3d0 * q_prim_vf(alf_idx)%sf(j, k, l) / (4d0 * pi * R3tmp)
end if



if (j == 0 .and. k == 0 .and. l == 0) print *, 'In convert, nbub:', nbub
do i = bub_idx%beg, bub_idx%end
q_cons_vf(i)%sf(j, k, l) = q_prim_vf(i)%sf(j, k, l)*nbub
Expand Down
7 changes: 7 additions & 0 deletions src/pre_process/m_assign_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@ subroutine s_assign_patch_species_primitive_variables(patch_id, j, k, l, &
+ (1d0 - eta)*orig_prim_vf(1 + cont_idx%end))
end if

! Set partial pressures to mixture pressure for the 6-eqn model
if (model_eqns == 3) then
do i = internalEnergies_idx%beg, internalEnergies_idx%end
q_prim_vf(i)%sf(j, k, l) = q_prim_vf(E_idx)%sf(j, k, l)
end do
end if

! Smoothed bubble variables
if (bubbles) then
do i = 1, nb
Expand Down
14 changes: 7 additions & 7 deletions tests/043B535A/golden.txt

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions tests/2F35A1FE/golden.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions tests/4F2F4ACE/golden.txt

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions tests/6241177B/golden.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions tests/B89B8C70/golden.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions tests/F0E6771E/golden.txt

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/FD891191/golden.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions toolchain/mfc/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def add_common_arguments(p, mask = None):
test_meg = test.add_mutually_exclusive_group()
test_meg.add_argument("--generate", action="store_true", default=False, help="(Test Generation) Generate golden files.")
test_meg.add_argument("--add-new-variables", action="store_true", default=False, help="(Test Generation) If new variables are found in D/ when running tests, add them to the golden files.")
test_meg.add_argument("--remove-old-tests", action="store_true", default=False, help="(Test Generation) Delete tests directories that are no longer.")

# === RUN ===
engines = [ e.slug for e in ENGINES ]
Expand Down
9 changes: 6 additions & 3 deletions toolchain/mfc/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ def __filter():

def test():
global CASES, nFAIL

# Delete UUIDs that are not in the list of CASES from tests/
if ARG("generate"):
dir_uuids = set([name for name in os.listdir(".") if os.path.isdir(name)])
if ARG("remove_old_tests"):
dir_uuids = set(os.listdir(common.MFC_TESTDIR))
new_uuids = set([case.get_uuid() for case in CASES])

for old_uuid in dir_uuids - new_uuids:
cons.print(f"[bold red]Deleting:[/bold red] {old_uuid}")
common.delete_directory(f"{common.MFC_TESTDIR}/{old_uuid}")

return

__filter()

Expand Down

0 comments on commit dddba82

Please sign in to comment.