You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This one is a major bug and causes OOB errors when using the eilmer gas model. In MFP_hydro.cpp:1300-1318, the vectors alphas_lo and alphas_hi are used with tracer_idx=0. For our own ThermallyPerfectGas model, this works fine, since ThermallyPerfectGas::get_x_from_prim uses tracer_idx to correctly access the "primitives" vector to extract the alpha values. EilmerGasModel::get_x_from_prim calls EilmerGasModel::set_eilmer_gas_state_from_prim, which assumes that the primitives vector contains the state in the same order as HydroDef::PrimIdx, with alphas at their "correct" location.
The fix itself is not too difficult, but it raised a few questions for me. In order for the next few things to make sense, it's best to follow the get_gamma_from_prim function into EilmerGasModel and all the way through to MFP::wrap_gas.cpp which contains the ffi stuff to communicate with eilmer.
Currently, gamma_hi and gamma_lo are used to calculate P_lo and P_hi in the reconstruction. I don't think this is consistent with the way it's expected to be done in eilmer, especially since the set_eilmer_gas_state_from_prim function uses gas_model_gas_state_update_thermo_from_rhop. If we only pass in updated alphas and run an update, won't it be using a random old value for rho and p? Perhaps for the reconstruction step, this function should actually be ...update_thermo_from_rhou and we should be passing through rho_lo, eps_lo (internal energy) and alphas_lo?
The temperature calculation in the reconstruction makes a calorically perfect gas assumption. For molecular species, the temperature that we calculate and store is different to the temperature that is output by eilmer since it uses a Newton solver to calculate a temperature consistent with the specific heats and two state variables. Maybe we should rely on the gas model classes (eilmer or our own) to provide the EOS? Eg, calc_reconstruction calculates rho_lo, eps_lo and alphas_lo using the cell slopes and then calls a method in the gas class to get the corresponding T, P, Cp and gamma. This way the reconstructed primitives will be consistent with whatever gas model is being used for that species.
As noted in previous discussions, we have to be careful about how we handle cases like the following:
3a. Dissociation of N2 into N using eilmer
3b. Electron impact ionisation of the same N into N+ using our multi-fluid rates
I have tried an implementation of the stuff discussed in (1) and (2), but eilmer is not able to converge on temperature, so clearly I'm missing something still. I think the gas_kinetics source term does some of this too.
The microphysics routines for the EOS in Castro are probably worth looking at for an example of how others have implemented multiple gas models in their simulations. I'm not sure if they handle interactions between different gas models though. They also augment their equations with the internal energy equation, stating improved numerics at high mach numbers and with source terms that might change the internal energy.
The text was updated successfully, but these errors were encountered:
This one is a major bug and causes OOB errors when using the eilmer gas model. In
MFP_hydro.cpp:1300-1318
, the vectorsalphas_lo
andalphas_hi
are used withtracer_idx=0
. For our ownThermallyPerfectGas
model, this works fine, sinceThermallyPerfectGas::get_x_from_prim
usestracer_idx
to correctly access the "primitives" vector to extract thealpha
values.EilmerGasModel::get_x_from_prim
callsEilmerGasModel::set_eilmer_gas_state_from_prim
, which assumes that the primitives vector contains the state in the same order asHydroDef::PrimIdx
, with alphas at their "correct" location.The fix itself is not too difficult, but it raised a few questions for me. In order for the next few things to make sense, it's best to follow the
get_gamma_from_prim
function intoEilmerGasModel
and all the way through toMFP::wrap_gas.cpp
which contains the ffi stuff to communicate with eilmer.gamma_hi
andgamma_lo
are used to calculateP_lo
andP_hi
in the reconstruction. I don't think this is consistent with the way it's expected to be done in eilmer, especially since theset_eilmer_gas_state_from_prim
function usesgas_model_gas_state_update_thermo_from_rhop
. If we only pass in updated alphas and run an update, won't it be using a random old value forrho
andp
? Perhaps for the reconstruction step, this function should actually be...update_thermo_from_rhou
and we should be passing throughrho_lo
,eps_lo
(internal energy) andalphas_lo
?calc_reconstruction
calculatesrho_lo
,eps_lo
andalphas_lo
using the cell slopes and then calls a method in the gas class to get the correspondingT
,P
,Cp
andgamma
. This way the reconstructed primitives will be consistent with whatever gas model is being used for that species.3a. Dissociation of N2 into N using eilmer
3b. Electron impact ionisation of the same N into N+ using our multi-fluid rates
I have tried an implementation of the stuff discussed in (1) and (2), but eilmer is not able to converge on temperature, so clearly I'm missing something still. I think the
gas_kinetics
source term does some of this too.The microphysics routines for the EOS in Castro are probably worth looking at for an example of how others have implemented multiple gas models in their simulations. I'm not sure if they handle interactions between different gas models though. They also augment their equations with the internal energy equation, stating improved numerics at high mach numbers and with source terms that might change the internal energy.
The text was updated successfully, but these errors were encountered: