Skip to content

Add simulation setup for 2D jet in crossflow#1372

Draft
sidkamat wants to merge 2 commits intoMFlowCode:masterfrom
sidkamat:jicf
Draft

Add simulation setup for 2D jet in crossflow#1372
sidkamat wants to merge 2 commits intoMFlowCode:masterfrom
sidkamat:jicf

Conversation

@sidkamat
Copy link
Copy Markdown

This script sets up parameters for a 2D jet in supersonic crossflow simulation, including free stream conditions, jet inlet conditions, viscosities, simulation parameters, and case dictionary for the simulation.

Description

Added case file for a 2D jet in supersonic crossflow case

Fixes #(issue)

Type of change

New example case

Testing

How did you test your changes?

Checklist

  • I added or updated tests for new behavior
  • I updated documentation if user-facing behavior changed

See the developer guide for full coding standards.

GPU changes (expand if you modified src/simulation/)
  • GPU results match CPU results
  • Tested on NVIDIA GPU or AMD GPU

AI code reviews

Reviews are not triggered automatically. To request a review, comment on the PR:

  • @coderabbitai review — incremental review (new changes only)
  • @coderabbitai full review — full review from scratch
  • /review — Qodo review
  • /improve — Qodo code suggestions
  • @claude full review — Claude full review (also triggers on PR open/reopen/ready)
  • Add label claude-full-review — Claude full review via label

This script sets up parameters for a 2D jet in crossflow simulation, including free stream conditions, jet inlet conditions, viscosities, simulation parameters, and case dictionary for the simulation.
@sidkamat sidkamat requested a review from sbryngelson as a code owner April 12, 2026 22:02
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

📝 Walkthrough

Walkthrough

A new Python script was added to the examples directory for a 2D jet-in-crossflow case. The script computes fluid and jet parameters including derived sound speed and inlet velocities from specified conditions. It defines simulation grid, runtime settings, and constructs a comprehensive configuration dictionary that covers domain extents, discretization sizes, CFL control, algorithm and model parameters, boundary-condition patch settings, and two-fluid patch initial conditions. The configuration includes embedded computed values and formatted expressions (such as a tanh velocity profile) and is output as JSON.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new simulation setup script for a 2D jet in crossflow case.
Description check ✅ Passed The description addresses the repository template with a brief summary and specifies the type of change as a new example case, though some sections lack detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b320adf9-55e8-435c-be01-d8b93917a72c

📥 Commits

Reviewing files that changed from the base of the PR and between 1023a4f and 9645ccb.

📒 Files selected for processing (1)
  • examples/2D_jet_in_crossflow/case_2D_jicf.py

Comment on lines +1 to +115
import math
import json

#Free stream
p_inf=16281
rho_inf=0.416
c_inf=math.sqrt(1.4*p_inf/rho_inf)
vel_inf = 2.5*c_inf

#Jet inlet conditions
p_J = 1.0 * p_inf
vel_J = 41.0
rho_J = 1000.0

#Viscosities
mu_inf = 1.85e-5
mu_J = 2.67e-3

d_jet = 1.2e-3

#Simulation parameters
Ny = 3999
Nx = 11999
time_end = 5e-4
cfl = 0.6
eps=1e-8

#Case dictionary

