-
Notifications
You must be signed in to change notification settings - Fork 5
Description
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_hiandgamma_loare used to calculateP_loandP_hiin 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_primfunction 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 forrhoandp? Perhaps for the reconstruction step, this function should actually be...update_thermo_from_rhouand we should be passing throughrho_lo,eps_lo(internal energy) andalphas_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_reconstructioncalculatesrho_lo,eps_loandalphas_lousing the cell slopes and then calls a method in the gas class to get the correspondingT,P,Cpandgamma. 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.