-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the CDM halo construction in HaloMerger test problem #134
base: psidm
Are you sure you want to change the base?
Conversation
Since these two parts are small and both about the CDM halo construction, I implemented them in the same branch. Therefore, I have modified this PR and changed the title and description. |
|
||
|
||
################################################################################################################### | ||
# save to file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about printing a warning message if the file already exists?
@@ -99,7 +99,7 @@ def Soliton_fitting_analytical_dens(r, m22, r_c): | |||
|
|||
################################################################################################################### | |||
# save to file | |||
np.savetxt( 'HaloDensityProfile', | |||
np.savetxt( 'FitHaloDensityProfile', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about printing a warning message if the file already exists?
- The initial condition can be constructed as an equilibrium with external potential by reading the provided external potential table | ||
- The external potential table "ParCloud_ExtPotTable" can be generated by running the Python script "python3 Make_ParCloud_ExtPotTable.py", | ||
where the default is the potential of a uniform density sphere with 3x mass and 0.3x radius of the default CDM halo | ||
c. Enable compilation options: PARTICLE, SUPPORT_GSL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we do not edit Makefile
directly anymore, how about changing to add options in generage_make.sh
?
- Set the parameter OPT__FREEZE_FLUID to 1 in Input__Parameter for particle-only simulations | ||
- The default particle clouds use the FDMHaloDensityProfile (see Note 7. below) to represent the CDM halos | ||
- The initial condition can be constructed as an equilibrium with external potential by reading the provided external potential table | ||
- The external potential table "ParCloud_ExtPotTable" can be generated by running the Python script "python3 Make_ParCloud_ExtPotTable.py", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the script is for Python3 only, how about adding a version check in the script?
7. The default FDMHaloDensityProfile is extracted from the default HALO_IC | ||
a. Run the default ELBDM case to get Data_000000 | ||
b. Adjust the plot_script/plot__density_profile.py: set `r_sphere = (50.0, 'kpc')` and `nbin = 128` | ||
c. Run `python3 plot__density_profile.py -s 0 -e 0` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the script is for Python3 only, how about adding a version check in the script?
np.savetxt( 'ParCloud_ExtPotTable', | ||
np.column_stack( (ParCloud_ExtPot_table_radius, ParCloud_ExtPot_table_potential) ), | ||
fmt=' %9.8e', | ||
header=' r potential' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using this format?
np.savetxt( 'ParCloud_ExtPotTable', | |
np.column_stack( (ParCloud_ExtPot_table_radius, ParCloud_ExtPot_table_potential) ), | |
fmt=' %9.8e', | |
header=' r potential' ) | |
np.savetxt( 'ParCloud_ExtPotTable', | |
np.column_stack( (ParCloud_ExtPot_table_radius, ParCloud_ExtPot_table_potential) ), | |
fmt='%23.8e', | |
header='%21s %23s'%('r', 'potential') ) |
This can make it easier to maintain the text file.
[Part I.] Support adding the external potential for CDM halo construction
Why
The CDM halo is constructed using the
Par_EquilibriumIC
, which can construct the particle cloud with its velocity dispersion taking the external potential into account. Previously, in the HaloMerger test problem, this functionality was forced to be turned off internally because we didn't need it. However, in future applications (e.g., putting a particle cloud inside an FDM halo), we may need to construct the particle cloud in equilibrium with an external potential.Changes
HaloMerger_ParCloud_?_BuiltWithExtPot
inInput__TestProb_ParCloud
to decide whether to consider the external potential for constructing the particle cloud.HaloMerger_ParCloud_?_ExtPot_Filename
to provide the external potential table ifHaloMerger_ParCloud_?_BuiltWithExtPot
is on.Make_ParCloud_ExtPotTable.py
, to generate the example external potential table.Input__TestProb
).Verifications
Setups
python3 Make_ParCloud_ExtPotTable.py
OPT__EXT_POT = 1
inInput__Parameter
.Input__TestProb
Input__TestProb_ParCloud
Results
OPT__EXT_POT = 1
(left), and it will spread out ifOPT__EXT_POT = 0
(right).Issues
The current version of
Par_EquilibriumIC
has some limitations (e.g., the bins of the external potential table have to be the same as the density profile table) and potential bugs with the effect of external potential.[Part II.] Change the CDM halo density profile
Why
The CDM halo in the
HaloMerger
test problem is constructed from the given density profile.Previously, we used the formula
rho_0 * ( x**(-gamma) ) * ( ( 1.0+(x**alpha) )**( (gamma-beta)/alpha ) )
to fit the FDM halo without a soliton and construct the CDM halo.However, the density distribution of the CDM halo looks more extended than the FDM halo.
Although the differences are in the large-radius and small-density regions, it still makes the comparison of simulation results between CDM and FDM less straightforward.
Changes
Therefore, in this PR, we change the default CDM density profile to the density profile extracted from the FDM simulations.
In this way, the density distributions (especially at the large radius) look almost the same.
Density Projections
Density Profiles