Skip to content

Add CFL Based Adaptive Time-Stepping #515

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 32 commits into from
Sep 9, 2024
Merged

Conversation

wilfonba
Copy link
Contributor

@wilfonba wilfonba commented Jul 9, 2024

Description

This PR adds constant CFL time-stepping for all physics. The new feature is compatible with the existing ability to restart cases with additional patches.

Fixes #298

Type of change

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

Scope

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

How Has This Been Tested?

Checklist

  • 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)
  • Compared ns/gp/eq/rhs
    V100 - cfl_adap_dt (3.320) constant dt (3.311) 8M Cells on 1 V100
    M2 - cfl_adap_dt (66.645) constant dt (65.657) 1M Cells on 1 core

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 79.12088% with 38 lines in your changes missing coverage. Please review.

Project coverage is 54.69%. Comparing base (dec9171) to head (2357359).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_start_up.fpp 76.08% 8 Missing and 3 partials ⚠️
src/simulation/m_time_steppers.fpp 61.53% 8 Missing and 2 partials ⚠️
src/simulation/m_sim_helpers.f90 90.00% 3 Missing and 1 partial ⚠️
src/simulation/p_main.fpp 80.00% 1 Missing and 3 partials ⚠️
src/pre_process/m_data_output.fpp 57.14% 3 Missing ⚠️
src/pre_process/m_start_up.fpp 25.00% 3 Missing ⚠️
src/post_process/p_main.fpp 85.71% 1 Missing and 1 partial ⚠️
src/simulation/m_rhs.fpp 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #515      +/-   ##
==========================================
+ Coverage   53.99%   54.69%   +0.70%     
==========================================
  Files          58       59       +1     
  Lines       13719    13662      -57     
  Branches     1635     1698      +63     
==========================================
+ Hits         7407     7473      +66     
+ Misses       5867     5740     -127     
- Partials      445      449       +4     

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

@sbryngelson
Copy link
Member

@wilfonba this codecov thing is amazing. It shows what lines you added that aren't covered in the test suite! Not that you have to cover 100% of the new lines, but you might be able to see what cases aren't covered that you could easily add.

@wilfonba
Copy link
Contributor Author

Yeah. I'm sure I can up the coverage a decent amount without too many additional tests. Apparently I need to fix GPUs too

@wilfonba wilfonba marked this pull request as ready for review July 12, 2024 13:19
@wilfonba wilfonba requested a review from henryleberre as a code owner July 12, 2024 13:19
@sbryngelson
Copy link
Member

sbryngelson commented Sep 5, 2024

Can you run an ./mfc.sh test -l and copy/paste the new test case [names] here so I know what they are?

@wilfonba
Copy link
Contributor Author

wilfonba commented Sep 5, 2024

  0501B3DA   1D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  AE02324F   1D -> Bodyforces -> cfl_adap_dt=T                                      
  D80F2162   2D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  121D4ECA   2D -> Bodyforces -> cfl_adap_dt=T                                      
  128954AD   3D -> Cylindrical -> cfl_adap_dt=T                                     
  07C54EDD   3D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  B54BB9D8   3D -> Bodyforces -> cfl_adap_dt=T 
  37FA2CEF   1D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T  
  6B1AD553   2D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T  
  53A15FFC   3D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T

@wilfonba
Copy link
Contributor Author

wilfonba commented Sep 5, 2024

This list was created with #518 . I figured it would be more clear this way.

@sbryngelson
Copy link
Member

  0501B3DA   1D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  AE02324F   1D -> Bodyforces -> cfl_adap_dt=T                                      
  D80F2162   2D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  121D4ECA   2D -> Bodyforces -> cfl_adap_dt=T                                      
  128954AD   3D -> Cylindrical -> cfl_adap_dt=T                                     
  07C54EDD   3D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_adap_dt=T  
  B54BB9D8   3D -> Bodyforces -> cfl_adap_dt=T 
  37FA2CEF   1D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T  
  6B1AD553   2D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T  
  53A15FFC   3D -> Viscosity -> Bubbles -> QBMM -> bubble_model=3 -> cfl_const_dt=T

Perfect, thanks

@sbryngelson
Copy link
Member

@wilfonba is this ready for review/merge?

@wilfonba
Copy link
Contributor Author

wilfonba commented Sep 6, 2024

Most all of the requested changes have been addressed. I feel that updating m_riemann_solvers would be better suited for a separate PR to adhere to the "This PR comprises a set of related changes with a common goal" checkbox. I've already kind of exceeded this with my changes to m_data_output, so I'd like to minimize the violation.

@sbryngelson
Copy link
Member

Most all of the requested changes have been addressed. I feel that updating m_riemann_solvers would be better suited for a separate PR to adhere to the "This PR comprises a set of related changes with a common goal" checkbox. I've already kind of exceeded this with my changes to m_data_output, so I'd like to minimize the violation.

Please open an issue detailing what you didn't do, then, please.

@sbryngelson sbryngelson merged commit 63c79cb into MFlowCode:master Sep 9, 2024
22 checks passed
@wilfonba wilfonba deleted the CFLDT branch September 10, 2024 18:16
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.

Adaptive time stepping with embedded Runge-Kutta and/or CFL
2 participants