Add more support to the Grackle interface #498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goals
Changes
User-end
Add new runtime options to store the derived fields calculated by Grackle in the snapshots.
OPT__OUTPUT_GRACKLE_TEMP: output the temperature calculated by GrackleOPT__OUTPUT_GRACKLE_MU: output the mean molecular weight calculated by GrackleOPT__OUTPUT_GRACKLE_TCOOL: output the cooling time calculated by GrackleAdd more options mapping to Grackle's parameters
GRACKLE_USE_V_HEATING_RATE: map to Grackle’suse_volumetric_heating_ratehere, and users can create their function and link it toGrackle_vHeatingRate_User_Ptrin their test problem.GRACKLE_USE_S_HEATING_RATE: map to Grackle’suse_specific_heating_ratehere, and users can create their function and link it toGrackle_sHeatingRate_User_Ptrin their test problem.GRACKLE_HYDROGEN_MFRAC: map to Grackle'sHydrogenFractionByMasshere.Add a new testing-purposes option to allow Grackle to evolve while the fluid is frozen.
OPT__UNFREEZE_GRACKLE: work withOPT__FREEZE_FLUIDAdd a new grid refinement option to flag when the cooling length is not resolved.
OPT__FLAG_COOLING_LEN: the refinement criteria of "cooling length/cell size" is set inInput__Flag_CoolingLenAdd a new time-step criterion from Grackle's cooling time.
DT__GRACKLE_COOLING: the time-step is restricted by a factor of the minimum of cooling timeAdd a new test problem to test the Grackle-related functionality and see the Grackle's temperature and chemical species evolution in a controlled setup.
Hydro/GrackleTestUpdate the Grackle-related parameters in the wiki.
Internally
Grackle_Calculate().Grackle_Prepare()to prepare the input arrays, so it can set up Grackle’s parameters consistently asCPU_GrackleSolver().calculate_temperature()calculate_gamma()calculate_cooling_time()Validation
DefaultTestMode = 1in the new test problemGrackleTestThe x-axis corresponds to a range of density from 1.0e-29 g/cm^3 to 1.0e-21 g/cm^3, while the y-axis corresponds to a range of T/mu from 1.0 K to 1.0e8 K. We can check the Grackle-calculated derived fields of different phases at once.
DefaultTestMode = 2in the new test problemGrackleTestA uniform gas of density 1.0e-24 g/cm^3 and T/mu 1.0e4 K.
dt = 1.40e-02 = 1/17.85 * 0.25DefaultTestMode = 3in the new test problemGrackleTestA uniform gas of density 1.0e-24 g/cm^3 and T/mu 1.0e4 K initially, with user-provided heating and cooling as a function of spatial coordinates through
GRACKLE_USE_V_HEATING_RATE.The given central heating rate is
1.0e-24 erg cm^-3 s^-1 n_H^-1and central cooling rate is1.6e-20 erg cm^-3 s^-1 n_H^-2The criteria are set as 8 cells per cooling length.
The evolution can match the analytical expectation.