Skip to content

Comments

docs: Example on pipe flow [skip tests]#4883

Open
MohammedAnsys wants to merge 4 commits intomainfrom
docs/example_on_pipe_flow
Open

docs: Example on pipe flow [skip tests]#4883
MohammedAnsys wants to merge 4 commits intomainfrom
docs/example_on_pipe_flow

Conversation

@MohammedAnsys
Copy link
Collaborator

Context

No existing example demonstrated thermal energy transport with constant wall temperature boundary conditions and validation against analytical heat transfer solutions.

Change Summary

Added pipe_flow example simulating oil flow through a pipe submerged in icy lake water. Includes laminar flow setup, energy equation, custom oil material properties, constant wall temperature (0°C), temperature profile visualization, and analytical validation using Nusselt number correlations. Added 2 supporting images.

Rationale

Provides a validated benchmark for conjugate heat transfer in PyFluent

Impact

Purely additive, no modifications to existing code

@MohammedAnsys MohammedAnsys self-assigned this Feb 2, 2026
Copilot AI review requested due to automatic review settings February 2, 2026 17:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new pipe flow example demonstrating thermal energy transport with constant wall temperature boundary conditions. The example simulates oil flowing through a pipe submerged in icy lake water and validates results against analytical Nusselt number correlations.

Changes:

  • Added comprehensive pipe flow example with laminar flow, energy equation, custom oil properties, and temperature profile visualization
  • Updated documentation configuration to include the new example in the gallery
  • Added CI workflow step to execute the new example

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 4 comments.

File Description
examples/00-fluent/pipe_flow.py New example script implementing pipe flow simulation with thermal analysis and analytical validation
doc/source/conf.py Added pipe_flow.py to sphinx-gallery filename pattern for documentation generation
.github/workflows/execute-examples-weekly.yml Added execution step for pipe_flow.py in weekly CI workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples maintenance General maintenance of the repo (libraries, cicd, etc) CI/CD labels Feb 2, 2026
MohammedAnsys and others added 2 commits February 2, 2026 23:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 2, 2026 17:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +160 to +161
"density": 888.1,
"viscosity": 0.0009429,
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The viscosity value appears to be kinematic viscosity (ν) in m²/s as specified in the problem description, but Fluent typically expects dynamic viscosity (μ) in Pa·s or kg/(m·s). This should be converted: μ = ρ × ν = 888.1 × 0.0009429 ≈ 0.8375 Pa·s.

Suggested change
"density": 888.1,
"viscosity": 0.0009429,
"density": 888.1, # kg/m^3
"viscosity": 0.8375, # Pa·s (dynamic viscosity μ = 888.1 kg/m^3 × 0.0009429 m^2/s)

Copilot uses AI. Check for mistakes.
fluid_materials.rename(new="oil", old="air")
fluid_materials["oil"] = {
"density": 888.1,
"viscosity": 0.0009429,
Copy link
Collaborator

@seanpearsonuk seanpearsonuk Feb 3, 2026

Choose a reason for hiding this comment

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

@MohammedAnsys The resolved Copilot comments regarding viscosity here are justified.

calculation = RunCalculation(solver)
calculation.iterate(iter_count=300)

# %%
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment should go before the iterate() call and it should not comment concretely on what has happened.

E.g.,

# Allow up to 300 iterations. The solver will terminate early if
# convergence criteria are met, so the actual iteration count may
# be lower and can vary between runs.
calculation.iterate(iter_count=300)

#
# Analytical outlet temperature: :T_e = 292.74 K
#
# PyFluent outlet temperature: :T_e = 291.79 K
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might refer to this as a typical result for PyFluent, given that the user is not guaranteed to get the same result in future.

#
# PyFluent outlet temperature: :T_e = 291.79 K
#
# Both approaches show only a small temperature drop over the 200-m pipe, consistent with the very long thermal entry length.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have concerns about how this validation is being presented.

  1. Significance of the discrepancy

The discussion compares two absolute outlet temperatures and concludes that “both show only a small temperature drop.”
However, the relevant quantity for validation is not the absolute temperature but the temperature drop relative to the inlet:

  • Inlet: 293.15 K
  • Analytical outlet: 292.74 K → ΔT ≈ 0.41 K
  • PyFluent outlet: 291.79 K → ΔT ≈ 1.36 K

The difference between the two predicted drops (~0.95 K) is more than twice the magnitude of the analytical drop itself.
That is not a minor deviation—it corresponds to substantially different thermal behaviour over the pipe length.

As written, the text risks giving the impression that the two approaches are in close agreement when, in terms of the physics being evaluated (heat transfer rate), they are not.

  1. Model vs. model vs. reality

The analytical solution is itself a model based on idealisations (fully developed laminar flow, constant properties, etc.).
The PyFluent result is another model with different assumptions and discretisation.

What we are doing here is:

model A ↔ model B

not

model ↔ physical reality.

The discussion should acknowledge that a discrepancy reflects a gap between two modelling approaches, and that either (or neither) may be closer to reality. Calling this a “validation of PyFluent’s capability” feels too strong without experimental reference data or a more rigorous error analysis.

  1. Viscosity specification

There is also the unresolved issue noted earlier: the example appears to supply kinematic viscosity where Fluent expects dynamic viscosity.
The material properties used in the simulation are inconsistent which would directly affect the Prandtl number and the predicted thermal entry behaviour.

Before drawing conclusions about agreement with the analytical solution, we should correct the viscosity definition.

Copy link
Collaborator

@seanpearsonuk seanpearsonuk left a comment

Choose a reason for hiding this comment

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

Changes requested as per comments. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples maintenance General maintenance of the repo (libraries, cicd, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants