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

Add ELBDM/UniformGranule test problem #135

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

Conversation

HsunYeong
Copy link

Add a test problem to simulate periodic box with homogeneous FDM granule initial condition.

Copy link
Collaborator

@vivi235711 vivi235711 left a comment

Choose a reason for hiding this comment

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

Hi, I left some comments here.

Copy link
Collaborator

@vivi235711 vivi235711 left a comment

Choose a reason for hiding this comment

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

Hi. I left some comment here.
Because I'm not familiar with the correlation function, could you please share the reference about how to calculate it? I confused why divided by std^2 or mean^2.

Copy link
Collaborator

@vivi235711 vivi235711 left a comment

Choose a reason for hiding this comment

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

I only have one minor comment.

@ChunYen-Chen
Copy link
Collaborator

ChunYen-Chen commented Jan 8, 2025

@HsunYeong
Could you update the download link of the uniform-granule.tar.gz according to gamer-project#390? I have uploaded uniform-granule.tar.gz to ythub. The link to uniform-granule.tar.gz is

https://hub.yt/api/v1/item/677cc1c3999605c485c8de80/download

An example of the download script:

#!/bin/bash

LOCAL_FILENAME="uniform-granule"
FILE_ID="677cc1c3999605c485c8de80"

# 1. download
curl https://hub.yt/api/v1/item/${FILE_ID}/download -o "${LOCAL_FILENAME}.tar.gz"

# 2. unzip
tar -zxvf ${LOCAL_FILENAME}.tar.gz
rm ${LOCAL_FILENAME}.tar.gz

See also gamer-project#408.

Copy link
Owner

@hyschive hyschive left a comment

Choose a reason for hiding this comment

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

@HsunYeong Thanks for the contribution! I've added some comments, mostly regarding wording and formatting.

The only major suggestion is to file a separate PR to add support for computing standard deviation in Aux_ComputeProfile.cpp.

Additionally, please merge the latest psidm branch.

Comment on lines +18 to +20
NX0_TOT_X 128 # number of base-level cells along x
NX0_TOT_Y 128 # number of base-level cells along y
NX0_TOT_Z 128 # number of base-level cells along z
Copy link
Owner

Choose a reason for hiding this comment

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

Increase to 256 to match the updated default value in psidm-uniform-granule-ic/input_parameter

Comment on lines +5 to +6
${PYTHON} configure.py --machine=eureka_intel --mpi=true --hdf5=true --fftw=FFTW3 --gpu=true \
--model=ELBDM --gravity=true --passive=1
Copy link
Owner

Choose a reason for hiding this comment

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

Please merge the latest psidm branch, which supports a default --machine.

Suggested change
${PYTHON} configure.py --machine=eureka_intel --mpi=true --hdf5=true --fftw=FFTW3 --gpu=true \
--model=ELBDM --gravity=true --passive=1
${PYTHON} configure.py --mpi=true --hdf5=true --fftw=FFTW3 --gpu=true \
--model=ELBDM --gravity=true --passive=1 "$@"

Comment on lines +33 to +37
UNIT_L 3.0856800e+21 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0]
UNIT_M -1.0 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0]
UNIT_T -1.0 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0]
UNIT_V 1.0000000e+05 # velocity unit (<=0 -> set to UNIT_L/UNIT_T) [-1.0]
UNIT_D 6.7698980e-22 # mass density unit (<=0 -> set to UNIT_M/UNIT_L^3) [-1.0]
Copy link
Owner

Choose a reason for hiding this comment

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

To align with the default setup in psidm-uniform-granule-ic/input_parameter

