Skip to content

New implementation of the StagnationInflowBC for CFS

Issue/feature addressed

The old implementation of the StagnationInflowBC boundary condition for the compressible flow solver was not correct; in the old implementation, 4 out of 5 conditions were not specified on the inlet, which often led to divergence of the solver. It was also not possible to specify a flow direction, only a specific swirl. It was therefore not possible to specify a flow angle at the inlet, although this is often needed in practice.

In addition to this, the axi-symmetric forcing source term defined by the class ForcingAxiSymmetric had a bug. This bug was found when a new test case for this forcing was developed to replace some of the older tests that tested both the boundary condition and the forcing.

Proposed solution

The StagnationInflowBC implementation has been updated to make sure that 4 out of 5 conditions are imposed at the boundary. The conditions that are imposed are: 1) the stagnation density (through rho in the input file) 2) the stagnation total energy (through E in the input file), and 3) the flow direction (through rhou, rhov, and rhow in the input file).

The stagnation density and stagnation total energy are related to the stagnation pressure and stagnation temperature as: rho0 = p0/(R * T0), and E0 = p0/(Gamma - 1).

Note that a flow direction in 3D imposes two conditions on the flow. To see this, note that we uniquely specify a unit vector in 3D by providing the angle of the vector relative to the x and y axes. A different way to see this is that if we would specify the flow direction and the magnitude, we would specify 3 conditions (x,y,z components of velocity vector), but since we are only specifying the direction, not the magnitude, we only impose two conditions.

To fix the axi-symmetric forcing, the projection of the variable m_geomFactor in ForcingAxiSymmetric::v_InitObject() onto the underlying polynomial space was removed. This variable represents the quantity 1/r, i.e., the reciprocal of the distance from the centerline axis. This factor should not be projected onto the polynomial space, instead the complete source term should first be computed using 1/r, and then projected onto the polynomial space.

Implementation

A more detailed description of the changes. Please include any details necessary for reviewers to understand your work, and point out particular points would like them to pay particular attention to.

Tests

Several tests have been added/removed/updated in this MR. They are detailed below:

Added tests:

  1. solvers/CompressibleFlowSolver/Tests/Duct_Euler_2D_AxiSym_ForcedVortexSwirl.tst
  • This test is designed to test the updated implementation of the axi-symmetric forcing. Details about how the test works are provided in the .tst file and the .xml file
  1. solvers/CompressibleFlowSolver/Tests/SquareDomain_Euler_2D_AxialFlow.tst
  • This test is designed to test the new implementation of the stagnation inflow boundary condition in case the user didn't specify a flow direction. More details about this test are found in the .tst and the .xml files
  1. solvers/CompressibleFlowSolver/Tests/SquareDomain_Euler_2D_DiagonalFlow.tst
  • This test is designed to test the new implementation of the stagnation inflow boundary condition in case the user specifies a flow direction. More details about this test case are found in the .tst and the .xml files

Removed tests:

  1. Nozzle_AxiSym_NoSwirl
  • This test uses both the StagnationInflowBC boundary condition and the axi-symmetric forcing. After the boundary condition was updated, this test fails. This is expected since the implementation changed. A problem with this test is that it is not very specific; it doesn't have an analytical solution or a reference solution it should match. I therefore propose that we remove it, and replace it by the three tests above, which essentially test the same things: the boundary condition and the forcing
  1. Nozzle_AxiSym_Swirl
  • This test is almost identical to the previous one, but the flow has a swirl. Contrary to the previous test, this test will thus test whether the axi-symmetric forcing imposes the right centrifugal force. This is good, but unfortunately the test does not have an analytical solution, nor a well defined reference solution it should match. Instead, it has hard-coded L2 and Linf errors, which makes it hard to know what goes wrong in case the test fails. Therefore, I propose that we remove it, and use the previous tests to cover the stagnation inflow b.c. and the axi-symmetric forcing.
  1. solvers/CompressibleFlowSolver/Tests/PipeFlow_NSAxisym.tst
  • This test case appears to be based on an analytical solution for an incompressible flow in a pipe. By using a low Mach number, the idea is that the compressible solution should be close to the analytical one. However, I don't think this is possible, because the axi-symmetric forcing only includes source terms that come from axi-symmetric, inviscid flow. For a viscous flow, there will be additional source terms coming from the diffusion operators in cylindrical coordinates, and they are not present. I therefore suggest that we simply remove this test.

Suggested reviewers

@jisler , @ssherw , @margarida.moragues

Notes

We might want to add additional tests for the stagnation inflow boundary condition for more element types:

  • Hexahedral elements
  • Tetrahedral elements
  • Prism elements
  • Triangular elements

Checklist

  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Daniel Lindblad

Merge request reports