Skip to content

Add Broadband Acoustic Src #706

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 17 commits into from
Nov 13, 2024
Merged

Add Broadband Acoustic Src #706

merged 17 commits into from
Nov 13, 2024

Conversation

haochey
Copy link
Contributor

@haochey haochey commented Nov 8, 2024

Description

Broadband source creates acoustic wave with similar amplitude across a wide range of frequency. It will be useful for simulations for noise reduction.

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?

Using a probe to record the pressure time history of the source.

Test Configuration:
import json, math

Configuring case dictionary

print(json.dumps({
# Logistics ================================================================
'run_time_info' : 'T',
# ==========================================================================

# Computational Domain Parameters ==========================================
'x_domain%beg'                 : 0,
'x_domain%end'                 : 0.3,
'y_domain%beg'                 : 0,
'y_domain%end'                 : 0.1,
'm'                            : 299,
'n'                            : 99,
'p'                            : 0,
'dt'                           : 5e-7,
't_step_start'                 : 0,
't_step_stop'                  : 50000,
't_step_save'                  : 500,
# ==========================================================================

# Simulation Algorithm Parameters ==========================================
'num_patches'                  : 1,
'model_eqns'                   : 2,
'alt_soundspeed'               : 'F',
'num_fluids'                   : 1,
'mpp_lim'                      : 'F',
'mixture_err'                  : 'F',
'time_stepper'                 : 3,
'weno_order'                   : 5,
'weno_eps'                     : 1.E-16,
'teno'                         : 'T',
'teno_CT'                      : 1E-8,
'null_weights'                 : 'F',
'mp_weno'                      : 'F',
'riemann_solver'               : 2,
'wave_speeds'                  : 1,
'avg_state'                    : 2,
'bc_x%beg'                     : -6,
'bc_x%end'                     : -6,
'bc_y%beg'                     : -6,
'bc_y%end'                     : -6,
# ==========================================================================

# Formatted Database Files Structure Parameters ============================
'format'                       : 1,
'precision'                    : 2,
'prim_vars_wrt'                :'T',
'parallel_io'                  :'T',
'probe_wrt'                    :'T',
'fd_order'                     : 2,
'num_probes'                   : 1,
'probe(1)%x'                   : 0.13,
'probe(1)%y'                   : 0.05,

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

# Patch 1 Liquid ===========================================================
'patch_icpp(1)%geometry'       : 3,
'patch_icpp(1)%x_centroid'     : 0.15,
'patch_icpp(1)%y_centroid'     : 0.05,
'patch_icpp(1)%length_x'       : 0.3,
'patch_icpp(1)%length_y'       : 0.1,
'patch_icpp(1)%vel(1)'         : 0.0,
'patch_icpp(1)%vel(2)'         : 0.0,
'patch_icpp(1)%pres'           : 1E+05,
'patch_icpp(1)%alpha_rho(1)'   : 1.19,
'patch_icpp(1)%alpha(1)'       : 1.0,
# ==========================================================================

# Acoustic source ==========================================================
'acoustic_source'              : 'T',
'num_source'                   : 1,
'acoustic(1)%support'          : 2,
'acoustic(1)%loc(1)'           : 0.1,
'acoustic(1)%loc(2)'           : 0.05,
'acoustic(1)%dir'              : math.pi * 0,
'acoustic(1)%length'           : 0.1,
'acoustic(1)%pulse'            : 4,
'acoustic(1)%npulse'           : 1000000,
'acoustic(1)%mag'              : 10.,
# 'acoustic(1)%gauss_sigma_time' : 2E-8,
# 'acoustic(1)%delay'            : 1E-7,
# ==========================================================================

# Fluids Physical Parameters ===============================================
'fluid_pp(1)%gamma'            : 1.E+00/(4.4E+00-1.E+00),
'fluid_pp(1)%pi_inf'           : 0,
# ==========================================================================

}))

Screen Shot 2024-11-07 at 11 40 27 PM
  • What computers and compilers did you use to test this: MacOS/GCC, Phoenix-CPU/GCC, Phoenix-GPU/NVHPC

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)
  • 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 Nov 8, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 20 lines in your changes missing coverage. Please review.

Project coverage is 42.95%. Comparing base (6742230) to head (c1b6c6c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_acoustic_src.fpp 35.00% 13 Missing ⚠️
src/simulation/m_checker.fpp 0.00% 4 Missing ⚠️
src/simulation/m_mpi_proxy.fpp 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #706      +/-   ##
==========================================
- Coverage   42.97%   42.95%   -0.03%     
==========================================
  Files          61       61              
  Lines       16315    16340      +25     
  Branches     1882     1883       +1     
==========================================
+ Hits         7012     7019       +7     
- Misses       8260     8279      +19     
+ Partials     1043     1042       -1     

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

Copy link
Member

@sbryngelson sbryngelson left a comment

Choose a reason for hiding this comment

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

please address comments and add full documentation :D

@haochey haochey marked this pull request as ready for review November 11, 2024 03:12
@sbryngelson
Copy link
Member

Needs test suite cases in 1D and 2D at least

@haochey haochey requested a review from sbryngelson November 11, 2024 20:57
@haochey haochey requested a review from sbryngelson November 12, 2024 02:04
Copy link
Member

@sbryngelson sbryngelson left a comment

Choose a reason for hiding this comment

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

just a couple more questions/changes

@sbryngelson sbryngelson merged commit bb21236 into MFlowCode:master Nov 13, 2024
25 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.

2 participants