Suggested change
UNIT_L 3.0856800e+21 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0]
UNIT_M -1.0 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0]
UNIT_T -1.0 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0]
UNIT_V 1.0000000e+05 # velocity unit (<=0 -> set to UNIT_L/UNIT_T) [-1.0]
UNIT_D 6.7698980e-22 # mass density unit (<=0 -> set to UNIT_M/UNIT_L^3) [-1.0]
UNIT_L 3.0856800e+21 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0]
UNIT_M 1.9890000e+43 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0]
UNIT_T -1.0 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0]
UNIT_V 1.0000000e+05 # velocity unit (<=0 -> set to UNIT_L/UNIT_T) [-1.0]
UNIT_D -1.0 # mass density unit (<=0 -> set to UNIT_M/UNIT_L^3) [-1.0]

Copy link
Owner

Choose a reason for hiding this comment

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

Support MPI parallelization by adding something like the following lines. Please refer to Plummer/plot_script/plot_gas.py.

yt.enable_parallelism()
ts = yt.DatasetSeries( [ prefix+'/Data_%06d'%idx for idx in range(idx_start, idx_end+1, didx) ] )
for ds in ts.piter():

NX0_TOT_Y 128 # number of base-level cells along y
NX0_TOT_Z 128 # number of base-level cells along z
OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY##
END_T 1.00e0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0]
Copy link
Owner

Choose a reason for hiding this comment

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

This is a bit too long for the default initial condition with a wavelength of 0.00669212 and a velocity of 6, corresponding to a characteristic timescale of roughly 0.00669212/6 ~ 1e-3. I suggest END_T=2.0e-3 and OUTPUT_DT=4.0e-5.


if ( MPI_Rank == 0 ) Aux_Message( stdout, "InitialTime = %13.6e \n", InitialTime );

// compute the enter position for passive field
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
// compute the enter position for passive field
// determine the central position for computing correlation function

if ( MPI_Rank == 0 ) Aux_Message( stdout, "InitialTime = %13.6e \n", InitialTime );

// compute the enter position for passive field
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate halo center for passive field:\n");
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate halo center for passive field:\n");
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate the initial center-of-mass position:\n");

}
Aux_FindWeightedAverageCenter( Center, CoM_ref, COM_MAX_R, COM_MIN_RHO, _TOTAL_DENS, COM_TOLERR_R, COM_MAX_ITER, &FinaldR, &FinalNIter );

if ( MPI_Rank == 0 ) Aux_Message( stdout, "Center of passive field is ( %14.11e,%14.11e,%14.11e )\n", Center[0], Center[1], Center[2] );
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Center of passive field is ( %14.11e,%14.11e,%14.11e )\n", Center[0], Center[1], Center[2] );
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Initial center-of-mass position is ( %14.11e,%14.11e,%14.11e )\n", Center[0], Center[1], Center[2] );

if ( MPI_Rank == 0 ) Aux_Message( stdout, "Center of passive field is ( %14.11e,%14.11e,%14.11e )\n", Center[0], Center[1], Center[2] );

// commpute density profile for passive field
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate density profile for passive field:\n");
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate density profile for passive field:\n");
if ( MPI_Rank == 0 ) Aux_Message( stdout, "Calculate initial density profile:\n");

}
if ( OPT__BC_POT != BC_POT_PERIODIC )
Aux_Error( ERROR_INFO, "must set periodic BC for gravity --> reset OPT__BC_POT to 1 !!\n" );

Copy link
Owner

Choose a reason for hiding this comment

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

Add a sanity check on OPT__RECORD_USER when enabling ComputeCorrelation.

OPT__RECORD_PERFORMANCE 1 # record the code performance [1]
OPT__MANUAL_CONTROL 1 # support manually dump data, stop run, or pause run during the runtime
# (by generating the file DUMP_GAMER_DUMP, STOP_GAMER_STOP, PAUSE_GAMER_PAUSE, respectively) [1]
OPT__RECORD_CENTER 1 # record the position of maximum density, minimum potential, and center of mass [0]
Copy link
Owner

Choose a reason for hiding this comment

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

Why enable this? Note that it's executed after Init_User_Ptr

Copy link
Owner

Choose a reason for hiding this comment

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

How about mentioning that one must turn on OPT__RECORD_USER and set COM_* properly for ComputeCorrelation?

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