gdtk-uq/gdtk

Using User-Defined Species in lmr and possible issue in Roe scheme implementation for Multispecies Flow

Closed this issue · 1 comments

Hi,

I had some questions about adding a new species and using it during run time. I followed the instructions in the README.rst and was able to add my new species to the species-database.lua after recompiling/running make.

I would like to proceed with a 1 step (A -> B) irreversible reaction with my species.inp:

model = "thermally perfect gas"
species = {'B1', 'B2'}

where B1 is a copy of air and B2 is the same but with modified properties.

I defined my reactions.inp file as:
Reaction{
'B1 + B1 => B2 + B2',
fr={'Arrhenius', A=4.27e13, n=0, C=19012.4},
label='r1'
}

In my job script, I initialize my inflow with species B1 such that as the flow proceeds, it should convert to the B2 if the reactions are turned on. Running a non-reacting case proceeds in the transient/SS solver, but eventually produces imaginary values:

FluidFVCell.decode_conserved(): Density invalid in conserved quantities.
universe-blk-id= 24 cell-id= 0
x= 0.0666196+0i y= 0.0262454+0i z= 0.05+0i
gas= GasState(rho=1.17641+0i, p=-nan+0i, T=200+0i, u=-nan+0i, p_e=100000+0i, a=-nan+0i, T_modes=[], u_modes=[], mu=1.79059e-05+0i, k=0.0261505+0i, k_modes=[], massf=[-nan+0i, -nan+0i], rho_s=[1.17641+0i, 0+0i], quality=1+0i, sigma=0+0i)
ftl= 1 (flow-time-level)
U[ftl]= [-nan+0i, -nan+0i, -nan+0i, -nan+0i, -nan+0i, -nan+0i]
U[0]= [3267.98+0i, -3.44558e-17+0i, -3.4385e-38+0i, 4.43488e+06+0i, 1.17641+0i, 0+0i]
interfaces:6
FluidFVCell.decode_conserved(): Density invalid in conserved quantities.
universe-blk-id= 25 cell-id= 0
x= 0.0567783+0i y= 0.0613322+0i z= 0.05+0i
gas= GasState(rho=1.17641+0i, p=-nan+0i, T=200+0i, u=-nan+0i, p_e=100000+0i, a=-nan+0i, T_modes=[], u_modes=[], mu=1.79059e-05+0i, k=0.0261505+0i, k_modes=[], massf=[-nan+0i, -nan+0i], rho_s=[1.17641+0i, 0+0i], quality=1+0i, sigma=0+0i)

Too many consecutive bad steps while trying to update flow state.

Number of bad steps = 2
Last attempted CFL = 5.000000e-02
Bailing out!
Too many consecutive bad steps while trying to update flow state.

Is there a preferred way to ensure the prevention of unphysical field variables and how you would go about troubleshooting this? The solver settings for reference are:

NewtonKrylovGlobalConfig{
number_of_steps_for_setting_reference_residuals = 0,
max_newton_steps = 4000,
stop_on_relative_residual = 1.0e-12,
number_of_phases = 1,
inviscid_cfl_only = true,
use_line_search = false,
use_physicality_check = true,
max_linear_solver_iterations = 80,
max_linear_solver_restarts = 0,
use_scaling = true,
frechet_derivative_perturbation = 1.0e-30,
use_preconditioner = true,
preconditioner_perturbation = 1.0e-30,
preconditioner = "ilu",
ilu_fill = 0,
total_snapshots = 6,
steps_between_snapshots = 100,
steps_between_diagnostics = 1
}

NewtonKrylovPhase:new{
residual_interpolation_order = 1,
jacobian_interpolation_order = 1,
frozen_preconditioner = true,
frozen_limiter_for_jacobian = false,
use_adaptive_preconditioner = false,
steps_between_preconditioner_update = 20,
linear_solve_tolerance = 0.001,
use_auto_cfl = true,
threshold_relative_residual_for_cfl_growth = 0.1,
start_cfl = 0.1,
max_cfl = 0.25,
auto_cfl_exponent = 0.6
}

I don't expect the reacting flow case too be much trouble as I have simply modified the enthalpy of formation of this modified air to be the heat release I would like to see when species B1 converts to B2.

Nevermind, I realized the choice of some options and the flux scheme I was using was causing some problems. Using trial and error, I was able to sort it out.

For whatever reason, the Roe scheme was the issue when using multi-species in lmr -- not sure if there's a current bug/issue in the existing implementation. When using for a single gas (ideal gas, air), it worked fine, but for multi species, thermally perfect gas, it immediately diverges. It has the entropy fix so it should be ok, otherwise, but please try to check this out if you can reproduce the issue/same issue I was getting with the Roe scheme.

In any case, switching back to ausmdv worked out fine for me.