Skip to content

Commit 5b4999a

Browse files
author
Thomas Jackson
committed
Add heterogeneous reacting surface boundary conditions
1 parent 3a7fa66 commit 5b4999a

13 files changed

Lines changed: 856 additions & 34 deletions

File tree

docs/documentation/case.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
356356
| `airfoil_id` | Integer | Index into `ib_airfoil` array for NACA airfoil geometry patches. |
357357
| `model_id` | Integer | Index into `stl_models` array for STL/OBJ geometry patches. |
358358
| `slip` | Logical | Apply a slip boundary |
359+
| `thermal_bc` | Integer | Thermal boundary-condition selector: 0 = zero-normal-gradient temperature, 1 = prescribed wall temperature, 2 = reacting surface energy balance. |
360+
| `Twall` | Real | Prescribed wall temperature used when `thermal_bc = 1`. |
361+
| `surface_reaction` | Integer | Heterogeneous surface-reaction flag: 0 = disabled, 1 = enabled. |
359362
| `moving_ibm` | Integer | Sets the method used for IB movement. |
360363
| `vel(i)` | Real | Initial velocity of the moving IB in the i-th direction. |
361364
| `angular_vel(i)` | Real | Initial angular velocity of the moving IB in the i-th direction. |
@@ -394,6 +397,12 @@ Additional details on this specification can be found in [NACA airfoil](https://
394397

395398
- `slip` applies a slip boundary to the surface of the patch if true and a no-slip boundary condition to the surface if false.
396399

400+
- `thermal_bc` selects the thermal immersed-boundary condition. A value of 0 applies a zero-normal-gradient temperature condition, 1 prescribes the wall temperature using `Twall`, and 2 solves the reacting-surface energy balance for the surface temperature. The `thermal_bc = 2` option requires `surface_reaction = 1`.
401+
402+
- `Twall` specifies the prescribed surface temperature when `thermal_bc = 1` and must be positive in that case.
403+
404+
- `surface_reaction` enables heterogeneous surface chemistry when set to 1. Surface reactions require `chemistry = T` and cannot be combined with `inj_species > 0`.
405+
397406
- For STL/OBJ geometry (geometry 5 or 12), set `model_id` to index into the `stl_models` array and specify `model_filepath`, `model_scale`, `model_translate`, and `model_threshold` on that entry.
398407

399408
- `moving_ibm` sets the method by which movement will be applied to the immersed boundary. Using 0 will result in no movement. Using 1 will result 1-way coupling where the boundary moves at a constant rate and applied forces to the fluid based upon its own motion. In 1-way coupling, the fluid does not apply forces back onto the IB. Using 2 will result in 2-way coupling, where the boundary pushes on the fluid and the fluid pushes back on the boundary via pressure and viscous forces. If external forces are applied, the boundary will also experience those forces.
@@ -1184,13 +1193,17 @@ When ``cyl_coord = 'T'`` is set in 2D the following constraints must be met:
11841193
| `chem_params%%adap_substeps` | Logical | Per-rank adaptive sub-step count driven by local stiffness |
11851194
| `chem_params%%reaction_substeps_max` | Integer | Sub-step ceiling when `adap_substeps` is enabled |
11861195
| `cantera_file` | String | Cantera-format mechanism file (e.g., .yaml) |
1196+
| `surface_cantera_file` | String | Cantera-format mechanism file for heterogeneous surface chemistry |
1197+
| `surface_phase` | String | Cantera interface phase name for heterogeneous surface chemistry |
11871198

11881199
- `chem_params%%transport_model` specifies the methodology for calculating diffusion coefficients and other transport properties, `1` for mixture-average, `2` for Unity-Lewis
11891200
- `chem_params%%reaction_substeps` controls how the reaction source is integrated. With `0` (default) the net production rates are added to the flow right-hand side and advanced by the flow time stepper (fine for hydrogen). With a value `> 0`, the reaction is instead integrated by operator splitting after each flow update: every cell's constant-density, constant-internal-energy reactor is advanced over the timestep with that many sub-steps of an **α-QSS** (quasi-steady-state) integrator — a matrix-free, Jacobian-free predictor–corrector (Mott/CHEMEQ2) that splits the net rate into creation/destruction parts and applies a Padé α-weighting, so it stays stable on stiff mechanisms where an explicit source diverges. This decouples the (often much faster) chemical timescale from the flow timestep and is required for stiff mechanisms — e.g. hydrocarbons such as GRI-Mech methane, which otherwise diverge on the first step
11901201
- `chem_params%%adap_substeps` (default `F`) makes each rank choose its α-QSS sub-step count per flow step from the largest chemical stiffness among its own cells: the count sits at `reaction_substeps` (the floor) in inert or burned gas and rises toward `reaction_substeps_max` (the ceiling) only across the reaction front. It uses no MPI collectives. When enabled, `reaction_substeps >= 1` and `reaction_substeps_max >= reaction_substeps` are required
11911202

11921203
- `cantera_file` specifies the chemical mechanism file. If the file is part of the standard Cantera library, only the filename is required. Otherwise, the file must be located in the same directory as your `case.py` file
11931204

1205+
- `surface_cantera_file` and `surface_phase` specify the Cantera mechanism file and interface phase used for heterogeneous surface chemistry. These parameters must be specified together when a surface mechanism is used.
1206+
11941207
### 18. Chemistry-Specific Boundary Conditions
11951208

11961209
| Parameter | Type | Description |

src/common/m_derived_types.fpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,21 @@ module m_derived_types
349349
real(wp), dimension(1:3,1:3) :: rotation_matrix
350350
!> matrix that converts from fluid reference frame to IB reference frame
351351
real(wp), dimension(1:3,1:3) :: rotation_matrix_inverse
352-
integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
353-
integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
354-
real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
355-
real(wp) :: radius !< Dimensions of the patch. radius.
356-
logical :: slip
352+
integer :: airfoil_id !< index into ib_airfoil(:) for airfoil geometry patches
353+
integer :: model_id !< index into stl_models(:) for STL/OBJ geometry patches
354+
real(wp) :: length_x, length_y, length_z !< Dimensions of the patch. x,y,z Lengths.
355+
real(wp) :: radius !< Dimensions of the patch. radius.
356+
logical :: slip
357+
358+
! Thermal immersed-boundary condition
359+
! 0 = zero-normal-gradient temperature
360+
! 1 = prescribed wall temperature (Twall)
361+
! 2 = reacting surface energy balance
362+
integer :: thermal_bc
363+
real(wp) :: Twall
364+
365+
! Heterogeneous surface reaction 0 = none 1 = enabled
366+
integer :: surface_reaction
357367
integer :: moving_ibm !< 0 for no moving, 1 for moving, 2 for moving on forced path
358368
real(wp) :: v_blow !< Wall-normal surface blowing speed (burning/transpiring IB surface); 0 = impermeable
359369
integer :: inj_species !< Injected species index at a blowing surface (chemistry); 0 = mirror ambient

src/pre_process/m_global_parameters.fpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ contains
339339
patch_ib(i)%airfoil_id = 0
340340
patch_ib(i)%model_id = 0
341341
patch_ib(i)%slip = .false.
342+
343+
patch_ib(i)%thermal_bc = 0
344+
patch_ib(i)%Twall = 0._wp
345+
patch_ib(i)%surface_reaction = 0
346+
342347
patch_ib(i)%v_blow = 0._wp
343348
patch_ib(i)%inj_species = 0
344349
patch_ib(i)%burn_rate_exp = 0._wp

src/pre_process/m_mpi_proxy.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ contains
125125
call MPI_BCAST(patch_ib(i)%geometry, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
126126

127127
#:for VAR in [ 'x_centroid', 'y_centroid', 'z_centroid', &
128-
& 'length_x', 'length_y', 'length_z', 'radius', 'v_blow', &
128+
& 'length_x', 'length_y', 'length_z', 'radius', 'Twall', 'v_blow', &
129129
& 'burn_rate_exp', 'burn_rate_pref']
130130
call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
131131
#:endfor
132132
call MPI_BCAST(patch_ib(i)%airfoil_id, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
133133
call MPI_BCAST(patch_ib(i)%model_id, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
134134
call MPI_BCAST(patch_ib(i)%inj_species, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
135+
call MPI_BCAST(patch_ib(i)%thermal_bc, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
136+
call MPI_BCAST(patch_ib(i)%surface_reaction, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
135137
call MPI_BCAST(patch_ib(i)%slip, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
136138
end do
137139

src/simulation/m_checker.fpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ contains
3434
end if
3535
end if
3636

37-
if (ib .and. chemistry) then
37+
if (ib) then
3838
call s_check_inputs_ib_injection
3939
end if
4040

@@ -101,16 +101,36 @@ contains
101101

102102
end subroutine s_check_inputs_nvidia_uvm
103103

104-
!> Validates that each burning immersed-boundary patch injects a species index within the mechanism. inj_species indexes the
105-
!! image-point mass-fraction array Ys_IP(1:num_species) in m_ibm; an out-of-range value is an out-of-bounds write (silent
106-
!! corruption). Only reachable with chemistry.
104+
!> Validates immersed-boundary injection, thermal, and heterogeneous surface-reaction parameters.
107105
impure subroutine s_check_inputs_ib_injection
108106

109107
integer :: i
110108

111109
do i = 1, num_ibs
112-
@:PROHIBIT(patch_ib(i)%inj_species > num_species, &
113-
& "patch_ib inj_species must be <= num_species (it indexes the image-point species mass fractions; an out-of-range value writes out of bounds)")
110+
! Basic parameter ranges
111+
@:PROHIBIT(patch_ib(i)%inj_species < 0 .or. patch_ib(i)%inj_species > num_species, &
112+
& "patch_ib inj_species must be in [0,num_species]")
113+
@:PROHIBIT(patch_ib(i)%thermal_bc < 0 .or. patch_ib(i)%thermal_bc > 2, "patch_ib thermal_bc must be 0, 1, or 2")
114+
@:PROHIBIT(patch_ib(i)%surface_reaction < 0 .or. patch_ib(i)%surface_reaction > 1, &
115+
& "patch_ib surface_reaction must be 0 or 1")
116+
117+
! Thermal immersed-boundary condition
118+
! 0 = zero-normal-gradient temperature
119+
! 1 = prescribed wall temperature (Twall)
120+
! 2 = reacting surface energy balance
121+
if (patch_ib(i)%thermal_bc == 1) then
122+
@:PROHIBIT(patch_ib(i)%Twall <= 0._wp, "patch_ib Twall must be > 0 when thermal_bc = 1")
123+
end if
124+
125+
if (patch_ib(i)%thermal_bc == 2) then
126+
@:PROHIBIT(patch_ib(i)%surface_reaction /= 1, "patch_ib thermal_bc = 2 requires surface_reaction = 1")
127+
end if
128+
129+
! Heterogeneous surface reaction 0 = none 1 = enabled
130+
if (patch_ib(i)%surface_reaction == 1) then
131+
@:PROHIBIT(.not. chemistry, "patch_ib surface_reaction = 1 requires chemistry = T")
132+
@:PROHIBIT(patch_ib(i)%inj_species > 0, "patch_ib surface_reaction = 1 cannot be combined with inj_species > 0")
133+
end if
114134
end do
115135

116136
end subroutine s_check_inputs_ib_injection

src/simulation/m_global_parameters.fpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,11 @@ contains
660660
patch_ib(i)%airfoil_id = 0
661661
patch_ib(i)%model_id = 0
662662
patch_ib(i)%slip = .false.
663+
664+
patch_ib(i)%thermal_bc = 0
665+
patch_ib(i)%Twall = 0._wp
666+
patch_ib(i)%surface_reaction = 0
667+
663668
patch_ib(i)%v_blow = 0._wp
664669
patch_ib(i)%inj_species = 0
665670
patch_ib(i)%burn_rate_exp = 0._wp

0 commit comments

Comments
 (0)