print(
json.dumps(
{
#Logistics
"run_time_info": "T",
#Computational domain parameters
"x_domain%beg": -40*d_jet,
"x_domain%end": 60*d_jet,
"y_domain%beg": 0.0,
"y_domain%end": 35*d_jet,
"m": int(Nx),
"n": int(Ny),
"p": 0,
"cfl_adap_dt": "T",
"t_stop": time_end,
"t_save": time_end/50,
"n_start":0,
"cfl_target": cfl,
#Simulation algorithm parameters
"num_patches": 2,
"model_eqns": 3,
"alt_soundspeed": "F",
"num_fluids": 2,
"mpp_lim": "T",
"mixture_err": "F",
"time_stepper": 3,
"recon_type": 2,
"muscl_order": 2,
"muscl_lim": 1,
"riemann_solver": 2,
"wave_speeds": 1,
"avg_state": 2,
"elliptic_smoothing":"T",
"elliptic_smoothing_iters": 10, #50,
"bc_x%beg": -17,
"bc_x%end": -12,
"bc_y%beg": -17,
"bc_y%end": -3,
"num_bc_patches": 0,
#Formatted Database File Structures
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"parallel_io": "T",
#Patch 1: Free stream
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0.0,
"patch_icpp(1)%y_centroid":50*djet,
"patch_icpp(1)%length_x": 1000*djet,
"patch_icpp(1)%length_y": 1000*djet,
"patch_icpp(1)%vel(1)": f"{vel_inf} * tanh(y / {d_jet / 4})",
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": p_inf,
"patch_icpp(1)%alpha_rho(1)": rho_inf*(1.0-eps),
"patch_icpp(1)%alpha(1)": 1.0-eps,
"patch_icpp(1)%alpha_rho(2)":eps,
"patch_icpp(1)%alpha(2)": eps,
#Patch 2: Jet
"patch_icpp(2)%geometry": 3,
"patch_icpp(2)%alter_patch(1)": "T",
"patch_icpp(2)%x_centroid": 0.0,
"patch_icpp(2)%y_centroid": 0.0,
"patch_icpp(2)%length_x": d_jet,
"patch_icpp(2)%length_y": d_jet,
"patch_icpp(2)%vel(1)": 0.0,
"patch_icpp(2)%vel(2)": vel_J,
"patch_icpp(2)%pres": p_J,
"patch_icpp(2)%alpha_rho(1)": eps,
"patch_icpp(2)%alpha(1)": eps,
"patch_icpp(2)%alpha_rho(2)":(1.0-eps)*rho_J,
"patch_icpp(2)%alpha(2)": 1.0-eps,
#Fluid properties
"fluid_pp(1)%gamma": 1.00/(1.4-1.0),
"fluid_pp(1)%pi_inf": 0.0,
"fluid_pp(2)%gamma": 1.0/(6.12-1.0),
"fluid_pp(2)%pi_inf": 6.12 * 3.43e8 / (6.12 - 1),
"viscous": "T",
"fluid_pp(1)%Re(1)": 1/mu_inf,
"fluid_pp(2)%Re(1)": 1/mu_J,
"surface_tension": "T",
"cf_wrt": "T",
"sigma": 0.072,
}
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Run repository formatter before committing

CI shows this file was auto-reformatted, so the current diff is not formatting-clean and will keep failing checks until formatted output is staged.

./mfc.sh format -j 8
git add examples/2D_jet_in_crossflow/case_2D_jicf.py

As per coding guidelines: "**/*.{fpp,f90,py}: Run ./mfc.sh format -j 8 to auto-format Fortran (.fpp/.f90) and Python files before committing".

🧰 Tools
🪛 GitHub Actions: Lint Toolchain

[error] 1-1: Precheck formatting check failed (mfc: Checking formatting). Code was not formatted; file was auto-formatted—review and stage the changes.

🪛 GitHub Actions: Pretty

[error] 1-1: CI formatting check failed: ./mfc.sh format reformatted 1 file, but git diff --exit-code detected changes (process exited with code 1). File reformatted: examples/2D_jet_in_crossflow/case_2D_jicf.py.

🪛 Ruff (0.15.9)

[error] 77-77: Undefined name djet

(F821)


[error] 78-78: Undefined name djet

(F821)


[error] 79-79: Undefined name djet

(F821)

Comment on lines +77 to +79
"patch_icpp(1)%y_centroid":50*djet,
"patch_icpp(1)%length_x": 1000*djet,
"patch_icpp(1)%length_y": 1000*djet,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix undefined variable typo (djetd_jet)

Line 77–79 use djet, but only d_jet is defined (Line 19). This will crash the case script with NameError before it can emit JSON.

🐛 Proposed fix
-                "patch_icpp(1)%y_centroid":50*djet,
-                "patch_icpp(1)%length_x": 1000*djet,
-                "patch_icpp(1)%length_y": 1000*djet,
+                "patch_icpp(1)%y_centroid": 50 * d_jet,
+                "patch_icpp(1)%length_x": 1000 * d_jet,
+                "patch_icpp(1)%length_y": 1000 * d_jet,
🧰 Tools
🪛 Ruff (0.15.9)

[error] 77-77: Undefined name djet

(F821)


[error] 78-78: Undefined name djet

(F821)


[error] 79-79: Undefined name djet

(F821)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.84%. Comparing base (ec94064) to head (7822bba).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1372      +/-   ##
==========================================
- Coverage   64.90%   64.84%   -0.06%     
==========================================
  Files          70       70              
  Lines       18254    18217      -37     
  Branches     1508     1500       -8     
==========================================
- Hits        11847    11813      -34     
- Misses       5444     5449       +5     
+ Partials      963      955       -8     

☔ 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.

@sbryngelson sbryngelson marked this pull request as draft April 13, 2026 03:55
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.

1 participant