Skip to content

Lodi multi component #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 22, 2025
Merged

Conversation

DimAdam-01
Copy link
Contributor

@DimAdam-01 DimAdam-01 commented May 19, 2025

Description

Please include a summary of the changes and the related issue(s) if they exist.
Please also include relevant motivation and context.

This pull request adds support for the Non-Reflecting Subsonic/Supersonic Characteristic Boundary Conditions (NSCBC) in multicomponent flows. It enables subsonic inflow/outflow and supersonic inflow/outflow treatments for mixtures with an arbitrary number of species.

Existing boundary-condition modules cannot handle the chemistry (different equation of the mixture energy).

Fixes #(issue) [optional]

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Scope

  • This PR comprises a set of related changes with a common goal

If you cannot check the above box, please split your PR into multiple PRs that each have a common goal.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration
xx

Species Mass frctions

Pressure_Velocity

  • Test B: 2D Supersonic Inflow with Vortex (Eight Species)

Test Configuration: Square domain [0,L]x[0,1] with Mach 1.1 inflow at x=0 and supersonic outflow elsewhere; superimposed vortex field. (doi:10.1006/jcph.2002.6990). The video shows the temporal and spatial evolution of the mass fraction of CH4 (Methane)

Sup_0.mp4
  • Test C: 2D Subsonic Inflow with 2 Vortices (Eight Species)

Test Configuration: Square domain [0,L]×[0,L] with uniform 𝑢=50 m/s subsonic inflow at 𝑥 = 0 and subsonic outflow elsewhere; 2 superimposed vortices, from (http://dx.doi.org/10.1088/1364-7830/7/4/006). The video shows the temporal and spatial evolution of the mass fraction of CH4 (Methane)

sub_0.mp4
  • Test D: 2D Dual Supersonic Inflow (Eight Species)

2-dimensional advection of 8 species, with supersonic inflow and a superimposed vortex, from (doi:10.1006/jcph.2002.6990)
Test Configuration: Square domain with Mach 1.1 inflows at both 𝑥=0 and 𝑦=0; supersonic outflow on remaining sides. The video shows the temporal and spatial evolution of the Pressure.

Sup_Sup.mp4
  • Test E: Mixed Supersonic/Subsonic Inflow (Eight Species)

Square domain with Mach 1.1 supersonic inflow at 𝑥= 0, and subsonic inflow at 𝑦=0; corresponding mixed outflow elsewhere. Supersonic velocity along 𝑥, subsonic along 𝑦. The video shows the temporal and spatial evolution of the Temperature.

Sup_sub.mp4
  • What computers and compilers did you use to test this:

My personal laptop, Delta (A100) and Delta AI (GH)

Checklist

  • [x ] I have added comments for the new code
  • I added Doxygen docstrings to the new code
  • I have made corresponding changes to the documentation (docs/)
  • I have added regression tests to the test suite so that people can verify in the future that the feature is behaving as expected
  • I have added example cases in examples/ that demonstrate my new feature performing as expected.
    They run to completion and demonstrate "interesting physics"
  • I ran ./mfc.sh format before committing my code
  • New and existing tests pass locally with my changes, including with GPU capability enabled (both NVIDIA hardware with NVHPC compilers and AMD hardware with CRAY compilers) and disabled
  • This PR does not introduce any repeated code (it follows the DRY principle)
  • I cannot think of a way to condense this code and reduce any introduced additional line count

If your code changes any code source files (anything in src/simulation)

To make sure the code is performing as expected on GPU devices, I have:

  • Checked that the code compiles using NVHPC compilers
  • Checked that the code compiles using CRAY compilers
  • Ran the code on either V100, A100, or H100 GPUs and ensured the new feature performed as expected (the GPU results match the CPU results)
  • Ran the code on MI200+ GPUs and ensure the new features performed as expected (the GPU results match the CPU results)
  • Enclosed the new feature via nvtx ranges so that they can be identified in profiles
  • Ran a Nsight Systems profile using ./mfc.sh run XXXX --gpu -t simulation --nsys, and have attached the output file (.nsys-rep) and plain text results to this PR
  • Ran an Omniperf profile using ./mfc.sh run XXXX --gpu -t simulation --omniperf, and have attached the output file and plain text results to this PR.
  • Ran my code using various numbers of different GPUs (1, 2, and 8, for example) in parallel and made sure that the results scale similarly to what happens if you run without the new code/feature

Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 27.39726% with 53 lines in your changes missing coverage. Please review.

Project coverage is 43.24%. Comparing base (4949c07) to head (55c9549).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_cbc.fpp 32.65% 33 Missing ⚠️
src/simulation/m_compute_cbc.fpp 21.42% 11 Missing ⚠️
src/common/m_variables_conversion.fpp 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #838      +/-   ##
==========================================
- Coverage   43.34%   43.24%   -0.11%     
==========================================
  Files          68       68              
  Lines       20128    20182      +54     
  Branches     2400     2401       +1     
==========================================
+ Hits         8725     8728       +3     
- Misses       9934     9985      +51     
  Partials     1469     1469              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DimAdam-01 DimAdam-01 marked this pull request as ready for review May 21, 2025 18:00
@DimAdam-01 DimAdam-01 requested review from a team and sbryngelson as code owners May 21, 2025 18:00
@sbryngelson
Copy link
Member

you removed the images of the 1d reactive shock tube example, could you put those back? also is LODI optional or always used?

Comment on lines +1524 to +1539
if (chemistry) then
!$acc loop seq
do i = chemxb, chemxe
Y_K(i - chemxb + 1) = qK_prim_vf(j, k, l, i)
end do
!Computing the energy from the internal energy of the mixture
call get_mixture_molecular_weight(Y_k, mix_mol_weight)
R_gas = gas_constant/mix_mol_weight
T_K = pres_K/rho_K/R_gas
call get_mixture_energy_mass(T_K, Y_K, E_K)
E_K = rho_K*E_K + 5e-1_wp*rho_K*vel_K_sum
else
! Computing the energy from the pressure
E_K = gamma_K*pres_K + pi_inf_K &
+ 5e-1_wp*rho_K*vel_K_sum + qv_K
end if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure this doesn't have any performance impact on non-chemistry cases? This variables conversion subroutine can be really touchy on AMD hardware...

@DimAdam-01
Copy link
Contributor Author

you removed the images of the 1d reactive shock tube example, could you put those back? also is LODI optional or always used?
It’s only used when characteristic boundary conditions are selected for chemistry cases

@sbryngelson sbryngelson merged commit 59d9431 into MFlowCode:master May 22, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants