Skip to content
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

Fix a bug with rescaling the soliton density profile in the HaloMerger test problem #137

Open
wants to merge 4 commits into
base: psidm
Choose a base branch
from

Conversation

hsinhaoHHuang
Copy link
Collaborator

Issues

There is an option HaloMerger_Soliton_*_DensProf_Rescale in the HaloMerger test problem to decide whether to rescale the input density profile.

However, the current rescaling only works for density profiles like the default SolitonDensityProfile_Lambda0.0 where 4*pi*G and m/hbar are 1.
It will be wrong to rescale the density profiles with other units like SolitonDensityProfile, which uses code units.

Changes

Now, by specifying the value 4*pi*G*(m/hbar)^2 used in the density profiles (or set to -1 if the units are the same as simulation code units), it can also rescale the density profile with units to a given core radius or core density correctly.

The rescaling of density profiles follows the soliton scaling relation: $$4\pi G(m/\hbar)^2 \rho_c r_c^4$$= a dimensionless constant.
In the updated test problem, it means (ScaleC)*(ScaleD)*(ScaleL^4) = 1

@hyschive hyschive added the psidm Wave dark matter label Oct 25, 2024
Copy link
Collaborator

@koarakawaii koarakawaii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hsinhaoHHuang : the PR seems good~ What do you think @vivi235711 ?

@@ -10,6 +10,7 @@ HaloMerger_Soliton_1_VelocityY 0.5
HaloMerger_Soliton_1_VelocityZ 0.0
HaloMerger_Soliton_1_DensProf_Filename SolitonDensityProfile_Lambda0.0 # filename of the density profile table for the 1st soliton (HaloMerger_Soliton_InitMode == 1 only)
HaloMerger_Soliton_1_DensProf_Rescale 1 # whether to scale the density profile table for the 1st soliton (HaloMerger_Soliton_InitMode == 1 only) [1]
HaloMerger_Soliton_1_DensProf_PhyConst 1.0 # value of the dimensional constant 4*pi*G*(ELBDM_MASS/hbar)^2 in the units of density profile (HaloMerger_Soliton_InitMode == 1 only) (<=0.0=same as simulation) [-1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "same as in simulation unit/code unit"~?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment on lines +699 to +701
// set the ratio of the physical constant between simulation and input table
HaloMerger_Soliton_DensProf_ScaleC[index_soliton] = (4.0*M_PI*NEWTON_G*SQR(ELBDM_ETA))/HaloMerger_Soliton_DensProf_PhyConst[index_soliton];

Copy link
Collaborator

@koarakawaii koarakawaii Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can add:
"The rescaling of density profiles follows the soliton scaling relation: $4\pi G (m_{22}/\hbar)^2 \rho_c r_c^4 = \rm{Const.} $
, i.e. (ScaleC)*(ScaleD)*(ScaleL^4) = 1"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@hsinhaoHHuang
Copy link
Collaborator Author

@koarakawaii Thanks a lot for your review. I have updated it.

@vivi235711
Copy link
Collaborator

Seems good. Just some minor comment about the "Input__TestProb_Soliton" file.
How about move the parameter "DensProf_Rescale" before the "CoreRadius"? This way one can more easily tell whether the solitons are scaled.

@hsinhaoHHuang
Copy link
Collaborator Author

@vivi235711 Thanks a lot for your review.

How about move the parameter "DensProf_Rescale" before the "CoreRadius"? This way one can more easily tell whether the solitons are scaled.

That is a good point. However, things are a bit complicated.

The parameters CoreRadius and CoreRho are not specific to DensProf_Rescale. They are also needed by HaloMerger_Soliton_InitMode == 2. In my current code, CoreRadius is one of the general and essential soliton properties. In this sense, I would prefer putting these parameters first. And those DensProf_* parameters dependent on the initialization mode are put later.

Also, I designed the DensProf_Rescale = 0 option for some special cases to construct a general spherically symmetric object (even not a soliton). This will seldom be used in my understanding. I even hope DensProf_Rescale can be hidden or ignored (default is 1) in this file in general unless the user has a special need. The reason why I provided this functionality here rather than in a separate parameters file is simply it shares a similar setup process as constructing a soliton. That's why I chose to only comment will be overwritten if HaloMerger_Soliton_1_DensProf_Rescale == 0 for CoreRadius while preserving the construction of a normal soliton as a main role in this file.

Maybe a better solution would be repurposing the file to construct a general spherically symmetric object, by analytical function or density profile table, and not calling it a soliton. Then, the current options like CoreRadius, the soliton analytical function, the soliton density profiles table, and the soliton rescaling would become under one of the models in this kind of object.

Let me think about this further.
Thank you again for your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
psidm Wave dark matter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants