Add more support to the Grackle interface#498
Open
hsinhaoHHuang wants to merge 16 commits intogamer-project:mainfrom
Open
Add more support to the Grackle interface#498hsinhaoHHuang wants to merge 16 commits intogamer-project:mainfrom
hsinhaoHHuang wants to merge 16 commits intogamer-project:mainfrom
Conversation
Contributor
Author
|
Update:
|
Conflicts: doc/wiki/Runtime-Parameters-related/[Runtime-Parameters]-All.md doc/wiki/Runtime-Parameters-related/[Runtime-Parameters]-Chemistry-and-Radiation.md
Conflicts: doc/wiki/Runtime-Parameters-related/[Runtime-Parameters]-All.md doc/wiki/Runtime-Parameters-related/[Runtime-Parameters]-Chemistry-and-Radiation.md example/test_problem/Template/Input__Parameter
Contributor
Author
|
Update:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_USE_TEMP_FLOOR: map to Grackle'suse_temperature_floorhere, and users can create their function and link it toGrackle_tempFloor_User_Ptrin their test problem whenGRACKLE_USE_TEMP_FLOOR == 2.GRACKLE_TEMP_FLOOR_SCALAR: map to Grackle'stemperature_floor_scalarhereGRACKLE_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
Add new Grackle interface function
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()Add a pre-floor of density in
Grackle_Prepare()such that the low-density gas will not change its fraction of species too much when the density hits the floortiny = 1.0e-20inside Grackle.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.
Test the temperature floor using
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. The images show the cooling rates.
GRACKLE_USE_TEMP_FLOOR = 0GRACKLE_USE_TEMP_FLOOR = 1andGRACKLE_TEMP_FLOOR_SCALAR= 1.0e5 KGRACKLE_USE_TEMP_FLOOR = 2and temperature_floor = 1.0e10 K only for "density > 1.0e-24 g/cm^3 and specific internal energy > 2.0e+12 cm^2/s^2"