diff --git a/doc/wiki/Runtime-Parameters-related/Runtime-Parameters:-All.md b/doc/wiki/Runtime-Parameters-related/Runtime-Parameters:-All.md index 9129bf3665..de69143303 100644 --- a/doc/wiki/Runtime-Parameters-related/Runtime-Parameters:-All.md +++ b/doc/wiki/Runtime-Parameters-related/Runtime-Parameters:-All.md @@ -398,6 +398,10 @@ For variables with `Default/Min/Max` labeled as `Depend`, click the parameter na | SPEC_INT_VORTEX_THRESHOLD | 0.1 | 0.0 | None | vortex detection threshold for SPEC_INT_XY_INSTEAD_DEPHA [0.1] ##ELBDM & SUPPORT_SPECTRAL_INT ONLY## | | SPEC_INT_XY_INSTEAD_DEPHA | 1 | None | None | interpolate x and y (real and imaginary parts in current implementation) around vortices instead of density and phase for the spectral interpolation, which has the advantage of being well-defined across vortices [1] ##ELBDM & SUPPORT_SPECTRAL_INT ONLY## | | SRC_DELEPTONIZATION | 0 | None | None | deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## | +| SRC_EC_DTCOEF | 0.5 | 2.22507386e-308 | None | the coefficient of the cooling time step [0.5] | +| SRC_EC_SUBCYCLING | 0 | None | None | perform subcycling when the cooling time step is small (0=off, 1=on) [0] | +| SRC_EC_TEF_N | 1501 | 1 | None | number of points for lambda(T) sampling in LOG [1501] | +| SRC_EXACTCOOLING | 0 | None | None | exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## | | SRC_GPU_NPGROUP | -1 | None | None | number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] | | SRC_USER | 0 | None | None | user-defined source terms -> edit "Src_User.cpp" [0] | diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__TestProb new file mode 100644 index 0000000000..4d549ff0cd --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case1/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 600.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C1.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C1.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7500.0 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -600.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__TestProb new file mode 100644 index 0000000000..89bbca07b7 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case2/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 600.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C1.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C1.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7964.43 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -600.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__TestProb new file mode 100644 index 0000000000..cf9b801297 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case3/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 600.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C1.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C1.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 8432.28 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -600.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__TestProb new file mode 100644 index 0000000000..7f24a0a748 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case4/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 300.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C2.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C2.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7500.0 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -900.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 1.54692010347e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__TestProb new file mode 100644 index 0000000000..69e9a6a31c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case5/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 300.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C2.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C2.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7964.43 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -900.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 1.54692010347e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__TestProb new file mode 100644 index 0000000000..1a7a8b2b21 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 300.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C2.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C2.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 8432.28 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -900.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 1.54692010347e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_NParPatch new file mode 100644 index 0000000000..ed49817305 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 3000 + 1 3000 + 2 3000 + 3 3000 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_User b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_User new file mode 100644 index 0000000000..1b9656239b --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Flag_User @@ -0,0 +1,22 @@ +# Level User-defined Criteria + 0 4.0 + 1 4.0 + 2 4.0 + 3 4.0 + 4 4.0 + 5 4.0 + 6 4.0 + 7 4.0 + 8 4.0 + 9 4.0 + 10 4.0 + 11 4.0 + 12 4.0 + 13 4.0 + 14 4.0 + 15 4.0 + 16 4.0 + 17 4.0 + 18 4.0 + 19 4.0 + 20 4.0 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Parameter new file mode 100644 index 0000000000..f25e8a7398 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 8 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__TestProb new file mode 100644 index 0000000000..7e12f174fb --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case6_highRes/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1_highRes.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1_highRes.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 300.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C2_highRes.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C2_highRes.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 8432.28 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -900.0 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 1.54692010347e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this exa mple) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__TestProb new file mode 100644 index 0000000000..f21b8add43 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case7/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 109.090909091 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C3.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C3.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7500.0 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -1090.90909091 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 3.07247016901e9 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__TestProb new file mode 100644 index 0000000000..dbe1eb2379 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case8/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 109.090909091 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C3.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C3.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7964.43 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -1090.90909091 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 3.07247016901e9 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_Lohner new file mode 100644 index 0000000000..af5a1e199c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_Lohner @@ -0,0 +1,13 @@ +# Level Threshold_Refine Threshold_Derefine Filter Soften MinDensity + 0 0.80 0.80 0.01 0.00 1.50e-2 + 1 0.80 0.80 0.01 0.00 1.50e-2 + 2 0.80 0.80 0.01 0.00 1.50e-2 + 3 0.80 0.80 0.01 0.00 1.50e-2 + 4 8000 8000 10 0.00 1.50e-2 + 5 8000 8000 10 0.00 1.50e-2 + 6 8000 8000 10 0.00 1.50e-2 + 7 8000 8000 10 0.00 1.50e-2 + 8 8000 8000 10 0.00 1.50e-2 + 9 8000 8000 10 0.00 1.50e-2 + 10 8000 8000 10 0.00 1.50e-2 + 11 8000 8000 10 0.00 1.50e-2 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_NParPatch new file mode 100644 index 0000000000..375fc991fa --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Flag_NParPatch @@ -0,0 +1,13 @@ +# Level Number of Particles per Patch + 0 600 + 1 600 + 2 600 + 3 600 + 4 6000000 + 5 6000000 + 6 6000000 + 7 6000000 + 8 6000000 + 9 6000000 + 10 6000000 + 11 6000000 diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Parameter new file mode 100644 index 0000000000..d1508eaaf9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__Parameter @@ -0,0 +1,265 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 15.0 # box size along the longest side (in Mpc/h if COMOVING is adopted) +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 +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + +# test problems +TESTPROB_ID 4 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger (+GRAVITY) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 3.08567758149e24 # length unit (<=0 -> set to UNIT_V*UNIT_T or (UNIT_M/UNIT_D)^(1/3)) [-1.0] +UNIT_M 1.9885e47 # mass unit (<=0 -> set to UNIT_D*UNIT_L^3) [-1.0] +UNIT_T 3.15569252e17 # time unit (<=0 -> set to UNIT_L/UNIT_V) [-1.0] +UNIT_V -1.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 5 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=use5, 5=diode) +OPT__BC_FLU_XP 5 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YM 5 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_YP 5 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZM 5 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_FLU_ZP 5 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) +OPT__BC_POT 2 # gravity boundary condition: (1=periodic, 2=isolated) + + +# particle (PARTICLE only) +PAR_NPAR -1 # total number of particles (must be set for PAR_INIT == 1/3) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_INTERP 2 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +PAR_TR_VEL_CORR 1 # correct tracer particle velocities in regions of discontinuous flow [0] + + +# time-step +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY 0.2 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV 2 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 7 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_DENS 1 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 1 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 1 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 1 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 2 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 2.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve load balance, especially with particles [0] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] +MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 2 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER 4 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central, 7=Athena) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (<0=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__RESET_FLUID 1 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 1e-16 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1e-16 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1e-16 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +POT_GPU_NPGROUP -1 # number of patch groups sent into the GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 3 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] +OPT__INIT_BFIELD_BYVECPOT 1 # initialize the magnetic field from vector potential + # (0=off, 1=external disk file named "B_IC", see tool/inits/gen_vec_pot.py for example, 2=function) [0] ##MHD ONLY## + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 0 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag, 8=entire box) [0] +OPT__OUTPUT_USER 0 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 1 # output gravitational potential [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_LORENTZ 0 # output Lorentz factor [0] ##SRHD ONLY## +OPT__OUTPUT_3VELOCITY 0 # output 3-velocities [0] ##SRHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 1.0e-2 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] +OUTPUT_DIR . # set the output directory [.] + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 1 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated ##HYDRO and ELBDM ONLY## [0] +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 1 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 1 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__LAST_RESORT_FLOOR 1 # Apply floor values when both OPT__1ST_FLUX_CORR and AUTO_REDUCE_DT fail. diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__TestProb new file mode 100644 index 0000000000..d627f6cfed --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/case9/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile_CCD_C1.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_CCD_C1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 5740.67470419 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 109.090909091 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.11601760524e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile_CCD_C3.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_CCD_C3.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9259.32529581 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 8432.28 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -1090.90909091 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 3.07247016901e9 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 0.70 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 0.35 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 1 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.01 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 3 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 1 # (true/false) --> Adjust the BH velocity +AdjustPeriod 0.001 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input__Flag_Lohner b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Flag_Lohner similarity index 100% rename from example/test_problem/Hydro/ClusterMerger/Input__Flag_Lohner rename to example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Flag_Lohner diff --git a/example/test_problem/Hydro/ClusterMerger/Input__Flag_NParPatch b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Flag_NParPatch similarity index 100% rename from example/test_problem/Hydro/ClusterMerger/Input__Flag_NParPatch rename to example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Flag_NParPatch diff --git a/example/test_problem/Hydro/ClusterMerger/Input__Parameter b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Parameter similarity index 92% rename from example/test_problem/Hydro/ClusterMerger/Input__Parameter rename to example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Parameter index b035e42052..7f622c7f5b 100644 --- a/example/test_problem/Hydro/ClusterMerger/Input__Parameter +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__Parameter @@ -124,9 +124,20 @@ OPT__MINIMIZE_MPI_BARRIER 0 # minimize MPI barriers to improve loa # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 0 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## -> NOT supported yet! +SRC_EC_TEF_N 6001 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small (0=off, 1=on) [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + # fluid solver in HYDRO (MODEL==HYDRO only) GAMMA 1.666666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] MOLECULAR_WEIGHT 0.59242761692650336 # mean molecular weight -> currently only for post-processing [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt MINMOD_COEFF 2.0 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] MINMOD_MAX_ITER 0 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] OPT__LR_LIMITER 1 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: @@ -146,10 +157,13 @@ OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging th OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] -MIN_DENS 1.0e-07 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## -MIN_PRES 1.0e-09 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## -MIN_EINT 1.0e-09 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## -MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +OPT__RESET_FLUID 0 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT 0 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +MIN_DENS 0.0 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 0.0 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 0.0 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e4 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## # gravity solvers in all models @@ -231,6 +245,7 @@ OPT__MANUAL_CONTROL 1 # support manually dump data or stop r # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] +OPT__SORT_PATCH_BY_LBIDX 1 # sort patches to improve bitwise reproducibility [SERIAL:0, LOAD_BALACNE:1] # checks diff --git a/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__TestProb new file mode 100644 index 0000000000..a7b44d2871 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input_Options/default/Input__TestProb @@ -0,0 +1,61 @@ +# problem-specific runtime parameters +Merger_Coll_NumHalos 2 # number of halos + +# parameters for cluster 1 +Merger_File_Prof1 profile1_gamer.h5 # profile table of cluster 1 +Merger_File_Par1 1to3_b0.0_gamerp_1.h5 # particle file of cluster 1 +Merger_Coll_PosX1 6000.0 # X-center of cluster 1 in kpc +Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc +Merger_Coll_VelX1 375.0 # X-velocity of cluster 1 in km/s +Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s +Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only +Bondi_MassBH1 7.1e10 # black hole mass (in Msun) +Jet_HalfHeight1 2.0 # jet 1: half height of the cylinder-shape jet source (in kpc) +Jet_Radius1 2.5 # jet 1: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 2 +Merger_File_Prof2 profile2_gamer.h5 # profile table of cluster 2 +Merger_File_Par2 1to3_b0.0_gamerp_2.h5 # particle file of cluster 2 +Merger_Coll_PosX2 9000.0 # X-center of cluster 2 in kpc +Merger_Coll_PosY2 7500.0 # Y-center of cluster 2 in kpc +Merger_Coll_VelX2 -1125.0000000000002 # X-velocity of cluster 2 in km/s +Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s +Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only +Bondi_MassBH2 1.5e10 # black hole mass (in Msun) +Jet_HalfHeight2 2.0 # jet 2: half height of the cylinder-shape jet source (in kpc) +Jet_Radius2 2.5 # jet 2: radius of the cylinder-shape jet source (in kpc) + +# parameters for cluster 3 (disabled for this example) +Merger_File_Prof3 none # profile table of cluster 3 +Merger_File_Par3 none # particle file of cluster 3 +Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc +Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc +Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s +Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s +Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only +Bondi_MassBH3 3.4e8 # black hole mass (in Msun) +Jet_HalfHeight3 2.0 # jet 3: half height of the cylinder-shape jet source (in kpc) +Jet_Radius3 2.5 # jet 3: radius of the cylinder-shape jet source (in kpc) + +# parameters of AGN jet feedback +AGN_feedback 0 # turn on/off (1/0) AGN feedback +Accretion_Mode 3 # 1: hot mode; 2: cold mode; 3: combine (hot + cold) +eta 1.0 # mass loading factor in jet feedback +eps_f 0.11 # the radiative efficiency in jet feedback +eps_m 0.0 # the fraction of total energy that goes into the thermal + # energy in jet feedback +R_acc 4.0 # accretion radius: compute the accretion rate (in kpc) +R_dep 4.0 # radius to deplete the accreted gas (in kpc) +JetDirection_case 1 # Methods for choosing the jet direction: + # 1: Fixed at x-axis + # 2: Import from table (generate JetDirection_file) + # 3: Align with angular momentum +JetDirection_file JetDirection.txt # File containing the jet direction as a function of time + +# other parameters +Merger_Coll_UseMetals 0 # look for a metal field in the profile files [1] +Merger_Coll_LabelCenter 1 # label the particle closest to the center of each cluster [1] +AdjustBHPos 1 # (true/false) --> Adjust the BH position +AdjustBHVel 0 # (true/false) --> Adjust the BH velocity +AdjustPeriod 10.0 # the time interval of adjustment (in Myr) +fixBH 0 # fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) diff --git a/example/test_problem/Hydro/ClusterMerger/Input__Flag_User b/example/test_problem/Hydro/ClusterMerger/Input__Flag_User new file mode 100644 index 0000000000..3c83f3cc4d --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/Input__Flag_User @@ -0,0 +1,22 @@ +# Level User-defined Criteria + 0 6.0 + 1 6.0 + 2 6.0 + 3 6.0 + 4 6.0 + 5 6.0 + 6 6.0 + 7 6.0 + 8 6.0 + 9 6.0 + 10 6.0 + 11 6.0 + 12 6.0 + 13 6.0 + 14 6.0 + 15 6.0 + 16 6.0 + 17 6.0 + 18 6.0 + 19 6.0 + 20 6.0 diff --git a/example/test_problem/Hydro/ClusterMerger/Input__TestProb b/example/test_problem/Hydro/ClusterMerger/Input__TestProb deleted file mode 100644 index 055fae81c8..0000000000 --- a/example/test_problem/Hydro/ClusterMerger/Input__TestProb +++ /dev/null @@ -1,32 +0,0 @@ -# problem-specific runtime parameters -Merger_Coll_NumHalos 2 # number of halos - -# parameters for cluster 1 -Merger_File_Prof1 profile1_gamer.h5 # profile table of cluster 1 -Merger_File_Par1 1to3_b0.0_gamerp_1.h5 # particle file of cluster 1 -Merger_Coll_PosX1 6000.0 # X-center of cluster 1 in kpc -Merger_Coll_PosY1 7500.0 # Y-center of cluster 1 in kpc -Merger_Coll_VelX1 375.0 # X-velocity of cluster 1 in km/s -Merger_Coll_VelY1 0.0 # Y-velocity of cluster 1 in km/s -Merger_Coll_IsGas1 1 # If cluster 1 should have gas and not have DM only - -# parameters for cluster 2 -Merger_File_Prof2 profile2_gamer.h5 # profile table of cluster 2 -Merger_File_Par2 1to3_b0.0_gamerp_2.h5 # particle file of cluster 2 -Merger_Coll_PosX2 9000.0 # X-center of cluster 2 in kpc -Merger_Coll_PosY2 7500.0 # Y-center of cluster 2 in kpc -Merger_Coll_VelX2 -1125.0000000000002 # X-velocity of cluster 2 in km/s -Merger_Coll_VelY2 0.0 # Y-velocity of cluster 2 in km/s -Merger_Coll_IsGas2 1 # If cluster 2 should have gas and not have DM only - -# parameters for cluster 3 (disabled for this example) -Merger_File_Prof3 none # profile table of cluster 3 -Merger_File_Par3 none # particle file of cluster 3 -Merger_Coll_PosX3 0 # X-center of cluster 3 in kpc -Merger_Coll_PosY3 0.0 # Y-center of cluster 3 in kpc -Merger_Coll_VelX3 0.0 # X-velocity of cluster 3 in km/s -Merger_Coll_VelY3 0.0 # Y-velocity of cluster 3 in km/s -Merger_Coll_IsGas3 0 # If cluster 3 should have gas and not have DM only - -# other parameters -Merger_Coll_UseMetals 0 # look for a metal field in the profile files diff --git a/example/test_problem/Hydro/ClusterMerger/README b/example/test_problem/Hydro/ClusterMerger/README index 0fb22ba850..4772fe6afd 100644 --- a/example/test_problem/Hydro/ClusterMerger/README +++ b/example/test_problem/Hydro/ClusterMerger/README @@ -24,6 +24,23 @@ Default setup: 2. Default resolution ~ 15 kpc (MAX_LEVEL = 3) +AGN feedback: +======================================== +1. Enable OPT__RESET_FLUID in Input__Parameter and "AGN_feedback" in Input__TestProb. +2. To refine regions around the SMBHs, enable OPT__FLAG_USER and set MAX_LEVEL accordingly. + + +Cool-core destruction: +======================================== +Reproduce the cool-core destruction results. Shuang-Shuang Chen (arXiv:2412.13595) +0. Please contact Prof. Hsi-Yu Schive regarding the unreleased exact cooling feature. +1. `sh download_ic_cool_core_destruction.sh` +2. `sh setup_input_files.sh ` + --> For the high resolution case, please link or copy the input files from + `Input_Options/case6_highRes`. Note that `Input__Flag_User` is different from + the default case. + + Note: ======================================== 1. Mimic the merging cluster simulation setup of Flash provided by John ZuHone @@ -40,8 +57,9 @@ Note: (3) [Optional] Update SciPy to version >= 1.13.0 (4) python -m pip install . (5) Go back to the gamer_cluster_ics.py script and run with "python gamer_cluster_ics.py" -4. No need to set PAR_NPAR in Input__Parameter since it will be reset automatically. -5. Some handy yt analysis scripts and a notebook are put in "yt_script" +4. Run the script `setup_input_files.sh` to link the input files +5. No need to set PAR_NPAR in Input__Parameter since it will be reset automatically. +6. Some handy yt analysis scripts and a notebook are put in "yt_script" --> For example, to generate the slice plots, one can (1) cd yt_script (2) Edit "idx_start" and "idx_end" in plot_slice-z.py diff --git a/example/test_problem/Hydro/ClusterMerger/clean.sh b/example/test_problem/Hydro/ClusterMerger/clean.sh index 2c7ccfacf7..7505f26902 100644 --- a/example/test_problem/Hydro/ClusterMerger/clean.sh +++ b/example/test_problem/Hydro/ClusterMerger/clean.sh @@ -2,4 +2,5 @@ rm -f Record__Note Record__Timing Record__TimeStep Record__PatchCount Record__Du Record__Conservation Data* stderr stdout log XYslice* YZslice* XZslice* Xline* Yline* Zline* \ Diag* Box* BaseXYslice* BaseYZslice* BaseXZslice* BaseXline* BaseYline* BaseZline* BaseDiag* \ PowerSpec_* Particle_* nohup.out Record__Performance Record__TimingMPI_* \ - Record__ParticleCount Record__User Patch_* Record__NCorrUnphy FailedPatchGroup* *.pyc Record__LoadBalance + Record__ParticleCount Record__User Patch_* Record__NCorrUnphy FailedPatchGroup* *.pyc Record__LoadBalance \ + Record__ClusterCenter diff --git a/example/test_problem/Hydro/ClusterMerger/download_ic_cool_core_destruction.sh b/example/test_problem/Hydro/ClusterMerger/download_ic_cool_core_destruction.sh new file mode 100644 index 0000000000..e1af664860 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/download_ic_cool_core_destruction.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +LOCAL_FILENAME="gamer_ic_cool_core_destruction.tgz" +FILE_ID="693f97b2467de92389bb7d15" +FILE_SHA256="138d5a6f594f4f3051b1c75f5f2837b4fe272790794766d80770653d58c33d45" + +# 1. download +curl -L https://hub.yt/api/v1/item/${FILE_ID}/download -o "${LOCAL_FILENAME}" + +# 2. compare sha256sum +! [ `sha256sum ${LOCAL_FILENAME} | awk '{print $1}'` = "${FILE_SHA256}" ] && echo "File broken: ${LOCAL_FILENAME}" + +# 3. unzip +tar -zxvf ${LOCAL_FILENAME} +rm ${LOCAL_FILENAME} diff --git a/example/test_problem/Hydro/ClusterMerger/generate_make.sh b/example/test_problem/Hydro/ClusterMerger/generate_make.sh index 8b00177e62..ee1ce0981c 100644 --- a/example/test_problem/Hydro/ClusterMerger/generate_make.sh +++ b/example/test_problem/Hydro/ClusterMerger/generate_make.sh @@ -4,3 +4,23 @@ PYTHON=python3 ${PYTHON} configure.py --mpi=true --hdf5=true --fftw=FFTW3 --gpu=true \ --model=HYDRO --particle=true --gravity=true --passive=2 --par_attribute_int=1 "$@" + + +# cool-core descruction +# two clusters +# ${PYTHON} configure.py --model=HYDRO --flu_scheme=MHM --flux=HLLC --passive=1 \ +# --particle=true --store_par_acc=true --par_attribute_int=1 \ +# --gravity=true --unsplit_gravity=true --fftw=FFTW3 \ +# --mpi=true --gpu=true \ +# --hdf5=true --gsl=true \ +# --exact_cooling=true \ +# "$@" + +# single cluster +# ${PYTHON} configure.py --model=HYDRO --flu_scheme=MHM --flux=HLLC --passive=2 \ +# --particle=true --store_par_acc=true --par_attribute_int=1 \ +# --gravity=true --unsplit_gravity=true --fftw=FFTW3 \ +# --mpi=true --gpu=true \ +# --hdf5=true --gsl=true \ +# --exact_cooling=true \ +# "$@" diff --git a/example/test_problem/Hydro/ClusterMerger/setup_input_files.sh b/example/test_problem/Hydro/ClusterMerger/setup_input_files.sh new file mode 100644 index 0000000000..4706a15688 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/setup_input_files.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +if [ "$#" -gt 1 ]; then + echo "Error: Too many arguments." + echo "Usage: $0 [1-9]" + exit 1 +fi + + +if [ "$#" -eq 1 ]; then + if [[ ! "$1" =~ ^[1-9]$ ]]; then + echo "Error: Argument must be a single digit from 1 to 9." + echo "Usage: $0 [1-9]" + exit 1 + fi + + printf "Linking default case ${1} input files ..." + ln -fs "./Input_Options/case${1}/Input__Flag_Lohner" + ln -fs "./Input_Options/case${1}/Input__Flag_NParPatch" + ln -fs "./Input_Options/case${1}/Input__Parameter" + ln -fs "./Input_Options/case${1}/Input__TestProb" + printf " Done!\n" +else + printf "Linking default case input files ..." + ln -fs "./Input_Options/default/Input__Flag_Lohner" + ln -fs "./Input_Options/default/Input__Flag_NParPatch" + ln -fs "./Input_Options/default/Input__Parameter" + ln -fs "./Input_Options/default/Input__TestProb" + printf " Done!\n" +fi diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/MergerUtilities.py b/example/test_problem/Hydro/ClusterMerger/yt_script/MergerUtilities.py new file mode 100644 index 0000000000..201508a66b --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/MergerUtilities.py @@ -0,0 +1,113 @@ +#==================================================================================================== +# Import +#==================================================================================================== +import numpy as np +import h5py + + + +#==================================================================================================== +# Function +#==================================================================================================== +def getRecordData(filename, target_cols=[]): + ''' + Get data from Record__ClusterCenter + ''' + data = [[] for _ in target_cols] + with open(filename, 'r') as f: + lines = f.readlines() + for line in lines: + if line[0] == '#': continue + temp = line.split() + N = len(temp) + for i, c in enumerate(target_cols): + if c > N-1: continue + data[i].append(float(temp[c])) + + return data + + +def getPassageTime(filename): + time_col = 0 + c0_x_col = 2 + c0_y_col = 3 + c0_z_col = 4 + c1_x_col = 42 + c1_y_col = 43 + c1_z_col = 44 + cols = [time_col, c0_x_col, c0_y_col, c0_z_col, c1_x_col, c1_y_col, c1_z_col] + data = getRecordData(filename, cols) + N0 = len(data[1]) + N1 = len(data[4]) + + prev = float('inf') + for i in range(N1): + dist2 = (data[1][i]-data[4][i])**2 + (data[2][i]-data[5][i])**2 + (data[3][i]-data[6][i])**2 + if dist2 > prev: return data[0][i] + prev = dist2 + + return -1.0 + + +def getMergerTime(filename): + ''' + Get BH merger time from Record__ClusterCenter + ''' + time_col = 0 + c1_x_col = 42 + cols = [time_col, c1_x_col] + data = getRecordData(filename, cols) + N = len(data[1]) + return data[0][N-1] + + +def getClusterCen(data_path, cluster_id, start, end, diff=1): + ''' + Get cluster center from Data_* + ''' + cenX, cenY, cenZ = [], [], [] + idx_x = "ClusterCen_%d_0"%cluster_id + idx_y = "ClusterCen_%d_1"%cluster_id + idx_z = "ClusterCen_%d_2"%cluster_id + for i in range(start, end+1, diff): + f = h5py.File( data_path+"/Data_%06d"%i, "r" ) + if idx_x not in f["User"]["UserPara"].dtype.names: + print("Can not find %s in Data_%06d"%(idx_x, i)) + break + if idx_y not in f["User"]["UserPara"].dtype.names: + print("Can not find %s in Data_%06d"%(idx_y, i)) + break + if idx_z not in f["User"]["UserPara"].dtype.names: + print("Can not find %s in Data_%06d"%(idx_z, i)) + break + + cenX.append( f["User"]["UserPara"][idx_x] ) + cenY.append( f["User"]["UserPara"][idx_y] ) + cenZ.append( f["User"]["UserPara"][idx_z] ) + return cenX, cenY, cenZ + + + +#==================================================================================================== +# Main (test) +#==================================================================================================== +if __name__ == "__main__": + print("Testing: getClusterCen") + data_mcf5 = "/projectU/chunyenc/Develop/gamer_cool_core_new/bin/mcf5/" + x, y, z = getClusterCen(data_mcf5, 1, 0, 100, 1) + print(x) + print(y) + print(z) + print("Test Done!!") + + print("Testing: getPassageTime") + record_mcf5 = "/projectU/chunyenc/Develop/gamer_cool_core_new/bin/mcf5/Record__ClusterCenter" + time = getPassageTime(record_mcf5) + print(time) + print("Test Done!!") + + print("Testing: getMergerTime") + record_mcf5 = "/projectU/chunyenc/Develop/gamer_cool_core_new/bin/mcf5/Record__ClusterCenter" + time = getMergerTime(record_mcf5) + print(time) + print("Test Done!!") diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/getClusterData.py b/example/test_problem/Hydro/ClusterMerger/yt_script/getClusterData.py new file mode 100644 index 0000000000..96f89e33d9 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/getClusterData.py @@ -0,0 +1,175 @@ +#==================================================================================================== +# Import +#==================================================================================================== +import argparse +import sys +import numpy as np +import matplotlib.pyplot as plt +import yt +import h5py + +sys.dont_write_bytecode = True +import MergerUtilities as mus + + + +#==================================================================================================== +# Constant +#==================================================================================================== +# code units in CGS +UNIT_L = 3.08567758149000e+24 +UNIT_M = 1.98850000000000e+47 +UNIT_T = 3.15569252000000e+17 +UNIT_V = 9.77813130377481e+06 +UNIT_D = 6.76821209430561e-27 +UNIT_E = 1.90124167292092e+61 +UNIT_P = 6.47121291670164e-13 + +# some constants in CGS +amu = 1.660539040e-24 +mu = 0.59242761692650336 +ne = 0.52 # electron number fraction +keV = 1.6021766208e-9 +kB = 1.38064852e-16 +msun = 1.9885e33 +kpc = 3.08567758149e21 + +G = 6.6738e-8 +yr = 31556926.0 +mp = 1.672621898e-24 +sigma_T = 6.65e-25 +c = 3e10 + +R200 = 1812.6 # kpc + + + +#==================================================================================================== +# Main +#==================================================================================================== +if __name__ == "__main__": + # 1. load the command-line parameters + parser = argparse.ArgumentParser( description='Generate major cluster data' ) + + parser.add_argument( '-p', action='store', required=False, type=str, dest='prefix', + help='path prefix [%(default)s]', default='../' ) + parser.add_argument( '-s', action='store', required=True, type=int, dest='idx_start', + help='first data index' ) + parser.add_argument( '-e', action='store', required=True, type=int, dest='idx_end', + help='last data index' ) + parser.add_argument( '-d', action='store', required=False, type=int, dest='didx', + help='delta data index [%(default)d]', default=1 ) + + args = parser.parse_args() + + # take note + print( '\nCommand-line arguments:' ) + print( '-------------------------------------------------------------------' ) + print( ' '.join(sys.argv) ) + print( '-------------------------------------------------------------------\n' ) + + idx_start = args.idx_start + idx_end = args.idx_end + didx = args.didx + prefix = args.prefix + + # 2. get cluster 0 center + cluster_id = 0 + cenX, cenY, cenZ = mus.getClusterCen( prefix, cluster_id, idx_start, idx_end, didx ) + + # 3. load data + def _spectral_weighting(field, data): + return (data["gas", "density"]*ne/(amu*mu))**2*data["gas", "temperature"]**(-0.75) + yt.add_field(("gas", "spectral_weighting"),function=_spectral_weighting,sampling_type="local",units='g**2/(K**(3/4)*cm**6)') + + yt.enable_parallelism() + ts = yt.DatasetSeries( [ prefix+'/Data_%06d'%idx for idx in range(idx_start, idx_end+1, didx) ] ) + + # 4. prepare arrays + S40, S_r500 = [], [] + S10, S20, S50, S100, S200, S500, S1000 = [], [], [], [], [], [], [] + Lx10, Lx20, Lx50, Lx100, Lx200, Lx500, Lx1000 = [], [], [], [], [], [], [] + tcool, deltaT = [], [] + Time = [] + + # 5. get profile data + ii = -1+idx_start + for ds in ts.piter(): + ii += 1 + sp_gamer = ds.sphere( [cenX[ii], cenY[ii], cenZ[ii]], (1.0e3, "kpc") ) + prof_gamer = yt.create_profile( sp_gamer, 'radius', + fields=[ ('gas','density'), ('gas','temperature'), ('gas', 'pressure'), ('gamer', 'TCool') ], + units = {'radius':'kpc'}, + weight_field='cell_mass', n_bins=2000 ) + radius_gamer = prof_gamer.x.value + dens_gamer = prof_gamer['gas', 'density' ].value + temp_gamer = prof_gamer['gas', 'temperature'].value + pres_gamer = prof_gamer['gas', 'pressure' ].value # in_units("g/s**2/cm") + tcool_gamer = prof_gamer['gamer', 'TCool' ].value + mask_gamer = temp_gamer > 0.0 + radius_gamer = radius_gamer[mask_gamer] + dens_gamer = dens_gamer [mask_gamer] + temp_gamer = temp_gamer [mask_gamer] + pres_gamer = pres_gamer [mask_gamer] + tcool_gamer = tcool_gamer [mask_gamer] + entr = (temp_gamer*kB/keV)*(dens_gamer*ne/(amu*mu))**(-2.0/3.0) + emis = 1.5*pres_gamer/(tcool_gamer*UNIT_T) # in (erg/s/cm^3) + + # integrated X-ray emissivity + N_emis = len(emis) + Emis = [0.0] * N_emis + for i in range(N_emis): + radius = radius_gamer[:i+1]*kpc # in cm + integrand = emis[:i+1]*4*np.pi*radius**2 + Emis[i] = np.trapz(integrand, radius) + + Time.append(ds.current_time.to('Gyr').value) + S40.append(np.interp(40, radius_gamer, entr)) + S_r500.append(np.interp(14.8512, radius_gamer, entr)) + Lx10.append(np.interp(10, radius_gamer, Emis)) + Lx20.append(np.interp(20, radius_gamer, Emis)) + Lx50.append(np.interp(50, radius_gamer, Emis)) + Lx100.append(np.interp(100, radius_gamer, Emis)) + Lx200.append(np.interp(200, radius_gamer, Emis)) + Lx500.append(np.interp(500, radius_gamer, Emis)) + Lx1000.append(np.interp(1000, radius_gamer, Emis)) + S10.append(np.interp(10, radius_gamer, entr)) + S20.append(np.interp(20, radius_gamer, entr)) + S50.append(np.interp(50, radius_gamer, entr)) + S100.append(np.interp(100, radius_gamer, entr)) + S200.append(np.interp(200, radius_gamer, entr)) + S500.append(np.interp(500, radius_gamer, entr)) + S1000.append(np.interp(1000, radius_gamer, entr)) + tcool.append(np.interp(40, radius_gamer, tcool_gamer)) + + di_1 = ds.disk( [cenX[ii], cenY[ii], cenZ[ii]], [0.0, 0.0, 1.0], (30.0, "kpc"), (500.0, "kpc") ) + di_2 = ds.disk( [cenX[ii], cenY[ii], cenZ[ii]], [0.0, 0.0, 1.0], (0.1*R200, "kpc"), (500.0, "kpc") ) + di_3 = ds.disk( [cenX[ii], cenY[ii], cenZ[ii]], [0.0, 0.0, 1.0], (0.2*R200, "kpc"), (500.0, "kpc") ) + cy_in = di_2 - di_1 + cy_out = di_3 - di_2 + prof_in = yt.create_profile( cy_in , 'radius', fields= ('gas','temperature'), units = {'radius':'kpc' }, + weight_field=("gas", "spectral_weighting"), n_bins=1 ) + prof_out = yt.create_profile( cy_out , 'radius', fields= ('gas','temperature'), units = {'radius':'kpc' }, + weight_field=("gas", "spectral_weighting"), n_bins=1 ) + temp_in = prof_in['gas', 'temperature'].value + temp_out = prof_out['gas', 'temperature'].value + T_inner = temp_in[0] + T_outer = temp_out[0] + + deltaT.append((T_outer-T_inner)/T_outer) + + # Save S(r) to file + data_to_save = np.column_stack((Time, S40, S_r500)) + np.savetxt( prefix+'data_S40.txt', data_to_save, delimiter='\t', header='# Time\tS40\tS_r500', comments='' ) + + # Save Lx(r) to file + data_to_save = np.column_stack((Time, Lx10, Lx20, Lx50, Lx100, Lx200, Lx500, Lx1000)) + np.savetxt( prefix+'data_Lx.txt', data_to_save, delimiter='\t', header='# Time\tLx20\tLx50\tLx100\tLx200\tLx500\tLx1000', comments='' ) + + # Save S(r) to file + data_to_save = np.column_stack((Time, S10, S20, S50, S100, S200, S500, S1000)) + np.savetxt( prefix+'data_S.txt', data_to_save, delimiter='\t', header='# Time\tS20\tS50\tS100\tS200\tS500\tS1000', comments='' ) + + # Save S(r) to file + data_to_save = np.column_stack((Time, tcool, deltaT)) + np.savetxt( perfix+'data_tcool_deltaT.txt', data_to_save, delimiter='\t', header='# Time\ttcool\tdeltaT', comments='' ) diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/getEntrProfileAll.py b/example/test_problem/Hydro/ClusterMerger/yt_script/getEntrProfileAll.py new file mode 100644 index 0000000000..f9fc46b7a5 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/getEntrProfileAll.py @@ -0,0 +1,105 @@ +#==================================================================================================== +# Import +#==================================================================================================== +import yt +import sys +import argparse +import numpy as np +import matplotlib.pyplot as plt + +sys.dont_write_bytecode = True +import MergerUtilities as mus + + + +#==================================================================================================== +# Constant +#==================================================================================================== +mu = 0.59242761692650336 +ne = 0.52 # electron number fraction +kB = yt.units.kb +amu = yt.units.amu +Mpc = yt.units.Mpc + + + +#==================================================================================================== +# Function +#==================================================================================================== +def _entropy(field, data): + return kB*data["gas", "temperature"]*(data["gas", "density"]*ne/(amu*mu))**(-2.0/3.0) + +def save_prof_to_file(radius, entropy, filename): + with open(filename, 'w') as file: + file.write('# radius (kpc) initial_entr (keV*cm^2) m_entr (keV*cm^2) mc_entr (keV*cm^2) mcf_entr (keV*cm^2)\n') + for r, e_init, e_m, e_mc, e_mcf in zip(radius, entropy['initial'], entropy['m'], entropy['mc'], entropy['mcf']): + file.write(f"{r} {e_init} {e_m} {e_mc} {e_mcf}\n") + +def getEntropyProfile(data, center, target_radius): + ds = yt.load(data) + sp = ds.sphere(center, (1.0e4, "kpc")) + prof = yt.create_profile( sp, 'radius', fields=[('gas','entropy'), ('gas','temperature')], + units={'radius':'kpc'}, weight_field='cell_mass', n_bins=100 ) + radius = prof.x.value + entr = prof['gas','entropy'].value + temp = prof['gas','temperature'].value + mask = temp > 0.0 + + return np.interp(target_radius, radius[mask], entr[mask]) + + + +#==================================================================================================== +# Main +#==================================================================================================== +if __name__ == "__main__": + yt.add_field( ("gas", "entropy"), function=_entropy, sampling_type="local", units="keV*cm**2" ) + + parser = argparse.ArgumentParser( description='Get the cluster entropy profile from `m`, mc`, and `mcf` cases ' ) + + parser.add_argument( '-p1', action='store', required=True, type=str, dest='prefix_m', + help='`m` simulation path prefix [%(default)s]' ) + parser.add_argument( '-p2', action='store', required=True, type=str, dest='prefix_mc', + help='`mc` simulation path prefix [%(default)s]' ) + parser.add_argument( '-p3', action='store', required=True, type=str, dest='prefix_mcf', + help='`mcf` simulation path prefix [%(default)s]' ) + + args = parser.parse_args() + + # take note + print( '\nCommand-line arguments:' ) + print( '-------------------------------------------------------------------' ) + print( ' '.join(sys.argv) ) + print( '-------------------------------------------------------------------\n' ) + + prefix_m = args.prefix_m + prefix_mc = args.prefix_mc + prefix_mcf = args.prefix_mcf + + + labels = [ 'initial', 'm', 'mc', 'mcf' ] + + # Define a common radius range for interpolation + common_radius = np.logspace( np.log10(1e0), np.log10(1e4), 100 ) + entropy = {label:np.zeros_like(common_radius) for label in labels} + + # Load initial profile + cenX, cenY, cenZ = mus.getClusterCen(prefix_m, 0, 0, 100, 1) + center = [ cenX[0], cenY[0], cenZ[0] ] + entropy['initial'] = getEntropyProfile( prefix_m+"/Data_000000", center, common_radius) + + # Load profiles for m, mc, mcf + last_idx = 100 + cenX, cenY, cenZ = mus.getClusterCen(prefix_m, 0, 0, 100, 1) + center = [ cenX[last_idx], cenY[last_idx], cenZ[last_idx] ] + entropy['m'] = getEntropyProfile( prefix_m+"/Data_%06d"%last_idx, center, common_radius) + + cenX, cenY, cenZ = mus.getClusterCen(prefix_mc, 0, 0, 100, 1) + center = [ cenX[last_idx], cenY[last_idx], cenZ[last_idx] ] + entropy['mc'] = getEntropyProfile( prefix_mc+"/Data_%06d"%last_idx, center, common_radius) + + cenX, cenY, cenZ = mus.getClusterCen(prefix_mcf, 0, 0, 100, 1) + center = [ cenX[last_idx], cenY[last_idx], cenZ[last_idx] ] + entropy['mcf'] = getEntropyProfile( prefix_mcf+"/Data_%06d"%last_idx, center, common_radius) + + save_prof_to_file(common_radius, entropy, prefix_mcf+'/entr_prof.txt') diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_evolv_clusterData.py b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_evolv_clusterData.py new file mode 100644 index 0000000000..16869785a5 --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_evolv_clusterData.py @@ -0,0 +1,116 @@ +#==================================================================================================== +# Import +#==================================================================================================== +import sys +import argparse +import numpy as np +import matplotlib.pyplot as plt + +sys.dont_write_bytecode = True +import MergerUtilities as mus + + + +#==================================================================================================== +# Constant +#==================================================================================================== +DPI = 300 + + + +#==================================================================================================== +# Main +#==================================================================================================== +if __name__ == "__main__": + parser = argparse.ArgumentParser( description='Plot the data generated from getClusterData.py' ) + + parser.add_argument( '-p', action='store', required=False, type=str, dest='prefix', + help='path prefix [%(default)s]', default='../' ) + + args = parser.parse_args() + + # take note + print( '\nCommand-line arguments:' ) + print( '-------------------------------------------------------------------' ) + print( ' '.join(sys.argv) ) + print( '-------------------------------------------------------------------\n' ) + + prefix = args.prefix + + + # S(r) + data = np.loadtxt(prefix+"data_S40.txt", skiprows=1) + Time = data[:, 0] + S40 = data[:, 1] + S_r500 = data[:, 2] + + plt.plot(Time, S40, label="S(40)", linewidth=3.0) + plt.plot(Time, S_r500, label="S_r500", linewidth=3.0) + + plt.ylim(5e-2, 730) + plt.xlim(0.0, 10.0) + plt.xlabel("time (Gyr)") + plt.ylabel(r"$S(r \ [kpc]) \ [\mathrm{keV\ cm^2}]$") + plt.title("Entropy Evolution") + plt.legend() + plt.savefig(prefix+"/S40_evolution.png", dpi=DPI, bbox_inches='tight') + + + # Lx(r) + Time_R, Power = mus.getRecordData(prefix+"/Record__ClusterCenter", [0, 30]) + data = np.loadtxt(prefix+"/data_Lx.txt", skiprows=1) + Time = data[:, 0] + Lx10 = data[:, 1] + Lx20 = data[:, 2] + Lx50 = data[:, 3] + Lx100 = data[:, 4] + Lx200 = data[:, 5] + Lx500 = data[:, 6] + Lx1000 = data[:, 7] + + plt.plot(Time, Lx10, label="Lx(<10 kpc)", linewidth=1.0) + plt.plot(Time, Lx20, label="Lx(<20 kpc)", linewidth=1.0) + plt.plot(Time, Lx50, label="Lx(<50 kpc)", linewidth=1.0) + plt.plot(Time, Lx100, label="Lx(<100 kpc)", linewidth=1.0) + plt.plot(Time, Lx200, label="Lx(<200 kpc)", linewidth=1.0) + plt.plot(Time, Lx500, label="Lx(<500 kpc)", linewidth=1.0) + plt.plot(Time, Lx1000, label="Lx(<1000 kpc)", linewidth=1.0) + plt.plot(Time_R, Power, label="jet power", linewidth=1.0) + plt.ylim(1e41, 1e51) + plt.xlim(0.0, 10.0) + plt.yscale("log") + plt.xlabel("time (Gyr)") + plt.ylabel("Lx(r) (erg/s)") + plt.title("Cooling v.s. Heating") + plt.legend() + plt.savefig(prefix+"/coolheat_evolution.png", dpi=DPI, bbox_inches='tight') + + + # entropy + data = np.loadtxt(prefix+"/data_S.txt", skiprows=1) + Time = data[:, 0] + S10 = data[:, 1] + S20 = data[:, 2] + S50 = data[:, 3] + S100 = data[:, 4] + S200 = data[:, 5] + S500 = data[:, 6] + S1000 = data[:, 7] + + + plt.plot(Time, S10, label="S(10)", linewidth=1.0) + plt.plot(Time, S20, label="S(20)", linewidth=1.0) + plt.plot(Time, S50, label="S(50)", linewidth=1.0) + plt.plot(Time, S100, label="S(100)", linewidth=1.0) + plt.plot(Time, S200, label="S(200)", linewidth=1.0) + plt.plot(Time, S500, label="S(500)", linewidth=1.0) + plt.plot(Time, S1000, label="S(1000)", linewidth=1.0) + + plt.ylim(5e-2, 3e3) + plt.xlim(0.0, 10.0) + plt.yscale("log") + plt.xlabel("time (Gyr)") + plt.ylabel("$S(r \ [kpc]) \ [\mathrm{keV\ cm^2}]$") + plt.title("Entropy Evolution") + plt.legend() + plt.savefig(prefix+"/entr_evolution.png", dpi=DPI, bbox_inches='tight') diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_profile.py b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_profile.py index 87ed5de56b..a1f1b999b2 100644 --- a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_profile.py +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_profile.py @@ -31,8 +31,8 @@ [ f.axes[t].set_xscale( 'log', nonpositive='clip' ) for t in range(0,4,1) ] [ f.axes[t].set_yscale( 'log', nonpositive='clip' ) for t in range(0,4,1) ] [ f.axes[t].set_xlim( 5.0e+0, 2.0e+3 ) for t in range(0,4,1) ] -ax[1][0].set_xlabel( '$r\ [\mathrm{kpc}]$', fontsize=16 ) -ax[1][1].set_xlabel( '$r\ [\mathrm{kpc}]$', fontsize=16 ) +ax[1][0].set_xlabel( r'$r\ [\mathrm{kpc}]$', fontsize=16 ) +ax[1][1].set_xlabel( r'$r\ [\mathrm{kpc}]$', fontsize=16 ) for i in range(0,2): for j in range(0,2): ax[j][i].xaxis.set_minor_locator( plt.LogLocator(base=10.0, subs=[2.0,5.0,8.0]) ) @@ -114,28 +114,28 @@ #ax[0][0].plot( radius_flash, dens_flash, 'r-', lw=1, label='FLASH' ) ax[0][0].set_ylim( 1.0e-5, 2.0e-2 ) -ax[0][0].set_ylabel( '$n_e\ [\mathrm{cm^{-3}}]$', fontsize=16 ) +ax[0][0].set_ylabel( r'$n_e\ [\mathrm{cm^{-3}}]$', fontsize=16 ) # gas temperature ax[1][0].plot( radius_gamer, temp_gamer, 'b-', lw=1, label='GAMER' ) #ax[1][0].plot( radius_flash, temp_flash, 'r-', lw=1, label='FLASH' ) ax[1][0].set_ylim( 5.0e+0, 2.0e+1 ) -ax[1][0].set_ylabel( '$T\ [\mathrm{keV}]$', fontsize=16 ) +ax[1][0].set_ylabel( r'$T\ [\mathrm{keV}]$', fontsize=16 ) # entropy ax[0][1].plot( radius_gamer, entr_gamer, 'b-', lw=1, label='GAMER' ) #ax[0][1].plot( radius_flash, entr_flash, 'r-', lw=1, label='FLASH' ) ax[0][1].set_ylim( 1.0e+2, 1.0e+4 ) -ax[0][1].set_ylabel( '$S \ [\mathrm{keV\ cm^2}]$', fontsize=16 ) +ax[0][1].set_ylabel( r'$S \ [\mathrm{keV\ cm^2}]$', fontsize=16 ) # dark matter mass density ax[1][1].plot( radius_gamer, pden_gamer, 'b-', lw=1, label='GAMER' ) #ax[1][1].plot( radius_flash, pden_flash, 'r-', lw=1, label='FLASH' ) ax[1][1].set_ylim( 5.0e+3, 1.0e+8 ) -ax[1][1].set_ylabel( '$\\rho_{\mathrm{DM}}\ [\mathrm{M_{\odot}\ kpc^{-3}}]$', fontsize=16 ) +ax[1][1].set_ylabel( r'$\rho_{\mathrm{DM}}\ [\mathrm{M_{\odot}\ kpc^{-3}}]$', fontsize=16 ) # legend ax[0][0].legend( loc='lower left', numpoints=1, labelspacing=0.2, fontsize=13, handletextpad=0.5, diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice-z.py b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice-z.py index ee04c38221..c0683ed104 100644 --- a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice-z.py +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice-z.py @@ -35,11 +35,24 @@ center_mode = 'c' dpi = 150 + +# define the particle filter for SMBH particles +def smbh( pfilter, data ): + filter = data[ "all", "ParType" ] == 4 + return filter + +yt.add_particle_filter( "smbh", function=smbh, filtered_type="all", requires=["ParType"] ) + + 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(): +# apply the particle filters to the dataset + ds.add_particle_filter( 'smbh' ) + + # density field = 'density' sz_dens = yt.SlicePlot( ds, 'z', field, center=center_mode ) @@ -72,8 +85,9 @@ cdm_mass.set_unit( field, 'Msun' ) cdm_mass.set_zlim( field, 1.0e9, 1.0e12 ) cdm_mass.set_cmap( field, colormap_cdm ) - cdm_mass.set_colorbar_label( field, 'Dark matter mass [$M_{\odot}$]' ) + cdm_mass.set_colorbar_label( field, r'Dark matter mass [$M_{\odot}$]' ) cdm_mass.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + cdm_mass.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh' ) cdm_mass.save( mpl_kwargs={"dpi":dpi} ) diff --git a/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice_CCD.py b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice_CCD.py new file mode 100644 index 0000000000..29df29175c --- /dev/null +++ b/example/test_problem/Hydro/ClusterMerger/yt_script/plot_slice_CCD.py @@ -0,0 +1,166 @@ +#==================================================================================================== +# Import +#==================================================================================================== +import argparse +import sys +import yt +from yt.units import Mpc +import h5py + +sys.dont_write_bytecode = True +import MergerUtilities as mus + + + +#==================================================================================================== +# Consant +#==================================================================================================== +# some constants in CGS +amu = 1.660539040e-24 +mu = 0.59242761692650336 +ne = 0.52 # electron number fraction +keV = 1.6021766208e-9 +kB = 1.38064852e-16 +msun = 1.9885e33 +kpc = 3.08567758149e21 + + + +#==================================================================================================== +# Main +#==================================================================================================== +# load the command-line parameters +parser = argparse.ArgumentParser( description='Plot the density and entropy slices of CCD simulations' ) + +parser.add_argument( '-p', action='store', required=False, type=str, dest='prefix', + help='path prefix [%(default)s]', default='../' ) +parser.add_argument( '-s', action='store', required=True, type=int, dest='idx_start', + help='first data index' ) +parser.add_argument( '-e', action='store', required=True, type=int, dest='idx_end', + help='last data index' ) +parser.add_argument( '-d', action='store', required=False, type=int, dest='didx', + help='delta data index [%(default)d]', default=1 ) + +args=parser.parse_args() + +# take note +print( '\nCommand-line arguments:' ) +print( '-------------------------------------------------------------------' ) +print( ' '.join(sys.argv) ) +print( '-------------------------------------------------------------------\n' ) + + +idx_start = args.idx_start +idx_end = args.idx_end +didx = args.didx +prefix = args.prefix + + +def _entropy(field, data): + return data["gas", "temperature"]*kB/keV*(data["gas", "density"]*ne/(amu*mu))**(-2.0/3.0) +yt.add_field(("gas", "entropy"),function=_entropy,sampling_type="local",units="K*cm**2/g**(2/3)") + +# define the particle filters for SMBH particles +def smbh1( pfilter, data ): + filter = (data[ "all", "ParType" ] == 4) & (data["all", "ParHalo"] == 0) + return filter + +def smbh2( pfilter, data ): + filter = (data[ "all", "ParType" ] == 4) & (data["all", "ParHalo"] == 1) + return filter + +yt.add_particle_filter( "smbh1", function=smbh1, filtered_type="all", requires=["ParType"] ) +yt.add_particle_filter( "smbh2", function=smbh2, filtered_type="all", requires=["ParType"] ) + + +yt.enable_parallelism() +ts = yt.DatasetSeries( [ prefix+'/Data_%06d'%idx for idx in range(idx_start, idx_end+1, didx) ] ) + + +# Get clusters center +cenX0, cenY0, cenZ0 = mus.getClusterCen(prefix, 0, idx_start, idx_end, didx) +cenX1, cenY1, cenZ1 = mus.getClusterCen(prefix, 1, idx_start, idx_end, didx) + + +colormap_dens = 'algae' +colormap_temp = 'afmhot' +colormap_cdm = 'arbre' +center_mode = 'c' +dpi = 150 + +plot_width_one = (200, 'kpc') +plot_width_all = (5000, 'kpc') + + +N0 = len(cenX0) +N1 = len(cenX1) +ii = -1 +for ds in ts.piter(): + ii += 1 + # apply the particle filters to the dataset + ds.add_particle_filter( 'smbh1' ) + ds.add_particle_filter( 'smbh2' ) + + # all + field = 'density' + sz_dens = yt.SlicePlot( ds, 'z', field, center=center_mode, width=plot_width_all ) + + sz_dens.set_zlim( field, 1.0e-27, 1.0e-22 ) + sz_dens.set_cmap( field, colormap_dens ) + sz_dens.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_dens.save( prefix+"Data_%06d_density_all.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + field = 'entropy' + sz_entr = yt.SlicePlot( ds, 'z', field, center=center_mode, width=plot_width_all ) + sz_entr.set_zlim( field, 1.0e+1, 1.0e+5 ) + sz_entr.set_cmap( field, colormap_dens ) + sz_entr.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_entr.save( prefix+"Data_%06d_entropy_all.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + # major + field = 'density' + sz_dens = yt.SlicePlot( ds, 'z', field, center=[cenX0[ii], cenY0[ii], cenZ0[ii]], width=plot_width_one ) + + sz_dens.set_zlim( field, 1.0e-27, 1.0e-22 ) + sz_dens.set_cmap( field, colormap_dens ) + sz_dens.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_dens.save( prefix+"Data_%06d_density_major.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + field = 'entropy' + sz_entr = yt.SlicePlot( ds, 'z', field, center=[cenX0[ii], cenY0[ii], cenZ0[ii]], width=plot_width_one ) + sz_entr.set_zlim( field, 1.0e+1, 1.0e+5 ) + sz_entr.set_cmap( field, colormap_dens ) + sz_entr.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_entr.save( prefix+"Data_%06d_entropy_major.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + if ii >= N1: continue + + # minor + field = 'density' + sz_dens = yt.SlicePlot( ds, 'z', field, center=[cenX1[ii], cenY1[ii], cenZ1[ii]], width=plot_width_one ) + + sz_dens.set_zlim( field, 1.0e-27, 1.0e-22 ) + sz_dens.set_cmap( field, colormap_dens ) + sz_dens.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_dens.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_dens.save( prefix+"Data_%06d_density_minor.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + field = 'entropy' + sz_entr = yt.SlicePlot( ds, 'z', field, center=[cenX1[ii], cenY1[ii], cenZ1[ii]], width=plot_width_one ) + sz_entr.set_zlim( field, 1.0e+1, 1.0e+5 ) + sz_entr.set_cmap( field, colormap_dens ) + sz_entr.annotate_timestamp( time_unit='Myr', corner='upper_right' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='b', ptype='smbh1' ) + sz_entr.annotate_particles( width=(10.0*Mpc), p_size=10.0, col='r', ptype='smbh2' ) + sz_entr.save( prefix+"Data_%06d_entropy_minor.png"%(ii), mpl_kwargs={"dpi":dpi} ) + + diff --git a/example/test_problem/Hydro/ExactCooling/Input__Parameter b/example/test_problem/Hydro/ExactCooling/Input__Parameter new file mode 100644 index 0000000000..8b04ae6492 --- /dev/null +++ b/example/test_problem/Hydro/ExactCooling/Input__Parameter @@ -0,0 +1,387 @@ + + +# ================================================================================================================= +# NOTE: +# 1. Comment symbol: # +# 2. [*]: defaults +# 3. Parameters set to "auto" (usually by setting to a negative value) do not have deterministic default values +# and will be set according to the adopted compilation options and/or other runtime parameters +# 4. To add new parameters, please edit "Init/Init_Load_Parameter.cpp" +# 5. All dimensional variables should be set consistently with the code units (set by UNIT_L/M/T/V/D) unless +# otherwise specified (e.g., SF_CREATE_STAR_MIN_GAS_DENS & SF_CREATE_STAR_MIN_STAR_MASS) +# 6. For boolean options: 0/1 -> off/on +# ================================================================================================================= + + +# simulation scale +BOX_SIZE 3e21 # box size along the longest side (in Mpc/h if COMOVING is adopted) +NX0_TOT_X 64 # number of base-level cells along x +NX0_TOT_Y 64 # number of base-level cells along y +NX0_TOT_Z 64 # number of base-level cells along z +OMP_NTHREAD -1 # number of OpenMP threads (<=0=auto -> omp_get_max_threads) [-1] ##OPENMP ONLY## +END_T -1.0 # end physical time (<0=auto -> must be set by test problems or restart) [-1.0] +END_STEP -1 # end step (<0=auto -> must be set by test problems or restart) [-1] + + +# test problems +TESTPROB_ID 123 # test problem ID [0] + # 0: none + # 1: HYDRO blast wave [+MHD] + # 2: HYDRO acoustic wave + # 3: HYDRO Bondi accretion (+GRAVITY) + # 4: HYDRO cluster merger vs. Flash (+GRAVITY & PARTICLE) + # 5: HYDRO AGORA isolated galaxy (+GRAVITY & PARTICLE & STAR_FORMATION & GRACKLE) + # 6: HYDRO caustic wave + # 7: HYDRO spherical collapse (+GRAVITY & COMOVING) + # 8: HYDRO Kelvin Helmholtz instability + # 9: HYDRO Riemann problems [+MHD] + # 10: HYDRO jet(s) + # 11: HYDRO Plummer cloud(s) (+GRAVITY & PARTICLE) + # 12: HYDRO gravity (+GRAVITY) + # 13: HYDRO MHD Arnold-Beltrami-Childress (ABC) flow (+MHD) + # 14: HYDRO MHD Orszag-Tang vortex (+MHD) + # 15: HYDRO MHD linear wave (+MHD) + # 16: HYDRO Jeans instability (+GRAVITY) [+MHD] + # 17: HYDRO particle in equilibrium (+GRAVITY & PARTICLE) + # 19: HYDRO energy power spectrum + # 100: HYDRO CDM cosmological simulation (+GRAVITY & COMOVING & PARTICLE) + # 101: HYDRO Zeldovich pancake collapse (+GRAVITY & COMOVING & PARTICLE) + # 1000: ELBDM external potential (+GRAVITY) + + +# code units (in cgs) +OPT__UNIT 1 # specify code units -> must set exactly 3 basic units below [0] ##USELESS FOR COMOVING## +UNIT_L 1.0 # 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.0 # 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] + + +# boundary conditions +OPT__BC_FLU_XM 1 # fluid boundary condition at the -x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_FLU_XP 1 # fluid boundary condition at the +x face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_FLU_YM 1 # fluid boundary condition at the -y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_FLU_YP 1 # fluid boundary condition at the +y face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_FLU_ZM 1 # fluid boundary condition at the -z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_FLU_ZP 1 # fluid boundary condition at the +z face: (1=periodic, 2=outflow, 3=reflecting, 4=user, 5=diode) ##2/3/5 for HYDRO ONLY## +OPT__BC_POT 1 # gravity boundary condition: (1=periodic, 2=isolated) +GFUNC_COEFF0 -1.0 # Green's function coefficient at the origin for the isolated BC (<0=auto) [-1.0] + + +# particle (PARTICLE only) +PAR_NPAR 0 # total number of particles (must be set for PAR_INIT==1/3; must be an integer) +PAR_INIT 1 # initialization option for particles: (1=FUNCTION, 2=RESTART, 3=FILE->"PAR_IC") +PAR_IC_FORMAT 1 # data format of PAR_IC: (1=[attribute][id], 2=[id][attribute]; row-major) [1] +PAR_IC_MASS -1.0 # mass of all particles for PAR_INIT==3 (<0=off) [-1.0] +PAR_IC_TYPE -1 # type of all particles for PAR_INIT==3 (<0=off) [-1] +PAR_INTERP 3 # particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [2] +PAR_INTEG 2 # particle integration scheme: (1=Euler, 2=KDK) [2] +PAR_TR_INTERP 3 # tracer particle interpolation scheme: (1=NGP, 2=CIC, 3=TSC) [3] +PAR_TR_INTEG 2 # tracer particle integration scheme: (1=Euler, 2=RK2) [2] +PAR_IMPROVE_ACC 1 # improve force accuracy at patch boundaries [1] ##STORE_POT_GHOST and PAR_INTERP=2/3 ONLY## +PAR_PREDICT_POS 1 # predict particle position during mass assignment [1] +PAR_REMOVE_CELL -1.0 # remove particles X-root-cells from the boundaries (non-periodic BC only; <0=auto) [-1.0] +OPT__FREEZE_PAR 0 # do not update particles (except for tracers) [0] +PAR_TR_VEL_CORR 0 # correct tracer particle velocities in regions of discontinuous flow [0] + +# cosmology (COMOVING only) +A_INIT 0.01 # initial scale factor +OMEGA_M0 0.3 # omega matter at the present time +HUBBLE0 0.70 # dimensionless Hubble parameter (currently only for converting ELBDM_MASS to code units) + + +# time-step +DT__MAX -1.0 # dt criterion: maximum allowed dt (<0=off) [-1.0] +DT__FLUID -1.0 # dt criterion: fluid solver CFL factor (<0=auto) [-1.0] +DT__FLUID_INIT -1.0 # dt criterion: DT__FLUID at the first step (<0=auto) [-1.0] +DT__GRAVITY -1.0 # dt criterion: gravity solver safety factor (<0=auto) [-1.0] +DT__PHASE 0.0 # dt criterion: phase rotation safety factor (0=off) [0.0] ##ELBDM ONLY## +DT__PARVEL 0.5 # dt criterion: particle velocity safety factor [0.5] +DT__PARVEL_MAX -1.0 # dt criterion: maximum allowed dt from particle velocity (<0=off) [-1.0] +DT__PARACC 0.5 # dt criterion: particle acceleration safety factor (0=off) [0.5] ##STORE_PAR_ACC ONLY## +DT__MAX_DELTA_A 0.01 # dt criterion: maximum variation of the cosmic scale factor [0.01] +DT__SYNC_PARENT_LV 0.1 # dt criterion: allow dt to adjust by (1.0+DT__SYNC_PARENT) in order to synchronize + # with the parent level (for OPT__DT_LEVEL==3 only) [0.1] +DT__SYNC_CHILDREN_LV 0.1 # dt criterion: allow dt to adjust by (1.0-DT__SYNC_CHILDREN) in order to synchronize + # with the children level (for OPT__DT_LEVEL==3 only; 0=off) [0.1] +OPT__DT_USER 0 # dt criterion: user-defined -> edit "Mis_GetTimeStep_UserCriteria.cpp" [0] +OPT__DT_LEVEL 3 # dt at different AMR levels (1=shared, 2=differ by two, 3=flexible) [3] +OPT__RECORD_DT 1 # record info of the dt determination [1] +AUTO_REDUCE_DT 1 # reduce dt automatically when the program fails (for OPT__DT_LEVEL==3 only) [1] +AUTO_REDUCE_DT_FACTOR 0.8 # reduce dt by a factor of AUTO_REDUCE_DT_FACTOR when the program fails [0.8] +AUTO_REDUCE_DT_FACTOR_MIN 0.1 # minimum allowed AUTO_REDUCE_DT_FACTOR after consecutive failures [0.1] +AUTO_REDUCE_MINMOD_FACTOR 0.8 # reduce MINMOD_COEFF by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] ##HYDRO ONLY## +AUTO_REDUCE_MINMOD_MIN 1.0e-2 # minimum allowed MINMOD_COEFF after consecutive failures [1.0e-2] ##HYDRO ONLY## +AUTO_REDUCE_INT_MONO_FACTOR 0.8 # reduce INT_MONO_COEFF(_B) by this factor together with AUTO_REDUCE_DT (1.0=off) [0.8] +AUTO_REDUCE_INT_MONO_MIN 1.0e-2 # minimum allowed INT_MONO_COEFF(_B) after consecutive failures [1.0e-2] + + +# grid refinement (examples of Input__Flag_XXX tables are put at "example/input/") +REGRID_COUNT 4 # refine every REGRID_COUNT sub-step [4] +REFINE_NLEVEL 1 # number of new AMR levels to be created at once during refinement [1] +FLAG_BUFFER_SIZE -1 # number of buffer cells for the flag operation (0~PATCH_SIZE; <0=auto -> PATCH_SIZE) [-1] +FLAG_BUFFER_SIZE_MAXM1_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-1 (<0=auto -> REGRID_COUNT) [-1] +FLAG_BUFFER_SIZE_MAXM2_LV -1 # FLAG_BUFFER_SIZE at the level MAX_LEVEL-2 (<0=auto) [-1] +MAX_LEVEL 0 # maximum refinement level (0~NLEVEL-1) [NLEVEL-1] +OPT__FLAG_RHO 0 # flag: density (Input__Flag_Rho) [0] +OPT__FLAG_RHO_GRADIENT 0 # flag: density gradient (Input__Flag_RhoGradient) [0] +OPT__FLAG_PRES_GRADIENT 0 # flag: pressure gradient (Input__Flag_PresGradient) [0] ##HYDRO ONLY## +OPT__FLAG_VORTICITY 0 # flag: vorticity (Input__Flag_Vorticity) [0] ##HYDRO ONLY## +OPT__FLAG_JEANS 0 # flag: Jeans length (Input__Flag_Jeans) [0] ##HYDRO ONLY## +OPT__FLAG_CURRENT 0 # flag: current density in MHD (Input__Flag_Current) [0] ##MHD ONLY## +OPT__FLAG_ENGY_DENSITY 0 # flag: energy density (Input_Flag_EngyDensity) [0] ##ELBDM ONLY## +OPT__FLAG_LOHNER_DENS 0 # flag: Lohner for mass density (Input__Flag_Lohner) [0] ##BOTH HYDRO AND ELBDM## +OPT__FLAG_LOHNER_ENGY 0 # flag: Lohner for energy density (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_PRES 0 # flag: Lohner for pressure (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_TEMP 0 # flag: Lohner for temperature (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_ENTR 0 # flag: Lohner for entropy (Input__Flag_Lohner) [0] ##HYDRO ONLY## +OPT__FLAG_LOHNER_FORM 2 # form of Lohner: (1=FLASH-1, 2=FLASH-2, 3=form-invariant-1, 4=form-invariant-2) [2] +OPT__FLAG_USER 0 # flag: user-defined (Input__Flag_User) -> edit "Flag_User.cpp" [0] +OPT__FLAG_USER_NUM 1 # number of threshold values in user-defined table (Input__Flag_User) [1] +OPT__FLAG_REGION 0 # flag: specify the regions **allowed** to be refined -> edit "Flag_Region.cpp" [0] +OPT__FLAG_NPAR_PATCH 0 # flag: # of particles per patch (Input__Flag_NParPatch): (0=off, 1=itself, 2=itself+siblings) [0] +OPT__FLAG_NPAR_CELL 0 # flag: # of particles per cell (Input__Flag_NParCell) [0] +OPT__FLAG_PAR_MASS_CELL 0 # flag: total particle mass per cell (Input__Flag_ParMassCell) [0] +OPT__NO_FLAG_NEAR_BOUNDARY 0 # flag: disallow refinement near the boundaries [0] +OPT__PATCH_COUNT 1 # record the # of patches at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__PARTICLE_COUNT 1 # record the # of particles at each level: (0=off, 1=every step, 2=every sub-step) [1] +OPT__REUSE_MEMORY 2 # reuse patch memory to reduce memory fragmentation: (0=off, 1=on, 2=aggressive) [2] +OPT__MEMORY_POOL 0 # preallocate patches for OPT__REUSE_MEMORY=1/2 (Input__MemoryPool) [0] + + +# load balance (LOAD_BALANCE only) +LB_INPUT__WLI_MAX 0.1 # weighted-load-imbalance (WLI) threshold for redistributing all patches [0.1] +LB_INPUT__PAR_WEIGHT 0.0 # load-balance weighting of one particle over one cell [0.0] +OPT__RECORD_LOAD_BALANCE 1 # record the load-balance info [1] +OPT__MINIMIZE_MPI_BARRIER 1 # minimize MPI barriers to improve load balance, especially with particles [1] + # (STORE_POT_GHOST, PAR_IMPROVE_ACC=1, OPT__TIMING_BARRIER=0 only; recommend AUTO_REDUCE_DT=0) + + +# source terms +SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 1 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 1501 # number of points for lambda(T) sampling in LOG +SRC_EC_SUBCYCLING 1 # perform subcycling when the cooling time step is small [0=off, 1=on] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step +SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] +SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] + + +# Grackle library for chemistry and radiative cooling (SUPPORT_GRACKLE only) +GRACKLE_ACTIVATE 1 # enable Grackle [1] +GRACKLE_VERBOSE 1 # map to "grackle_verbose" [1] +GRACKLE_COOLING 1 # ... "with_radiative_cooling" [1] +GRACKLE_PRIMORDIAL 0 # ... "primordial_chemistry" (0=Cloudy, 1/2/3=6-/9-/12-species) [0] + # (must increase NCOMP_PASSIVE_USER by 6/9/12, respectively) +GRACKLE_METAL 0 # ... "metal_cooling" (must increase NCOMP_PASSIVE_USER by 1) [0] +GRACKLE_UV 0 # ... "UVbackground" [0] +GRACKLE_CMB_FLOOR 1 # ... "cmb_temperature_floor" [1] +GRACKLE_PE_HEATING 0 # ... "photoelectric_heating" [0] +GRACKLE_PE_HEATING_RATE 8.5e-26 # ... "photoelectric_heating_rate (in erg/cm^3/s)" [8.5e-26] +GRACKLE_CLOUDY_TABLE CloudyData_noUVB.h5 # "grackle_data_file" +GRACKLE_THREE_BODY_RATE 4 # used Glover+08 rate +GRACKLE_CIE_COOLING 1 # 0: off; 1:on +GRACKLE_H2_OPA_APPROX 1 # H2 opacity from Ripamonti+04; 0:off, 1:Ripomonti+04 +CHE_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU Grackle solver (<=0=auto) [-1] + + +# star formation (STAR_FORMATION only) +SF_CREATE_STAR_SCHEME 0 # star formation schemes (0=off, 1=AGORA) [0] +SF_CREATE_STAR_RSEED 123 # random seed [123] +SF_CREATE_STAR_DET_RANDOM -1 # make random numbers deterministic (i.e., independent of OpenMP and MPI, <0=auto) [-1] +SF_CREATE_STAR_MIN_LEVEL 0 # minimum AMR level allowed to form stars (<0=auto -> MAX_LEVEL) [0] +SF_CREATE_STAR_MIN_GAS_DENS 1.0e1 # minimum gas density allowed to form stars (in HI count/cm^3) [1.0e1] +SF_CREATE_STAR_MASS_EFF 1.0e-2 # Gas-to-star mass conversion efficiency [1.0e-2] +SF_CREATE_STAR_MIN_STAR_MASS 0.0 # minimum star particle mass for the stochastical star formation (in Msun) [0.0] +SF_CREATE_STAR_MAX_STAR_MFRAC 0.5 # maximum gas mass fraction allowed to convert to stars per substep [0.5] + + +# fluid solver in HYDRO (MODEL==HYDRO only) +GAMMA 1.666666667 # ratio of specific heats (i.e., adiabatic index) [5.0/3.0] ##EOS_GAMMA ONLY## +MOLECULAR_WEIGHT 0.6 # mean molecular weight [0.6] +MU_NORM 1.6737352238051868e-24 # m_H value, fully consistent with yt +ISO_TEMP 1.0e4 # isothermal temperature in kelvin ##EOS_ISOTHERMAL ONLY## +MINMOD_COEFF 1.5 # coefficient of the generalized MinMod limiter (1.0~2.0) [1.5] +MINMOD_MAX_ITER 0 # maximum number of iterations to reduce MINMOD_COEFF when data reconstruction fails (0=off) [0] +OPT__LR_LIMITER -1 # slope limiter of data reconstruction in the MHM/MHM_RP/CTU schemes: + # (-1=auto, 0=none, 1=vanLeer, 2=generalized MinMod, 3=vanAlbada, 4=vanLeer+generalized MinMod, 6=central) [-1] +OPT__1ST_FLUX_CORR -1 # correct unphysical results (defined by MIN_DENS/PRES) by the 1st-order fluxes: + # (<0=auto, 0=off, 1=3D, 2=3D+1D) [-1] ##MHM/MHM_RP/CTU ONLY## +OPT__1ST_FLUX_CORR_SCHEME -1 # Riemann solver for OPT__1ST_FLUX_CORR (-1=auto, 0=none, 1=Roe, 2=HLLC, 3=HLLE, 4=HLLD) [-1] +DUAL_ENERGY_SWITCH 2.0e-2 # apply dual-energy if E_int/E_kin < DUAL_ENERGY_SWITCH [2.0e-2] ##DUAL_ENERGY ONLY## +OPT__SAME_INTERFACE_B 0 # ensure B field consistency on the shared interfaces between sibling patches (for debugging) [0] ##MHD ONLY## + + +# fluid solver in ELBDM (MODEL==ELBDM only) +ELBDM_MASS 1.0 # particle mass in ev/c^2 (input unit is fixed even when OPT__UNIT or COMOVING is on) +ELBDM_PLANCK_CONST 1.0 # reduced Planck constant (will be overwritten if OPT__UNIT or COMOVING is on) +ELBDM_LAMBDA 1.0 # quartic self-interaction coefficient [1.0] ##QUARTIC_SELF_INTERACTION ONLY## +ELBDM_TAYLOR3_COEFF 0.166666667 # 3rd Taylor expansion coefficient [1.0/6.0] ##USELESS if ELBDM_TAYLOR3_AUTO is on## +ELBDM_TAYLOR3_AUTO 1 # Optimize ELBDM_TAYLOR3_COEFF automatically to minimize the damping at kmax [1] + + +# fluid solvers in all models +FLU_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU fluid solver (<=0=auto) [-1] +GPU_NSTREAM -1 # number of CUDA streams for the asynchronous memory copy in GPU (<=0=auto) [-1] +OPT__FIXUP_FLUX 1 # correct coarse grids by the fine-grid boundary fluxes [1] ##HYDRO and ELBDM ONLY## +OPT__FIXUP_ELECTRIC 1 # correct coarse grids by the fine-grid boundary electric field [1] ##MHD ONLY## +OPT__FIXUP_RESTRICT 1 # correct coarse grids by averaging the fine-grid data [1] +OPT__CORR_AFTER_ALL_SYNC -1 # apply various corrections after all levels are synchronized (see "Flu_CorrAfterAllSync"): + # (-1=auto, 0=off, 1=every step, 2=before dump) [-1] +OPT__NORMALIZE_PASSIVE 1 # ensure "sum(passive_scalar_density) == gas_density" [1] +OPT__INT_FRAC_PASSIVE_LR 1 # convert specified passive scalars to mass fraction during data reconstruction [1] +OPT__OVERLAP_MPI 0 # overlap MPI communication with CPU/GPU computations [0] ##NOT SUPPORTED YET## +OPT__RESET_FLUID 0 # reset fluid variables after each update -> edit "Flu_ResetByUser.cpp" [0] +OPT__RESET_FLUID_INIT -1 # reset fluid variables during initialization (<0=auto -> OPT__RESET_FLUID, 0=off, 1=on) [-1] +OPT__FREEZE_FLUID 0 # do not evolve fluid at all [0] +OPT__CHECK_PRES_AFTER_FLU -1 # check unphysical pressure at the end of the fluid solver (<0=auto) [-1] +OPT__LAST_RESORT_FLOOR 1 # apply floor values as the last resort when the fluid solver fails [1] ##HYDRO and MHD ONLY## +MIN_DENS 1.0e-30 # minimum mass density (must >= 0.0) [0.0] ##HYDRO, MHD, and ELBDM ONLY## +MIN_PRES 1.0e-30 # minimum pressure (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_EINT 1.0e-30 # minimum internal energy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_TEMP 1.0e2 # minimum temperature in K (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +MIN_ENTR 0.0 # minimum entropy (must >= 0.0) [0.0] ##HYDRO and MHD ONLY## +JEANS_MIN_PRES 0 # minimum pressure estimated from the Jeans length [0] ##HYDRO/MHD and GRAVITY ONLY## +JEANS_MIN_PRES_LEVEL -1 # for JEANS_MIN_PRES; ensure Jeans length is resolved by JEANS_MIN_PRES_NCELL*dh[JEANS_MIN_PRES_LEVEL] + # (<0=auto -> MAX_LEVEL) [-1] +JEANS_MIN_PRES_NCELL 4 # for JEANS_MIN_PRES; see JEANS_MIN_PRES_LEVEL [4] + + +# gravity solvers in all models +NEWTON_G 1.0 # gravitational constant (will be overwritten if OPT__UNIT or COMOVING is on) +SOR_OMEGA -1.0 # over-relaxation parameter in SOR: (<0=auto) [-1.0] +SOR_MAX_ITER -1 # maximum number of iterations in SOR: (<0=auto) [-1] +SOR_MIN_ITER -1 # minimum number of iterations in SOR: (<0=auto) [-1] +MG_MAX_ITER -1 # maximum number of iterations in multigrid: (<0=auto) [-1] +MG_NPRE_SMOOTH -1 # number of pre-smoothing steps in multigrid: (<0=auto) [-1] +MG_NPOST_SMOOTH -1 # number of post-smoothing steps in multigrid: (<0=auto) [-1] +MG_TOLERATED_ERROR -1.0 # maximum tolerated error in multigrid (<0=auto) [-1.0] +POT_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU Poisson solver (<=0=auto) [-1] +OPT__GRA_P5_GRADIENT 0 # 5-points gradient in the Gravity solver (must have GRA/USG_GHOST_SIZE_G>=2) [0] +OPT__SELF_GRAVITY 1 # add self-gravity [1] +OPT__EXT_ACC 0 # add external acceleration (0=off, 1=function, 2=table) [0] ##HYDRO ONLY## + # --> 2 (table) is not supported yet +OPT__EXT_POT 0 # add external potential (0=off, 1=function, 2=table) [0] + # --> for 2 (table), edit the corresponding parameters below too + +# tabular external potential +EXT_POT_TABLE_NAME ExtPotTable # external potential table: filename +EXT_POT_TABLE_NPOINT_X 129 # ... : table size (i.e., number of data points) along x/y/z +EXT_POT_TABLE_NPOINT_Y 129 # +EXT_POT_TABLE_NPOINT_Z 129 # +EXT_POT_TABLE_DH_X 0.0078125 # ... : spatial interval between adjacent data points +EXT_POT_TABLE_DH_Y 0.0078125 # +EXT_POT_TABLE_DH_Z 0.0078125 # +EXT_POT_TABLE_EDGEL_X 0.0 # ... : starting x/y/z coordinates +EXT_POT_TABLE_EDGEL_Y 0.0 # +EXT_POT_TABLE_EDGEL_Z 0.0 # +EXT_POT_TABLE_FLOAT8 -1 # ... : double precision (<0=auto -> FLOAT8, 0=off, 1=on) [-1] + # --> not supported yet; use -1 for now +OPT__GRAVITY_EXTRA_MASS 0 # add extra mass source when computing gravity [0] + + +# initialization +OPT__INIT 1 # initialization option: (1=FUNCTION, 2=RESTART, 3=FILE->"UM_IC") +OPT__INIT_BFIELD_BYFILE 0 # initialize the magnetic field from a vector potential disk file named "B_IC" + # (example python script: tool/inits/gen_vec_pot.py) [0] ##MHD ONLY## +RESTART_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for restart [1] +OPT__RESTART_RESET 0 # reset some simulation status parameters (e.g., current step and time) during restart [0] +OPT__UM_IC_LEVEL 0 # starting AMR level in UM_IC [0] +OPT__UM_IC_NLEVEL 1 # number of AMR levels UM_IC [1] --> edit "Input__UM_IC_RefineRegion" if >1 +OPT__UM_IC_NVAR -1 # number of variables in UM_IC: (1~NCOMP_TOTAL; <=0=auto) [HYDRO=5+passive/ELBDM=2] +OPT__UM_IC_FORMAT 1 # data format of UM_IC: (1=vzyx, 2=zyxv; row-major and v=field) [1] +OPT__UM_IC_DOWNGRADE 1 # downgrade UM_IC from level OPT__UM_IC_LEVEL to 0 [1] +OPT__UM_IC_REFINE 1 # refine UM_IC from level OPT__UM_IC_LEVEL to MAX_LEVEL [1] +OPT__UM_IC_LOAD_NRANK 1 # number of parallel I/O (i.e., number of MPI ranks) for loading UM_IC [1] +OPT__INIT_RESTRICT 1 # restrict all data during the initialization [1] +OPT__INIT_GRID_WITH_OMP 1 # enable OpenMP when assigning the initial condition of each grid patch [1] +OPT__GPUID_SELECT -1 # GPU ID selection mode: (-3=Laohu, -2=CUDA, -1=MPI rank, >=0=input) [-1] +INIT_SUBSAMPLING_NCELL 0 # perform sub-sampling during initialization: (0=off, >0=# of sub-sampling cells) [0] + + +# interpolation schemes: (-1=auto, 1=MinMod-3D, 2=MinMod-1D, 3=vanLeer, 4=CQuad, 5=Quad, 6=CQuar, 7=Quar) +OPT__INT_TIME 1 # perform "temporal" interpolation for OPT__DT_LEVEL == 2/3 [1] +OPT__INT_PRIM 1 # switch to primitive variables when the interpolation on conserved variables fails [1] ##HYDRO ONLY## +OPT__INT_PHASE 1 # interpolation on phase (does not support MinMod-1D) [1] ##ELBDM ONLY## +OPT__FLU_INT_SCHEME -1 # ghost-zone fluid variables for the fluid solver [-1] +OPT__REF_FLU_INT_SCHEME -1 # newly allocated fluid variables during grid refinement [-1] +OPT__MAG_INT_SCHEME 4 # ghost-zone magnetic field for the MHD solver (2,3,4,6 only) [4] +OPT__REF_MAG_INT_SCHEME 4 # newly allocated magnetic field during grid refinement (2,3,4,6 only) [4] +OPT__POT_INT_SCHEME 4 # ghost-zone potential for the Poisson solver (only supports 4 & 5) [4] +OPT__RHO_INT_SCHEME 4 # ghost-zone mass density for the Poisson solver [4] +OPT__GRA_INT_SCHEME 4 # ghost-zone potential for the gravity solver (for UNSPLIT_GRAVITY as well) [4] +OPT__REF_POT_INT_SCHEME 4 # newly allocated potential during grid refinement [4] +INT_MONO_COEFF 2.0 # coefficient for ensuring the interpolation monotonicity (1.0~4.0) [2.0] +INT_MONO_COEFF_B 2.0 # coefficient for ensuring the interpolation monotonicity of B field (1.0~4.0) [2.0] ##MHD ONLY## +MONO_MAX_ITER 10 # maximum number of iterations to reduce INT_MONO_COEFF when interpolation fails (0=off) [10] +INT_OPP_SIGN_0TH_ORDER 1 # switch to 0th-order interpolation if adjacent values change signs [HYDRO:1; ELBDM:0] + + +# data dump +OPT__OUTPUT_TOTAL 1 # output the simulation snapshot: (0=off, 1=HDF5, 2=C-binary) [1] +OPT__OUTPUT_PART 1 # output a single line or slice: (0=off, 1=xy, 2=yz, 3=xz, 4=x, 5=y, 6=z, 7=diag) [0] +OPT__OUTPUT_USER 1 # output the user-specified data -> edit "Output_User.cpp" [0] +OPT__OUTPUT_PAR_MODE 0 # output the particle data: (0=off, 1=text-file, 2=C-binary) [0] ##PARTICLE ONLY## +OPT__OUTPUT_BASEPS 0 # output the base-level power spectrum [0] +OPT__OUTPUT_BASE 0 # only output the base-level data [0] ##OPT__OUTPUT_PART ONLY## +OPT__OUTPUT_POT 0 # output gravitational potential [0] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_PAR_DENS 1 # output the particle or total mass density on grids: + # (0=off, 1=particle mass density, 2=total mass density) [1] ##OPT__OUTPUT_TOTAL ONLY## +OPT__OUTPUT_CC_MAG 1 # output **cell-centered** magnetic field (necessary for yt analysis) [1] ##MHD ONLY## +OPT__OUTPUT_PRES 0 # output gas pressure [0] ##HYDRO ONLY## +OPT__OUTPUT_TEMP 0 # output gas temperature [0] ##HYDRO ONLY## +OPT__OUTPUT_ENTR 0 # output gas entropy [0] ##HYDRO ONLY## +OPT__OUTPUT_CS 0 # output sound speed [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVVEL 0 # output divergence(velocity) [0] ##HYDRO ONLY## +OPT__OUTPUT_MACH 0 # output mach number [0] ##HYDRO ONLY## +OPT__OUTPUT_DIVMAG 0 # output |divergence(B)*dh/|B|| [0] ##MHD ONLY## +OPT__OUTPUT_USER_FIELD 0 # output user-defined derived fields [0] -> edit "Flu_DerivedField_User.cpp" +OPT__OUTPUT_MODE 2 # (1=const step, 2=const dt, 3=dump table) -> edit "Input__DumpTable" for 3 +OPT__OUTPUT_RESTART 0 # output data immediately after restart [0] +OUTPUT_STEP 5 # output data every OUTPUT_STEP step ##OPT__OUTPUT_MODE==1 ONLY## +OUTPUT_DT 3.15576e13 # output data every OUTPUT_DT time interval ##OPT__OUTPUT_MODE==2 ONLY## +OUTPUT_WALLTIME -1.0 # output data every OUTPUT_WALLTIME walltime (<=0.0=off) [-1.0] +OUTPUT_WALLTIME_UNIT 0 # unit of OUTPUT_WALLTIME (0=second, 1=minute, 2=hour, 3=day) [0] +OUTPUT_PART_X -1.0 # x coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Y -1.0 # y coordinate for OPT__OUTPUT_PART [-1.0] +OUTPUT_PART_Z -1.0 # z coordinate for OPT__OUTPUT_PART [-1.0] +INIT_DUMPID -1 # set the first dump ID (<0=auto) [-1] + + +# yt inline analysis (SUPPORT_LIBYT only) +YT_SCRIPT yt_inline # yt inline analysis script (do not include the ".py" file extension) +YT_VERBOSE 1 # verbose level of yt: (0=off, 1=info, 2=warning, 3=debug) [1] +YT_FIG_BASENAME Fig # figure basename, use libyt default if not set: (default=Fig%9d) + + +# miscellaneous +OPT__VERBOSE 0 # output the simulation progress in detail [0] +OPT__TIMING_BARRIER -1 # synchronize before timing -> more accurate, but may slow down the run (<0=auto) [-1] +OPT__TIMING_BALANCE 0 # record the max/min elapsed time in various code sections for checking load balance [0] +OPT__TIMING_MPI 0 # record the MPI bandwidth achieved in various code sections [0] ##LOAD_BALANCE ONLY## +OPT__RECORD_NOTE 1 # take notes for the general simulation info [1] +OPT__RECORD_UNPHY 1 # record the number of cells with unphysical results being corrected [1] +OPT__RECORD_MEMORY 1 # record the memory consumption [1] +OPT__RECORD_PERFORMANCE 1 # record the code performance [1] +OPT__MANUAL_CONTROL 1 # support manually dump data or stop run during the runtime + # (by generating the file DUMP_GAMER_DUMP or STOP_GAMER_STOP) [1] +OPT__RECORD_USER 0 # record the user-specified info -> edit "Aux_Record_User.cpp" [0] +OPT__OPTIMIZE_AGGRESSIVE 0 # apply aggressive optimizations (experimental) [0] + + +# checks +OPT__CK_REFINE 0 # check the grid refinement [0] +OPT__CK_PROPER_NESTING 0 # check the proper-nesting condition [0] +OPT__CK_CONSERVATION 0 # check the conservation law [0] +OPT__CK_NORMALIZE_PASSIVE 0 # check the normalization of passive scalars [0] ##OPT__NORMALIZE_PASSIVE ONLY## +OPT__CK_RESTRICT 0 # check the data restriction [0] +OPT__CK_FINITE 0 # check if all variables are finite [0] +OPT__CK_PATCH_ALLOCATE 0 # check if all patches are properly allocated [0] +OPT__CK_FLUX_ALLOCATE 0 # check if all flux arrays are properly allocated [0] ##HYDRO and ELBDM ONLY## +OPT__CK_NEGATIVE 0 # check the negative values: (0=off, 1=density, 2=pressure and entropy, 3=both) [0] ##HYDRO ONLY## +OPT__CK_MEMFREE 1.0 # check the free memory in GB (0=off, >0=threshold) [1.0] +OPT__CK_PARTICLE 0 # check the particle allocation [0] +OPT__CK_INTERFACE_B 0 # check the consistency of patch interface B field [0] ##MHD ONLY## +OPT__CK_DIVERGENCE_B 0 # check the divergence-free constraint on B field (0=off, 1=on, 2=on+verbose) [0] ##MHD ONLY## +OPT__CK_INPUT_FLUID 0 # check the input data of the fluid solver [0] diff --git a/example/test_problem/Hydro/ExactCooling/Input__TestProb b/example/test_problem/Hydro/ExactCooling/Input__TestProb new file mode 100644 index 0000000000..bdb20512c6 --- /dev/null +++ b/example/test_problem/Hydro/ExactCooling/Input__TestProb @@ -0,0 +1,3 @@ +# problem-specific runtime parameters +EC_Temp 10000000.0 # the constant temperature (in K) [1.0e7] +EC_Dens 1.0 # the constant number density (in cm^-3) [1.0] diff --git a/example/test_problem/Hydro/ExactCooling/README b/example/test_problem/Hydro/ExactCooling/README new file mode 100644 index 0000000000..db4d7ad246 --- /dev/null +++ b/example/test_problem/Hydro/ExactCooling/README @@ -0,0 +1,21 @@ +Compilation flags: +======================================== +Enable : HYDRO +Disable: PARTICLE, GRAVITY, MHD + + +Default setup: +======================================== +1. BOX_SIZE = 1 kpc +2. simulation time = 100 Myr +3. Units: in cgs +4. Enable SRC_EXACTCOOLING + + +Note: +======================================== +1. This test problem is for testing the exact cooling scheme (reference: Farber et al. 2018) +2. Modify the source term ExactCooling to have only one branch of the cooling function +3. The analytical solution and simulation error will be recorded in the Record__CoolingErr file when OPT__OUTPUT_USER is enabled. +4. plot_ExactCooling.py is for plotting the evolution of temperature. + diff --git a/example/test_problem/Hydro/ExactCooling/clean.sh b/example/test_problem/Hydro/ExactCooling/clean.sh new file mode 100644 index 0000000000..ea7e49e8cb --- /dev/null +++ b/example/test_problem/Hydro/ExactCooling/clean.sh @@ -0,0 +1,6 @@ +rm -f Record__Note Record__Timing Record__TimeStep Record__PatchCount Record__Dump Record__MemInfo Record__L1Err \ + Record__Conservation Data* stderr stdout log XYslice* YZslice* XZslice* Xline* Yline* Zline* \ + Diag* BaseXYslice* BaseYZslice* BaseXZslice* BaseXline* BaseYline* BaseZline* BaseDiag* \ + PowerSpec_* Particle_* nohup.out Record__Performance Record__TimingMPI_* \ + Record__ParticleCount Record__User Patch_* Record__NCorrUnphy FailedPatchGroup* *.pyc Record__LoadBalance \ + GRACKLE_INFO Record__DivB Record__CoolingErr diff --git a/example/test_problem/Hydro/ExactCooling/plot_ExactCooling.py b/example/test_problem/Hydro/ExactCooling/plot_ExactCooling.py new file mode 100644 index 0000000000..f579461b19 --- /dev/null +++ b/example/test_problem/Hydro/ExactCooling/plot_ExactCooling.py @@ -0,0 +1,23 @@ +import matplotlib.pyplot as plt +import numpy as np + +data = np.loadtxt('Output__Error', skiprows=1) + +time = data[:, 0] +dump_id = data[:, 1] +temp_nume = data[:, 2] +temp_anal = data[:, 3] +err = data[:, 4] +tcool_nume = data[:, 5] +tcool_anal = data[:, 6] + +time /= tcool_anal[0] + +plt.figure(figsize=(6, 4.5)) +plt.plot(time, temp_anal, label='Analytical', linestyle='-', color='black') +plt.scatter(time, temp_nume, label='Numerical', s=7, color='black') +plt.yscale('log') +plt.xlabel(r'time ($t_{cool}$)') +plt.ylabel(r'temperature (K)') +plt.legend() +plt.savefig('evolution_ExactCooling.png', dpi=300) diff --git a/example/test_problem/Template/Input__Parameter b/example/test_problem/Template/Input__Parameter index d7742ab30f..4da242fb8c 100644 --- a/example/test_problem/Template/Input__Parameter +++ b/example/test_problem/Template/Input__Parameter @@ -197,6 +197,10 @@ OPT__LB_EXCHANGE_FATHER 1 # exchange all cells of all father pat # source terms SRC_DELEPTONIZATION 0 # deleptonization (for simulations of stellar core collapse) [0] ##HYDRO ONLY## +SRC_EXACTCOOLING 0 # exact cooling scheme from Gaspari (2009) [0] ##HYDRO ONLY## +SRC_EC_TEF_N 1501 # number of points for lambda(T) sampling in LOG [1501] +SRC_EC_SUBCYCLING 0 # perform subcycling when the cooling time step is small [0] +SRC_EC_DTCOEF 0.5 # the coefficient of the cooling time step [0.5] SRC_USER 0 # user-defined source terms -> edit "Src_User.cpp" [0] SRC_GPU_NPGROUP -1 # number of patch groups sent into the CPU/GPU source-term solver (<=0=auto) [-1] diff --git a/include/CUDA_ConstMemory.h b/include/CUDA_ConstMemory.h index dae82dfdd2..318f05102f 100644 --- a/include/CUDA_ConstMemory.h +++ b/include/CUDA_ConstMemory.h @@ -35,6 +35,10 @@ SET_GLOBAL( __constant__ real c_Mm[3] ); SET_GLOBAL( __constant__ double c_Src_Dlep_AuxArray_Flt[SRC_NAUX_DLEP] ); SET_GLOBAL( __constant__ int c_Src_Dlep_AuxArray_Int[SRC_NAUX_DLEP] ); #endif +#ifdef EXACT_COOLING +SET_GLOBAL( __constant__ double c_Src_EC_AuxArray_Flt[SRC_NAUX_EC] ); +SET_GLOBAL( __constant__ int c_Src_EC_AuxArray_Int[SRC_NAUX_EC] ); +#endif SET_GLOBAL( __constant__ double c_Src_User_AuxArray_Flt[SRC_NAUX_USER] ); SET_GLOBAL( __constant__ int c_Src_User_AuxArray_Int[SRC_NAUX_USER] ); diff --git a/include/Field.h b/include/Field.h index ea1ee399d2..5c81dff134 100644 --- a/include/Field.h +++ b/include/Field.h @@ -29,6 +29,9 @@ SET_GLOBAL( FieldIdx_t Idx_CRay, Idx_Undefined ); #ifdef DUAL_ENERGY SET_GLOBAL( FieldIdx_t Idx_Dual, Idx_Undefined ); #endif +#ifdef EXACT_COOLING +SET_GLOBAL( FieldIdx_t Idx_TCool, Idx_Undefined ); +#endif // Grackle fields SET_GLOBAL( FieldIdx_t Idx_e, Idx_Undefined ); diff --git a/include/Global.h b/include/Global.h index aabea2f5b6..9f33776688 100644 --- a/include/Global.h +++ b/include/Global.h @@ -339,6 +339,10 @@ extern SrcTerms_t SrcTerms; #if ( MODEL == HYDRO ) extern double Src_Dlep_AuxArray_Flt[SRC_NAUX_DLEP]; extern int Src_Dlep_AuxArray_Int[SRC_NAUX_DLEP]; +extern double Src_EC_AuxArray_Flt[SRC_NAUX_EC]; +extern int Src_EC_AuxArray_Int[SRC_NAUX_EC]; +// flag for checking whether the tcool field is initialized +extern bool IsInit_tcool[NLEVEL]; #endif extern double Src_User_AuxArray_Flt[SRC_NAUX_USER]; extern int Src_User_AuxArray_Int[SRC_NAUX_USER]; @@ -398,7 +402,6 @@ extern double CR_DIFF_MIN_B; #endif - // 3. CPU (host) arrays for transferring data between CPU and GPU // ============================================================================================================ extern real (*h_Flu_Array_F_In [2])[FLU_NIN ][ CUBE(FLU_NXT) ]; @@ -478,6 +481,12 @@ extern real (*h_SrcDlepProf_Data)[SRC_DLEP_PROF_NBINMAX]; extern real *h_SrcDlepProf_Radius; #endif +#ifdef EXACT_COOLING +extern double *h_SrcEC_TEF_lambda; +extern double *h_SrcEC_TEF_alpha; +extern double *h_SrcEC_TEFc; +#endif + // 4/5. GPU (device) global memory arrays and timers diff --git a/include/HDF5_Typedef.h b/include/HDF5_Typedef.h index edde083e3b..d325920ece 100644 --- a/include/HDF5_Typedef.h +++ b/include/HDF5_Typedef.h @@ -175,6 +175,7 @@ struct Makefile_t int CosmicRay; int EoS; int BarotropicEoS; + int ExactCooling; # elif ( MODEL == ELBDM ) int ELBDMScheme; @@ -683,6 +684,12 @@ struct InputPara_t int Src_Deleptonization; int Src_User; int Src_GPU_NPGroup; + int Src_ExactCooling; +# ifdef EXACT_COOLING + int Src_EC_TEF_N; + int Src_EC_subcycling; + double Src_EC_dtCoef; +# endif // Grackle # ifdef SUPPORT_GRACKLE diff --git a/include/Macro.h b/include/Macro.h index 98e42ef8eb..e0bf7e472b 100644 --- a/include/Macro.h +++ b/include/Macro.h @@ -200,8 +200,15 @@ # define NCOMP_PASSIVE_BUILTIN1 0 # endif +// exact cooling source term +# ifdef EXACT_COOLING +# define NCOMP_PASSIVE_BUILTIN2 1 +# else +# define NCOMP_PASSIVE_BUILTIN2 0 +# endif + // total number of built-in scalars -# define NCOMP_PASSIVE_BUILTIN ( NCOMP_PASSIVE_BUILTIN0 + NCOMP_PASSIVE_BUILTIN1 ) +# define NCOMP_PASSIVE_BUILTIN ( NCOMP_PASSIVE_BUILTIN0 + NCOMP_PASSIVE_BUILTIN1 + NCOMP_PASSIVE_BUILTIN2 ) #endif // #if ( MODEL == HYDRO ) @@ -311,6 +318,13 @@ # define PASSIVE_NEXT_IDX2 ( PASSIVE_NEXT_IDX1 ) # endif +# ifdef EXACT_COOLING +# define TCOOL ( PASSIVE_NEXT_IDX2 ) +# define PASSIVE_NEXT_IDX3 ( TCOOL - 1 ) +# else +# define PASSIVE_NEXT_IDX3 ( PASSIVE_NEXT_IDX2 ) +# endif + #endif // #if ( NCOMP_PASSIVE > 0 ) // field indices of magnetic --> element of [0 ... NCOMP_MAG-1] @@ -347,6 +361,13 @@ # define FLUX_NEXT_IDX2 ( FLUX_NEXT_IDX1 ) # endif +# ifdef EXACT_COOLING +# define FLUX_TCOOL ( FLUX_NEXT_IDX2 ) +# define FLUX_NEXT_IDX3 ( FLUX_TCOOL - 1 ) +# else +# define FLUX_NEXT_IDX3 ( FLUX_NEXT_IDX2 ) +# endif + #endif // #if ( NCOMP_PASSIVE > 0 ) // bitwise field indices @@ -369,6 +390,10 @@ # define _CRAY ( 1L << CRAY ) # endif +# ifdef EXACT_COOLING +# define _TCOOL ( 1L << TCOOL ) +# endif + #endif // #if ( NCOMP_PASSIVE > 0 ) // magnetic field @@ -398,6 +423,10 @@ # define _FLUX_CRAY ( 1L << FLUX_CRAY ) # endif +# ifdef EXACT_COOLING +# define _FLUX_TCOOL ( 1L << FLUX_TCOOL ) +# endif + #endif // #if ( NFLUX_PASSIVE > 0 ) // bitwise indices of derived fields @@ -600,14 +629,15 @@ // particle type macros -// number of particle types (default: 4) -# define PAR_NTYPE 4 +// number of particle types (default: 5) +# define PAR_NTYPE 5 // particle type indices (must be in the range 0<=index as we still rely on these constants (e.g., DENS, DUAL) in the fluid solvers +# ifdef EXACT_COOLING + Idx_TCool = AddField( "TCool", FIXUP_FLUX_NO, FIXUP_REST_NO, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); + if ( Idx_TCool != TCOOL ) Aux_Error( ERROR_INFO, "inconsistent Idx_TCool (%d != %d) !!\n", Idx_TCool, TCOOL ); +# endif + # ifdef COSMIC_RAY Idx_CRay = AddField( "CRay", FIXUP_FLUX_YES, FIXUP_REST_YES, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); if ( Idx_CRay != CRAY ) Aux_Error( ERROR_INFO, "inconsistent Idx_CRay (%d != %d) !!\n", Idx_CRay, CRAY ); @@ -148,7 +153,6 @@ void Init_Field() # endif - // 5. validate if all fields have been set properly if ( NDefinedField != NCOMP_TOTAL ) Aux_Error( ERROR_INFO, "total number of defined fields (%d) != expectation (%d) !!\n" diff --git a/src/Init/Init_Load_Parameter.cpp b/src/Init/Init_Load_Parameter.cpp index 7149d02b3a..bd8927cc73 100644 --- a/src/Init/Init_Load_Parameter.cpp +++ b/src/Init/Init_Load_Parameter.cpp @@ -233,6 +233,12 @@ void Init_Load_Parameter() // source terms ReadPara->Add( "SRC_DELEPTONIZATION", &SrcTerms.Deleptonization, false, Useless_bool, Useless_bool ); + ReadPara->Add( "SRC_EXACTCOOLING", &SrcTerms.ExactCooling, false, Useless_bool, Useless_bool ); +# ifdef EXACT_COOLING + ReadPara->Add( "SRC_EC_TEF_N", &SrcTerms.EC_TEF_N, 1501, 1, NoMax_int ); + ReadPara->Add( "SRC_EC_SUBCYCLING", &SrcTerms.EC_subcycling, false, Useless_bool, Useless_bool ); + ReadPara->Add( "SRC_EC_DTCOEF", &SrcTerms.EC_dtCoef, 0.5, Eps_double, NoMax_double ); +# endif ReadPara->Add( "SRC_USER", &SrcTerms.User, false, Useless_bool, Useless_bool ); // do not check SRC_GPU_NPGROUP since it may be reset by either Init_ResetParameter() or CUAPI_SetMemSize() ReadPara->Add( "SRC_GPU_NPGROUP", &SRC_GPU_NPGROUP, -1, NoMin_int, NoMax_int ); diff --git a/src/Init/Init_TestProb.cpp b/src/Init/Init_TestProb.cpp index 819bc5cd4a..9ea55be21d 100644 --- a/src/Init/Init_TestProb.cpp +++ b/src/Init/Init_TestProb.cpp @@ -26,6 +26,7 @@ void Init_TestProb_Hydro_BarredPot(); void Init_TestProb_Hydro_ParticleTest(); void Init_TestProb_Hydro_CDM_LSS(); void Init_TestProb_Hydro_Zeldovich(); +void Init_TestProb_Hydro_ExactCooling(); void Init_TestProb_Hydro_EnergyPowerSpectrum(); void Init_TestProb_Hydro_CR_SoundWave(); void Init_TestProb_Hydro_CR_ShockTube(); @@ -92,6 +93,7 @@ void Init_TestProb() case TESTPROB_HYDRO_PARTICLE_TEST : Init_TestProb_Hydro_ParticleTest(); break; case TESTPROB_HYDRO_CDM_LSS : Init_TestProb_Hydro_CDM_LSS(); break; case TESTPROB_HYDRO_ZELDOVICH : Init_TestProb_Hydro_Zeldovich(); break; + case TESTPROB_HYDRO_EXACTCOOLING : Init_TestProb_Hydro_ExactCooling(); break; case TESTPROB_HYDRO_ENERGY_POWER_SPECTRUM : Init_TestProb_Hydro_EnergyPowerSpectrum(); break; case TESTPROB_HYDRO_CR_SOUNDWAVE : Init_TestProb_Hydro_CR_SoundWave(); break; case TESTPROB_HYDRO_CR_SHOCKTUBE : Init_TestProb_Hydro_CR_ShockTube(); break; diff --git a/src/Main/Main.cpp b/src/Main/Main.cpp index 70358820de..985f1f904e 100644 --- a/src/Main/Main.cpp +++ b/src/Main/Main.cpp @@ -321,6 +321,11 @@ SrcTerms_t SrcTerms; double Src_Dlep_AuxArray_Flt[SRC_NAUX_DLEP]; int Src_Dlep_AuxArray_Int[SRC_NAUX_DLEP]; #endif +#ifdef EXACT_COOLING +double Src_EC_AuxArray_Flt[SRC_NAUX_EC]; +int Src_EC_AuxArray_Int[SRC_NAUX_EC]; +bool IsInit_tcool[NLEVEL]; +#endif double Src_User_AuxArray_Flt[SRC_NAUX_USER]; int Src_User_AuxArray_Int[SRC_NAUX_USER]; @@ -372,77 +377,77 @@ double CR_DIFF_MIN_B; // 3. CPU (host) arrays for transferring data between CPU and GPU // ======================================================================================================= // (3-1) fluid solver -real (*h_Flu_Array_F_In [2])[FLU_NIN ][ CUBE(FLU_NXT) ] = { NULL, NULL }; -real (*h_Flu_Array_F_Out[2])[FLU_NOUT][ CUBE(PS2) ] = { NULL, NULL }; -real (*h_Flux_Array[2])[9][NFLUX_TOTAL][ SQR(PS2) ] = { NULL, NULL }; -double (*h_Corner_Array_F[2])[3] = { NULL, NULL }; +real (*h_Flu_Array_F_In [2])[FLU_NIN ][ CUBE(FLU_NXT) ] = { NULL, NULL }; +real (*h_Flu_Array_F_Out[2])[FLU_NOUT][ CUBE(PS2) ] = { NULL, NULL }; +real (*h_Flux_Array[2])[9][NFLUX_TOTAL][ SQR(PS2) ] = { NULL, NULL }; +double (*h_Corner_Array_F[2])[3] = { NULL, NULL }; #ifdef DUAL_ENERGY -char (*h_DE_Array_F_Out[2])[ CUBE(PS2) ] = { NULL, NULL }; +char (*h_DE_Array_F_Out[2])[ CUBE(PS2) ] = { NULL, NULL }; #endif #ifdef MHD -real (*h_Mag_Array_F_In [2])[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = { NULL, NULL }; -real (*h_Mag_Array_F_Out[2])[NCOMP_MAG][ PS2P1*SQR(PS2) ] = { NULL, NULL }; -real (*h_Ele_Array [2])[9][NCOMP_ELE][ PS2P1*PS2 ] = { NULL, NULL }; +real (*h_Mag_Array_F_In [2])[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = { NULL, NULL }; +real (*h_Mag_Array_F_Out[2])[NCOMP_MAG][ PS2P1*SQR(PS2) ] = { NULL, NULL }; +real (*h_Ele_Array [2])[9][NCOMP_ELE][ PS2P1*PS2 ] = { NULL, NULL }; #endif #if ( FLU_SCHEME == MHM || FLU_SCHEME == MHM_RP || FLU_SCHEME == CTU ) -real (*h_PriVar) [NCOMP_LR ][ CUBE(FLU_NXT) ] = NULL; -real (*h_Slope_PPM)[3][NCOMP_LR ][ CUBE(N_SLOPE_PPM) ] = NULL; -real (*h_FC_Var) [6][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_VAR) ] = NULL; -real (*h_FC_Flux) [3][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_FLUX) ] = NULL; +real (*h_PriVar) [NCOMP_LR ][ CUBE(FLU_NXT) ] = NULL; +real (*h_Slope_PPM)[3][NCOMP_LR ][ CUBE(N_SLOPE_PPM) ] = NULL; +real (*h_FC_Var) [6][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_VAR) ] = NULL; +real (*h_FC_Flux) [3][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_FLUX) ] = NULL; #ifdef MHD -real (*h_FC_Mag_Half)[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; -real (*h_EC_Ele )[NCOMP_MAG][ CUBE(N_EC_ELE) ] = NULL; +real (*h_FC_Mag_Half)[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; +real (*h_EC_Ele )[NCOMP_MAG][ CUBE(N_EC_ELE) ] = NULL; #endif #endif // FLU_SCHEME #if ( MODEL == ELBDM ) -bool (*h_IsCompletelyRefined[2]) = { NULL, NULL }; +bool (*h_IsCompletelyRefined[2]) = { NULL, NULL }; #endif #if ( ELBDM_SCHEME == ELBDM_HYBRID ) -bool (*h_HasWaveCounterpart[2])[ CUBE(HYB_NXT) ] = { NULL, NULL }; +bool (*h_HasWaveCounterpart[2])[ CUBE(HYB_NXT) ] = { NULL, NULL }; #endif #if ( GRAMFE_SCHEME == GRAMFE_MATMUL ) -gramfe_matmul_float (*h_GramFE_TimeEvo)[ 2*FLU_NXT ] = NULL; +gramfe_matmul_float (*h_GramFE_TimeEvo)[ 2*FLU_NXT ] = NULL; #endif #ifdef GRAVITY // (3-2) Poisson and gravity solver -real (*h_Rho_Array_P [2])[RHO_NXT][RHO_NXT][RHO_NXT] = { NULL, NULL }; -real (*h_Pot_Array_P_In [2])[POT_NXT][POT_NXT][POT_NXT] = { NULL, NULL }; -real (*h_Pot_Array_P_Out [2])[GRA_NXT][GRA_NXT][GRA_NXT] = { NULL, NULL }; -real (*h_Flu_Array_G [2])[GRA_NIN][PS1][PS1][PS1] = { NULL, NULL }; -double (*h_Corner_Array_PGT[2])[3] = { NULL, NULL }; +real (*h_Rho_Array_P [2])[RHO_NXT][RHO_NXT][RHO_NXT] = { NULL, NULL }; +real (*h_Pot_Array_P_In [2])[POT_NXT][POT_NXT][POT_NXT] = { NULL, NULL }; +real (*h_Pot_Array_P_Out [2])[GRA_NXT][GRA_NXT][GRA_NXT] = { NULL, NULL }; +real (*h_Flu_Array_G [2])[GRA_NIN][PS1][PS1][PS1] = { NULL, NULL }; +double (*h_Corner_Array_PGT[2])[3] = { NULL, NULL }; #ifdef DUAL_ENERGY -char (*h_DE_Array_G [2])[PS1][PS1][PS1] = { NULL, NULL }; +char (*h_DE_Array_G [2])[PS1][PS1][PS1] = { NULL, NULL }; #endif #ifdef MHD -real (*h_Emag_Array_G [2])[PS1][PS1][PS1] = { NULL, NULL }; +real (*h_Emag_Array_G [2])[PS1][PS1][PS1] = { NULL, NULL }; #endif -real *h_ExtPotTable = NULL; -void **h_ExtPotGenePtr = NULL; +real *h_ExtPotTable = NULL; +void **h_ExtPotGenePtr = NULL; // (3-3) unsplit gravity correction #ifdef UNSPLIT_GRAVITY -real (*h_Pot_Array_USG_F[2])[ CUBE(USG_NXT_F) ] = { NULL, NULL }; -real (*h_Pot_Array_USG_G[2])[USG_NXT_G][USG_NXT_G][USG_NXT_G] = { NULL, NULL }; -real (*h_Flu_Array_USG_G[2])[GRA_NIN-1][PS1][PS1][PS1] = { NULL, NULL }; +real (*h_Pot_Array_USG_F[2])[ CUBE(USG_NXT_F) ] = { NULL, NULL }; +real (*h_Pot_Array_USG_G[2])[USG_NXT_G][USG_NXT_G][USG_NXT_G] = { NULL, NULL }; +real (*h_Flu_Array_USG_G[2])[GRA_NIN-1][PS1][PS1][PS1] = { NULL, NULL }; #endif #endif // #ifdef GRAVITY // (3-4) Grackle chemistry #ifdef SUPPORT_GRACKLE -real_che (*h_Che_Array[2]) = { NULL, NULL }; -grackle_field_data *Che_FieldData = NULL; +real_che (*h_Che_Array[2]) = { NULL, NULL }; +grackle_field_data *Che_FieldData = NULL; code_units Che_Units; #endif // (3-5) dt solver -real *h_dt_Array_T[2] = { NULL, NULL }; -real (*h_Flu_Array_T[2])[FLU_NIN_T][ CUBE(PS1) ] = { NULL, NULL }; +real *h_dt_Array_T[2] = { NULL, NULL }; +real (*h_Flu_Array_T[2])[FLU_NIN_T][ CUBE(PS1) ] = { NULL, NULL }; #ifdef GRAVITY -real (*h_Pot_Array_T[2])[ CUBE(GRA_NXT) ] = { NULL, NULL }; +real (*h_Pot_Array_T[2])[ CUBE(GRA_NXT) ] = { NULL, NULL }; #endif #ifdef MHD -real (*h_Mag_Array_T[2])[NCOMP_MAG][ PS1P1*SQR(PS1) ] = { NULL, NULL }; +real (*h_Mag_Array_T[2])[NCOMP_MAG][ PS1P1*SQR(PS1) ] = { NULL, NULL }; #endif // (3-6) EoS tables @@ -451,15 +456,20 @@ real *h_EoS_Table[EOS_NTABLE_MAX]; #endif // (3-7) source terms -real (*h_Flu_Array_S_In [2])[FLU_NIN_S ][ CUBE(SRC_NXT) ] = { NULL, NULL }; -real (*h_Flu_Array_S_Out[2])[FLU_NOUT_S][ CUBE(PS1) ] = { NULL, NULL }; +real (*h_Flu_Array_S_In [2])[FLU_NIN_S ][ CUBE(SRC_NXT) ] = { NULL, NULL }; +real (*h_Flu_Array_S_Out[2])[FLU_NOUT_S][ CUBE(PS1) ] = { NULL, NULL }; #ifdef MHD -real (*h_Mag_Array_S_In [2])[NCOMP_MAG][ SRC_NXT_P1*SQR(SRC_NXT) ] = { NULL, NULL }; +real (*h_Mag_Array_S_In [2])[NCOMP_MAG][ SRC_NXT_P1*SQR(SRC_NXT) ] = { NULL, NULL }; #endif -double (*h_Corner_Array_S[2])[3] = { NULL, NULL }; +double (*h_Corner_Array_S[2])[3] = { NULL, NULL }; #if ( MODEL == HYDRO ) -real (*h_SrcDlepProf_Data)[SRC_DLEP_PROF_NBINMAX] = NULL; -real *h_SrcDlepProf_Radius = NULL; +real (*h_SrcDlepProf_Data)[SRC_DLEP_PROF_NBINMAX] = NULL; +real *h_SrcDlepProf_Radius = NULL; +#endif +#ifdef EXACT_COOLING +double *h_SrcEC_TEF_lambda = NULL; +double *h_SrcEC_TEF_alpha = NULL; +double *h_SrcEC_TEFc = NULL; #endif @@ -468,72 +478,72 @@ real *h_SrcDlepProf_Radius = NULL; // ======================================================================================================= #ifdef GPU // (4-1) fluid solver -real (*d_Flu_Array_F_In )[FLU_NIN ][ CUBE(FLU_NXT) ] = NULL; -real (*d_Flu_Array_F_Out)[FLU_NOUT][ CUBE(PS2) ] = NULL; -real (*d_Flux_Array)[9][NFLUX_TOTAL][ SQR(PS2) ] = NULL; -double (*d_Corner_Array_F)[3] = NULL; +real (*d_Flu_Array_F_In )[FLU_NIN ][ CUBE(FLU_NXT) ] = NULL; +real (*d_Flu_Array_F_Out)[FLU_NOUT][ CUBE(PS2) ] = NULL; +real (*d_Flux_Array)[9][NFLUX_TOTAL][ SQR(PS2) ] = NULL; +double (*d_Corner_Array_F)[3] = NULL; #ifdef DUAL_ENERGY -char (*d_DE_Array_F_Out)[ CUBE(PS2) ] = NULL; +char (*d_DE_Array_F_Out)[ CUBE(PS2) ] = NULL; #endif #ifdef MHD -real (*d_Mag_Array_F_In )[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; -real (*d_Mag_Array_F_Out)[NCOMP_MAG][ PS2P1*SQR(PS2) ] = NULL; -real (*d_Ele_Array )[9][NCOMP_ELE][ PS2P1*PS2 ] = NULL; +real (*d_Mag_Array_F_In )[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; +real (*d_Mag_Array_F_Out)[NCOMP_MAG][ PS2P1*SQR(PS2) ] = NULL; +real (*d_Ele_Array )[9][NCOMP_ELE][ PS2P1*PS2 ] = NULL; #endif #if ( FLU_SCHEME == MHM || FLU_SCHEME == MHM_RP || FLU_SCHEME == CTU ) -real (*d_PriVar) [NCOMP_LR ][ CUBE(FLU_NXT) ] = NULL; -real (*d_Slope_PPM)[3][NCOMP_LR ][ CUBE(N_SLOPE_PPM) ] = NULL; -real (*d_FC_Var) [6][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_VAR) ] = NULL; -real (*d_FC_Flux) [3][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_FLUX) ] = NULL; +real (*d_PriVar) [NCOMP_LR ][ CUBE(FLU_NXT) ] = NULL; +real (*d_Slope_PPM)[3][NCOMP_LR ][ CUBE(N_SLOPE_PPM) ] = NULL; +real (*d_FC_Var) [6][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_VAR) ] = NULL; +real (*d_FC_Flux) [3][NCOMP_TOTAL_PLUS_MAG][ CUBE(N_FC_FLUX) ] = NULL; #ifdef MHD -real (*d_FC_Mag_Half)[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; -real (*d_EC_Ele )[NCOMP_MAG][ CUBE(N_EC_ELE) ] = NULL; +real (*d_FC_Mag_Half)[NCOMP_MAG][ FLU_NXT_P1*SQR(FLU_NXT) ] = NULL; +real (*d_EC_Ele )[NCOMP_MAG][ CUBE(N_EC_ELE) ] = NULL; #endif #endif // FLU_SCHEME #if ( MODEL == ELBDM ) -bool (*d_IsCompletelyRefined) = NULL; +bool (*d_IsCompletelyRefined) = NULL; #endif #if ( ELBDM_SCHEME == ELBDM_HYBRID ) -bool (*d_HasWaveCounterpart)[ CUBE(HYB_NXT) ] = NULL; +bool (*d_HasWaveCounterpart)[ CUBE(HYB_NXT) ] = NULL; #endif #if ( GRAMFE_SCHEME == GRAMFE_MATMUL ) -gramfe_matmul_float (*d_Flu_TimeEvo)[ 2*FLU_NXT ] = NULL; +gramfe_matmul_float (*d_Flu_TimeEvo)[ 2*FLU_NXT ] = NULL; #endif #ifdef GRAVITY // (4-2) Poisson and gravity solver -real (*d_Rho_Array_P )[ CUBE(RHO_NXT) ] = NULL; -real (*d_Pot_Array_P_In )[ CUBE(POT_NXT) ] = NULL; -real (*d_Pot_Array_P_Out)[ CUBE(GRA_NXT) ] = NULL; -real (*d_Flu_Array_G )[GRA_NIN][ CUBE(PS1) ] = NULL; -double (*d_Corner_Array_PGT)[3] = NULL; +real (*d_Rho_Array_P )[ CUBE(RHO_NXT) ] = NULL; +real (*d_Pot_Array_P_In )[ CUBE(POT_NXT) ] = NULL; +real (*d_Pot_Array_P_Out)[ CUBE(GRA_NXT) ] = NULL; +real (*d_Flu_Array_G )[GRA_NIN][ CUBE(PS1) ] = NULL; +double (*d_Corner_Array_PGT)[3] = NULL; #ifdef DUAL_ENERGY -char (*d_DE_Array_G )[ CUBE(PS1) ] = NULL; +char (*d_DE_Array_G )[ CUBE(PS1) ] = NULL; #endif #ifdef MHD -real (*d_Emag_Array_G )[ CUBE(PS1) ] = NULL; +real (*d_Emag_Array_G )[ CUBE(PS1) ] = NULL; #endif -real *d_ExtPotTable = NULL; -void **d_ExtPotGenePtr = NULL; +real *d_ExtPotTable = NULL; +void **d_ExtPotGenePtr = NULL; // (4-3) unsplit gravity correction #ifdef UNSPLIT_GRAVITY -real (*d_Pot_Array_USG_F)[ CUBE(USG_NXT_F) ] = NULL; -real (*d_Pot_Array_USG_G)[ CUBE(USG_NXT_G) ] = NULL; -real (*d_Flu_Array_USG_G)[GRA_NIN-1][ CUBE(PS1) ] = NULL; +real (*d_Pot_Array_USG_F)[ CUBE(USG_NXT_F) ] = NULL; +real (*d_Pot_Array_USG_G)[ CUBE(USG_NXT_G) ] = NULL; +real (*d_Flu_Array_USG_G)[GRA_NIN-1][ CUBE(PS1) ] = NULL; #endif #endif // #ifdef GRAVITY // (4-4) Grackle chemistry // (4-5) dt solver -real *d_dt_Array_T = NULL; -real (*d_Flu_Array_T)[FLU_NIN_T][ CUBE(PS1) ] = NULL; +real *d_dt_Array_T = NULL; +real (*d_Flu_Array_T)[FLU_NIN_T][ CUBE(PS1) ] = NULL; #ifdef GRAVITY -real (*d_Pot_Array_T)[ CUBE(GRA_NXT) ] = NULL; +real (*d_Pot_Array_T)[ CUBE(GRA_NXT) ] = NULL; #endif #ifdef MHD -real (*d_Mag_Array_T)[NCOMP_MAG][ PS1P1*SQR(PS1) ] = NULL; +real (*d_Mag_Array_T)[NCOMP_MAG][ PS1P1*SQR(PS1) ] = NULL; #endif // (4-6) EoS tables @@ -542,15 +552,20 @@ real *d_EoS_Table[EOS_NTABLE_MAX]; #endif // (4-7) source terms -real (*d_Flu_Array_S_In )[FLU_NIN_S ][ CUBE(SRC_NXT) ] = NULL; -real (*d_Flu_Array_S_Out)[FLU_NOUT_S][ CUBE(PS1) ] = NULL; +real (*d_Flu_Array_S_In )[FLU_NIN_S ][ CUBE(SRC_NXT) ] = NULL; +real (*d_Flu_Array_S_Out)[FLU_NOUT_S][ CUBE(PS1) ] = NULL; #ifdef MHD -real (*d_Mag_Array_S_In)[NCOMP_MAG ][ SRC_NXT_P1*SQR(SRC_NXT) ] = NULL; +real (*d_Mag_Array_S_In)[NCOMP_MAG ][ SRC_NXT_P1*SQR(SRC_NXT) ] = NULL; #endif -double (*d_Corner_Array_S)[3] = NULL; +double (*d_Corner_Array_S)[3] = NULL; #if ( MODEL == HYDRO ) -real (*d_SrcDlepProf_Data)[SRC_DLEP_PROF_NBINMAX] = NULL; -real *d_SrcDlepProf_Radius = NULL; +real (*d_SrcDlepProf_Data)[SRC_DLEP_PROF_NBINMAX] = NULL; +real *d_SrcDlepProf_Radius = NULL; +#endif +#ifdef EXACT_COOLING +double *d_SrcEC_TEF_lambda = NULL; +double *d_SrcEC_TEF_alpha = NULL; +double *d_SrcEC_TEFc = NULL; #endif #endif // #ifdef GPU diff --git a/src/Makefile_base b/src/Makefile_base index 05a5ff17b0..f773889879 100644 --- a/src/Makefile_base +++ b/src/Makefile_base @@ -306,16 +306,16 @@ endif # SUPPORT_LIBYT # local source terms source files # ------------------------------------------------------------------------------------ GPU_FILE += CUAPI_Asyn_SrcSolver.cu CUSRC_SrcSolver_IterateAllCells.cu CUSRC_Src_Deleptonization.cu \ - CUSRC_Src_User_Template.cu + CUSRC_Src_User_Template.cu CUSRC_Src_ExactCooling.cu CPU_FILE += CPU_SrcSolver.cpp CPU_SrcSolver_IterateAllCells.cpp CPU_Src_Deleptonization.cpp \ - CPU_Src_User_Template.cpp + CPU_Src_User_Template.cpp CPU_Src_ExactCooling.cpp dtSolver_ExactCooling.cpp CPU_FILE += Src_AdvanceDt.cpp Src_Prepare.cpp Src_Close.cpp Src_Init.cpp Src_End.cpp \ Src_WorkBeforeMajorFunc.cpp -vpath %.cu SourceTerms SourceTerms/User_Template SourceTerms/Deleptonization -vpath %.cpp SourceTerms SourceTerms/User_Template SourceTerms/Deleptonization +vpath %.cu SourceTerms SourceTerms/User_Template SourceTerms/Deleptonization SourceTerms/ExactCooling +vpath %.cpp SourceTerms SourceTerms/User_Template SourceTerms/Deleptonization SourceTerms/ExactCooling # Grackle source files (included only if "SUPPORT_GRACKLE" is turned on) diff --git a/src/Miscellaneous/Mis_GetTimeStep.cpp b/src/Miscellaneous/Mis_GetTimeStep.cpp index 322d9e545e..b77f3d7a02 100644 --- a/src/Miscellaneous/Mis_GetTimeStep.cpp +++ b/src/Miscellaneous/Mis_GetTimeStep.cpp @@ -1,5 +1,6 @@ #include "GAMER.h" +extern double Mis_GetTimeStep_ExactCooling( const int lv, const double dTime_dt ); @@ -236,6 +237,25 @@ double Mis_GetTimeStep( const int lv, const double dTime_SyncFaLv, const double # endif +// 1.10 CRITERION TEN : ExactCooling source term ##HYDRO ONLY## +// ============================================================================================================= +# ifdef EXACT_COOLING + if ( SrcTerms.ExactCooling ) + { + double EC_dtCoef = SrcTerms.EC_dtCoef; + if ( SrcTerms.EC_subcycling ) + { + EC_dtCoef = HUGE_NUMBER; +# ifdef GAMER_DEBUG + Aux_Message( stderr, "WARNING : Resetting EC_dtCoef to be HUGE_NUMBER when subcycling is enabled.\n" ); +# endif + } + dTime[NdTime] = EC_dtCoef * dTime_dt * Mis_GetTimeStep_ExactCooling( lv, dTime_dt ); + sprintf( dTime_Name[NdTime++], "%s", "ExactCooling" ); + } +# endif + + // 2. get the minimum time-step from all criteria // ============================================================================================================= diff --git a/src/Output/Output_DumpData_Total_HDF5.cpp b/src/Output/Output_DumpData_Total_HDF5.cpp index 75462ea3e7..38dedd90d8 100644 --- a/src/Output/Output_DumpData_Total_HDF5.cpp +++ b/src/Output/Output_DumpData_Total_HDF5.cpp @@ -79,7 +79,7 @@ Procedure for outputting new variables: //------------------------------------------------------------------------------------------------------- -// Function : Output_DumpData_Total_HDF5 (FormatVersion = 2505) +// Function : Output_DumpData_Total_HDF5 (FormatVersion = 2506) // Description : Output all simulation data in the HDF5 format, which can be used as a restart file // or loaded by YT // @@ -279,6 +279,7 @@ Procedure for outputting new variables: // Input__TestProb parameters in "Info/InputTest" // 2504 : 2025/04/29 --> output OPT__PAR_INIT_CHECK // 2505 : 2025/05/07 --> output PassiveFloor_Var +// 2506 : 2026/01/17 --> output exact-cooling parameters //------------------------------------------------------------------------------------------------------- void Output_DumpData_Total_HDF5( const char *FileName ) { @@ -1667,7 +1668,7 @@ void FillIn_KeyInfo( KeyInfo_t &KeyInfo, const int NFieldStored ) const time_t CalTime = time( NULL ); // calendar time - KeyInfo.FormatVersion = 2505; + KeyInfo.FormatVersion = 2506; KeyInfo.Model = MODEL; KeyInfo.NLevel = NLEVEL; KeyInfo.NCompFluid = NCOMP_FLUID; @@ -2007,6 +2008,12 @@ void FillIn_Makefile( Makefile_t &Makefile ) Makefile.BarotropicEoS = 0; # endif +# ifdef EXACT_COOLING + Makefile.ExactCooling = 1; +# else + Makefile.ExactCooling = 0; +# endif + # elif ( MODEL == ELBDM ) @@ -2671,6 +2678,12 @@ void FillIn_InputPara( InputPara_t &InputPara, const int NFieldStored, char Fiel // source terms InputPara.Src_Deleptonization = SrcTerms.Deleptonization; InputPara.Src_User = SrcTerms.User; + InputPara.Src_ExactCooling = SrcTerms.ExactCooling; +# ifdef EXACT_COOLING + InputPara.Src_EC_TEF_N = SrcTerms.EC_TEF_N; + InputPara.Src_EC_subcycling = SrcTerms.EC_subcycling; + InputPara.Src_EC_dtCoef = SrcTerms.EC_dtCoef; +# endif InputPara.Src_GPU_NPGroup = SRC_GPU_NPGROUP; // Grackle @@ -3141,6 +3154,7 @@ void GetCompound_Makefile( hid_t &H5_TypeID ) H5Tinsert( H5_TypeID, "CosmicRay", HOFFSET(Makefile_t,CosmicRay ), H5T_NATIVE_INT ); H5Tinsert( H5_TypeID, "EoS", HOFFSET(Makefile_t,EoS ), H5T_NATIVE_INT ); H5Tinsert( H5_TypeID, "BarotropicEoS", HOFFSET(Makefile_t,BarotropicEoS ), H5T_NATIVE_INT ); + H5Tinsert( H5_TypeID, "ExactCooling", HOFFSET(Makefile_t,ExactCooling ), H5T_NATIVE_INT ); # elif ( MODEL == ELBDM ) H5Tinsert( H5_TypeID, "ELBDMScheme", HOFFSET(Makefile_t,ELBDMScheme ), H5T_NATIVE_INT ); @@ -3739,6 +3753,12 @@ void GetCompound_InputPara( hid_t &H5_TypeID, const int NFieldStored ) H5Tinsert( H5_TypeID, "Src_Deleptonization", HOFFSET(InputPara_t,Src_Deleptonization ), H5T_NATIVE_INT ); H5Tinsert( H5_TypeID, "Src_User", HOFFSET(InputPara_t,Src_User ), H5T_NATIVE_INT ); H5Tinsert( H5_TypeID, "Src_GPU_NPGroup", HOFFSET(InputPara_t,Src_GPU_NPGroup ), H5T_NATIVE_INT ); + H5Tinsert( H5_TypeID, "Src_ExactCooling", HOFFSET(InputPara_t,Src_ExactCooling ), H5T_NATIVE_INT ); +# ifdef EXACT_COOLING + H5Tinsert( H5_TypeID, "Src_EC_TEF_N", HOFFSET(InputPara_t,Src_EC_TEF_N ), H5T_NATIVE_INT ); + H5Tinsert( H5_TypeID, "Src_EC_subcycling", HOFFSET(InputPara_t,Src_EC_subcycling ), H5T_NATIVE_INT ); + H5Tinsert( H5_TypeID, "Src_EC_dtCoef", HOFFSET(InputPara_t,Src_EC_dtCoef ), H5T_NATIVE_DOUBLE ); +# endif // Grackle # ifdef SUPPORT_GRACKLE diff --git a/src/SourceTerms/CPU_SrcSolver_IterateAllCells.cpp b/src/SourceTerms/CPU_SrcSolver_IterateAllCells.cpp index 728e1d33c7..aff8bec270 100644 --- a/src/SourceTerms/CPU_SrcSolver_IterateAllCells.cpp +++ b/src/SourceTerms/CPU_SrcSolver_IterateAllCells.cpp @@ -114,7 +114,14 @@ void CPU_SrcSolver_IterateAllCells( SrcTerms.Dlep_AuxArrayDevPtr_Flt, SrcTerms.Dlep_AuxArrayDevPtr_Int ); # endif -// (2) user-defined +# ifdef EXACT_COOLING +// (2) exact cooling + if ( SrcTerms.ExactCooling ) + SrcTerms.EC_FuncPtr( fluid, B, &SrcTerms, dt, dh, x, y, z, TimeNew, TimeOld, MinDens, MinPres, MinEint, PassiveFloor, &EoS, + SrcTerms.EC_AuxArrayDevPtr_Flt, SrcTerms.EC_AuxArrayDevPtr_Int ); +# endif + +// (3) user-defined if ( SrcTerms.User ) SrcTerms.User_FuncPtr( fluid, B, &SrcTerms, dt, dh, x, y, z, TimeNew, TimeOld, MinDens, MinPres, MinEint, PassiveFloor, &EoS, SrcTerms.User_AuxArrayDevPtr_Flt, SrcTerms.User_AuxArrayDevPtr_Int ); diff --git a/src/SourceTerms/ExactCooling/CPU_Src_ExactCooling.cpp b/src/SourceTerms/ExactCooling/CPU_Src_ExactCooling.cpp new file mode 100644 index 0000000000..ca92e529e7 --- /dev/null +++ b/src/SourceTerms/ExactCooling/CPU_Src_ExactCooling.cpp @@ -0,0 +1,490 @@ +#include "Global.h" + +#ifdef EXACT_COOLING + + +// external functions and GPU-related set-up +#ifdef __CUDACC__ + +#include "CUFLU.h" +#include "CUDA_CheckError.h" +#include "CUFLU_Shared_FluUtility.cu" +#include "CUDA_ConstMemory.h" +#ifdef DUAL_ENERGY +#include "CUFLU_Shared_DualEnergy.cu" +#endif + +extern double *d_SrcEC_TEF_lambda; +extern double *d_SrcEC_TEF_alpha; +extern double *d_SrcEC_TEFc; + +#endif // #ifdef __CUDACC__ + + +// local function prototypes +#ifndef __CUDACC__ + +void Src_SetAuxArray_ExactCooling( double [], int [] ); +void Src_SetConstMemory_ExactCooling( const double AuxArray_Flt[], const int AuxArray_Int[], + double *&DevPtr_Flt, int *&DevPtr_Int ); +void Src_PassData2GPU_ExactCooling(); +void Src_SetCPUFunc_ExactCooling( SrcFunc_t & ); +#ifdef GPU +void Src_SetGPUFunc_ExactCooling( SrcFunc_t & ); +#endif +#ifdef GPU +void CUAPI_MemFree_ExactCooling(); +#endif +void Src_WorkBeforeMajorFunc_ExactCooling( const int lv, const double TimeNew, const double TimeOld, const double dt, + double AuxArray_Flt[], int AuxArray_Int[] ); +void Src_End_ExactCooling(); + +void Cool_fct( double Dens, double Temp, double* Emis, double* Lambdat, double Z, double cl_moli_mole, double mp ); +#endif // #ifndef __CUDACC__ +GPU_DEVICE static +double TEF( double TEMP, int k, const double TEF_lambda[], const double TEF_alpha[], const double TEFc[], + const double AuxArray_Flt[], const int AuxArray_Int[] ); +GPU_DEVICE static +double TEFinv( double Y, int k, const double TEF_lambda[], const double TEF_alpha[], const double TEFc[], + const double AuxArray_Flt[], const int AuxArray_Int[] ); + + +/******************************************************** +1. Exact-cooling source term + --> Enabled by the runtime option "SRC_EXACTCOOLING" + +2. This file is shared by both CPU and GPU + + CUSRC_Src_ExactCooling.cu -> CPU_Src_ExactCooling.cpp + +3. Four steps are required to implement a source term + + I. Set auxiliary arrays + II. Implement the source-term function + III. [Optional] Add the work to be done every time + before calling the major source-term function + IV. Set initialization functions + +4. The source-term function must be thread-safe and + not use any global variable +********************************************************/ + + + +// ======================= +// I. Set auxiliary arrays +// ======================= + +//------------------------------------------------------------------------------------------------------- +// Function : Src_SetAuxArray_ExactCooling +// Description : Set the auxiliary arrays AuxArray_Flt/Int[] +// +// Note : 1. Invoked by Src_Init_ExactCooling() +// 2. AuxArray_Flt/Int[] have the size of SRC_NAUX_EC defined in Macro.h (default = 10) +// 3. Add "#ifndef __CUDACC__" since this routine is only useful on CPU +// +// Parameter : AuxArray_Flt/Int : Floating-point/Integer arrays to be filled up +// +// Return : AuxArray_Flt/Int[] +//------------------------------------------------------------------------------------------------------- +#ifndef __CUDACC__ +void Src_SetAuxArray_ExactCooling( double AuxArray_Flt[], int AuxArray_Int[] ) +{ + + const int TEF_N = SrcTerms.EC_TEF_N; // number of points for lambda(T) sampling in LOG + const bool subcycling = SrcTerms.EC_subcycling; // whether to use subcycling + const int TEF_int = TEF_N-1; // number of intervals + const double TEF_TN = 1.e14; // == Tref, must be high enough, but affects sampling resolution (Kelvin) + const double TEF_Tmin = MIN_TEMP; // MIN temperature + if ( TEF_Tmin <= 0.0 ) + Aux_Error( ERROR_INFO, "TEF_Tmin (%14.7e) <= 0.0 !!\n", TEF_Tmin ); + const double TEF_dltemp = (log10(TEF_TN) - log10(TEF_Tmin))/TEF_int; // sampling resolution (Kelvin), LOG! + + const double cl_X = 0.7; // mass-fraction of hydrogen + const double cl_Z = 0.018; // metallicity (in Zsun) + const double cl_mol = 1.0/(2*cl_X+0.75*(1-cl_X-cl_Z)+cl_Z*0.5); // mean (total) molecular weights + const double cl_mole = 2.0/(1+cl_X); // mean electron molecular weights + const double cl_moli = 1.0/cl_X; // mean proton molecular weights + const double cl_moli_mole = cl_moli*cl_mole; + +// store them in the aux array + AuxArray_Flt[0] = 1.0/(GAMMA-1.0); + AuxArray_Flt[1] = TEF_TN; + AuxArray_Flt[2] = TEF_Tmin; + AuxArray_Flt[3] = TEF_dltemp; + AuxArray_Flt[4] = cl_Z; + AuxArray_Flt[5] = cl_moli_mole; + AuxArray_Flt[6] = cl_mol; + AuxArray_Flt[7] = MU_NORM/UNIT_M; // mp: proton mass + AuxArray_Flt[8] = (Const_kB/UNIT_E) * (MU_NORM/UNIT_M); // kB*mp + + AuxArray_Int[0] = TEF_N; + AuxArray_Int[1] = subcycling; + +} // FUNCTION : Src_SetAuxArray_ExactCooling +#endif // #ifndef __CUDACC__ + + +// ====================================== +// II. Implement the source-term function +// ====================================== + +//------------------------------------------------------------------------------------------------------- +// Function : Src_ExactCooling +// Description : Major source-term function +// +// Note : 1. Invoked by CPU/GPU_SrcSolver_IterateAllCells() +// 2. See Src_SetAuxArray_ExactCooling() for the values stored in AuxArray_Flt/Int[] +// 3. Shared by both CPU and GPU +// +// Parameter : fluid : Fluid array storing both the input and updated values +// --> Including both active and passive variables +// B : Cell-centered magnetic field +// SrcTerms : Structure storing all source-term variables +// dt : Time interval to advance solution +// dh : Grid size +// x/y/z : Target physical coordinates +// TimeNew : Target physical time to reach +// TimeOld : Physical time before update +// --> This function updates physical time from TimeOld to TimeNew +// MinDens/Pres/Eint : Density, pressure, and internal energy floors +// PassiveFloor : Bitwise flag to specify the passive scalars to be floored +// EoS : EoS object +// AuxArray_* : Auxiliary arrays (see the Note above) +// +// Return : fluid[] +//----------------------------------------------------------------------------------------- +GPU_DEVICE_NOINLINE +static void Src_ExactCooling( real fluid[], const real B[], const SrcTerms_t *SrcTerms, const real dt, + const real dh, const double x, const double y, const double z, + const double TimeNew, const double TimeOld, const real MinDens, + const real MinPres, const real MinEint, const long PassiveFloor, const EoS_t *EoS, + const double AuxArray_Flt[], const int AuxArray_Int[] ) +{ + +// check +# ifdef GAMER_DEBUG + if ( AuxArray_Flt == NULL ) printf( "ERROR : AuxArray_Flt == NULL in %s !!\n", __FUNCTION__ ); + if ( AuxArray_Int == NULL ) printf( "ERROR : AuxArray_Int == NULL in %s !!\n", __FUNCTION__ ); +# endif + +} // FUNCTION : Src_ExactCooling + + + +//------------------------------------------------------------------------------------------------------- +// Function : TEF +// Description : the temporal evolution function (TEF) +// +// Note : TBF +// +// Parameter : TBF +// +// Return : TBF +//----------------------------------------------------------------------------------------- +GPU_DEVICE static +double TEF( double TEMP, int k, const double TEF_lambda[], const double TEF_alpha[], const double TEFc[], + const double AuxArray_Flt[], const int AuxArray_Int[] ) +{ + return 0.0; +} // FUNCTION : TEF + + + +//------------------------------------------------------------------------------------------------------- +// Function : TEFinv +// Description : the INVERSE temporal evolution function (TEF^-1) +// +// Note : TBF +// +// Parameter : TBF +// +// Return : TBF +//----------------------------------------------------------------------------------------- +GPU_DEVICE static +double TEFinv( double Y, int k, const double TEF_lambda[], const double TEF_alpha[], const double TEFc[], + const double AuxArray_Flt[], const int AuxArray_Int[] ) +{ + return 0.0; +} // FUNCTION : TEFinv + + + +// ================================================== +// III. [Optional] Add the work to be done every time +// before calling the major source-term function +// ================================================== + +#ifndef __CUDACC__ +//------------------------------------------------------------------------------------------------------- +// Function : Src_WorkBeforeMajorFunc_ExactCooling +// Description : Specify work to be done every time before calling the major source-term function +// +// Note : 1. Add "#ifndef __CUDACC__" since this routine is only useful on CPU +// +// Parameter : lv : Target refinement level +// TimeNew : Target physical time to reach +// TimeOld : Physical time before update +// --> The major source-term function will update the system from TimeOld to TimeNew +// dt : Time interval to advance solution +// --> Physical coordinates : TimeNew - TimeOld == dt +// Comoving coordinates : TimeNew - TimeOld == delta(scale factor) != dt +// AuxArray_Flt/Int : Auxiliary arrays +// --> Can be used and/or modified here +// --> Must call Src_SetConstMemory_ExactCooling() after modification +// +// Return : AuxArray_Flt/Int[] +//------------------------------------------------------------------------------------------------------- +void Src_WorkBeforeMajorFunc_ExactCooling( const int lv, const double TimeNew, const double TimeOld, const double dt, + double AuxArray_Flt[], int AuxArray_Int[] ) +{ +// nothing to do here +} // FUNCTION : Src_WorkBeforeMajorFunc_ExactCooling +#endif // #ifndef __CUDACC__ + + + +#ifdef __CUDACC__ +//------------------------------------------------------------------------------------------------------- +// Function : Src_PassData2GPU_ExactCooling +// Description : Transfer data to GPU +// +// Note : 1. Invoked by Src_Init_ExactCooling() +// 2. Use synchronous transfer +// +// Parameter : None +// Return : None +// ------------------------------------------------------------------------------------------------------- +void Src_PassData2GPU_ExactCooling() +{ + const long EC_TEF_MemSize = sizeof(double)*SrcTerms.EC_TEF_N; + + CUDA_CHECK_ERROR( cudaMalloc( (void**) &d_SrcEC_TEF_lambda, EC_TEF_MemSize ) ); + CUDA_CHECK_ERROR( cudaMalloc( (void**) &d_SrcEC_TEF_alpha, EC_TEF_MemSize ) ); + CUDA_CHECK_ERROR( cudaMalloc( (void**) &d_SrcEC_TEFc, EC_TEF_MemSize ) ); + +// store the device pointers in SrcTerms when using GPU + SrcTerms.EC_TEF_lambda_DevPtr = d_SrcEC_TEF_lambda; + SrcTerms.EC_TEF_alpha_DevPtr = d_SrcEC_TEF_alpha; + SrcTerms.EC_TEFc_DevPtr = d_SrcEC_TEFc; + +// use synchronous transfer + CUDA_CHECK_ERROR( cudaMemcpy( d_SrcEC_TEF_lambda, h_SrcEC_TEF_lambda, EC_TEF_MemSize, cudaMemcpyHostToDevice ) ); + CUDA_CHECK_ERROR( cudaMemcpy( d_SrcEC_TEF_alpha, h_SrcEC_TEF_alpha, EC_TEF_MemSize, cudaMemcpyHostToDevice ) ); + CUDA_CHECK_ERROR( cudaMemcpy( d_SrcEC_TEFc, h_SrcEC_TEFc, EC_TEF_MemSize, cudaMemcpyHostToDevice ) ); + +} // FUNCTION : Src_PassData2GPU_ExactCooling +#endif // #ifdef __CUDACC__ + + +// ================================ +// IV. Set initialization functions +// ================================ + +#ifdef __CUDACC__ +# define FUNC_SPACE __device__ static +#else +# define FUNC_SPACE static +#endif + +FUNC_SPACE SrcFunc_t SrcFunc_Ptr = Src_ExactCooling; + +//----------------------------------------------------------------------------------------- +// Function : Src_SetCPU/GPUFunc_ExactCooling +// Description : Return the function pointer of the CPU/GPU source-term function +// +// Note : 1. Invoked by Src_Init_ExactCooling() +// 2. Call-by-reference +// +// Parameter : SrcFunc_CPU/GPUPtr : CPU/GPU function pointer to be set +// +// Return : SrcFunc_CPU/GPUPtr +//----------------------------------------------------------------------------------------- +#ifdef __CUDACC__ +__host__ +void Src_SetGPUFunc_ExactCooling( SrcFunc_t &SrcFunc_GPUPtr ) +{ + CUDA_CHECK_ERROR( cudaMemcpyFromSymbol( &SrcFunc_GPUPtr, SrcFunc_Ptr, sizeof(SrcFunc_t) ) ); +} + +#else + +void Src_SetCPUFunc_ExactCooling( SrcFunc_t &SrcFunc_CPUPtr ) +{ + SrcFunc_CPUPtr = SrcFunc_Ptr; +} + +#endif // #ifdef __CUDACC__ ... else ... + + + +#ifdef __CUDACC__ +//------------------------------------------------------------------------------------------------------- +// Function : Src_SetConstMemory_ExactCooling +// Description : Set the constant memory variables on GPU +// +// Note : 1. Adopt the suggested approach for CUDA version >= 5.0 +// 2. Invoked by Src_Init_ExactCooling() and, if necessary, Src_WorkBeforeMajorFunc_ExactCooling() +// 3. SRC_NAUX_EC is defined in Macro.h +// +// Parameter : AuxArray_Flt/Int : Auxiliary arrays to be copied to the constant memory +// DevPtr_Flt/Int : Pointers to store the addresses of constant memory arrays +// +// Return : c_Src_EC_AuxArray_Flt[], c_Src_EC_AuxArray_Int[], DevPtr_Flt, DevPtr_Int +//--------------------------------------------------------------------------------------------------- +void Src_SetConstMemory_ExactCooling( const double AuxArray_Flt[], const int AuxArray_Int[], + double *&DevPtr_Flt, int *&DevPtr_Int ) +{ + +// copy data to constant memory + CUDA_CHECK_ERROR( cudaMemcpyToSymbol( c_Src_EC_AuxArray_Flt, AuxArray_Flt, SRC_NAUX_EC*sizeof(double) ) ); + CUDA_CHECK_ERROR( cudaMemcpyToSymbol( c_Src_EC_AuxArray_Int, AuxArray_Int, SRC_NAUX_EC*sizeof(int ) ) ); + +// obtain the constant-memory pointers + CUDA_CHECK_ERROR( cudaGetSymbolAddress( (void **)&DevPtr_Flt, c_Src_EC_AuxArray_Flt ) ); + CUDA_CHECK_ERROR( cudaGetSymbolAddress( (void **)&DevPtr_Int, c_Src_EC_AuxArray_Int ) ); + +} // FUNCTION : Src_SetConstMemory_ExactCooling +#endif // #ifdef __CUDACC__ + + + +#ifndef __CUDACC__ +//----------------------------------------------------------------------------------------- +// Function : Src_Init_ExactCooling +// Description : Initialize the exact-cooling source term +// +// Note : 1. Set auxiliary arrays by invoking Src_SetAuxArray_*() +// --> Copy to the GPU constant memory and store the associated addresses +// 2. Set the source-term function by invoking Src_SetCPU/GPUFunc_*() +// 3. Invoked by Src_Init() +// 4. Add "#ifndef __CUDACC__" since this routine is only useful on CPU +// +// Parameter : None +// +// Return : None +//----------------------------------------------------------------------------------------- +void Src_Init_ExactCooling() +{ + + Aux_Error( ERROR_INFO, "SRC_EXACTCOOLING is not supported !!\n" ); + +// set the auxiliary arrays + Src_SetAuxArray_ExactCooling( Src_EC_AuxArray_Flt, Src_EC_AuxArray_Int ); + +// copy the auxiliary arrays to the GPU constant memory and store the associated addresses +# ifdef GPU + Src_SetConstMemory_ExactCooling( Src_EC_AuxArray_Flt, Src_EC_AuxArray_Int, + SrcTerms.EC_AuxArrayDevPtr_Flt, SrcTerms.EC_AuxArrayDevPtr_Int ); +# else + SrcTerms.EC_AuxArrayDevPtr_Flt = Src_EC_AuxArray_Flt; + SrcTerms.EC_AuxArrayDevPtr_Int = Src_EC_AuxArray_Int; +# endif + +// set the major source-term function + Src_SetCPUFunc_ExactCooling( SrcTerms.EC_CPUPtr ); + +# ifdef GPU + Src_SetGPUFunc_ExactCooling( SrcTerms.EC_GPUPtr ); + SrcTerms.EC_FuncPtr = SrcTerms.EC_GPUPtr; +# else + SrcTerms.EC_FuncPtr = SrcTerms.EC_CPUPtr; +# endif + + if ( OPT__INIT == INIT_BY_RESTART ) + for (int i=0; i Physical coordinates : dt = physical time interval +// Comoving coordinates : dt = delta(scale_factor) / ( Hubble_parameter*scale_factor^3 ) +// --> We convert dt back to the physical time interval, which equals "delta(scale_factor)" +// in the comoving coordinates, in Mis_GetTimeStep() +// 2. Invoked by Mis_GetTimeStep() using the function pointer "Mis_GetTimeStep_User_Ptr", +// which must be set by a test problem initializer +// 3. Enabled by the runtime option "OPT__DT_USER" +// +// Parameter : lv : Target refinement level +// dTime_dt : dTime/dt (== 1.0 if COMOVING is off) +// +// Return : dt +//------------------------------------------------------------------------------------------------------- +double Mis_GetTimeStep_ExactCooling( const int lv, const double dTime_dt ) +{ + + if ( !SrcTerms.ExactCooling ) return HUGE_NUMBER; + + +// allocate memory for per-thread arrays +# ifdef OPENMP + const int NT = OMP_NTHREAD; // number of OpenMP threads +# else + const int NT = 1; +# endif + + double dt_EC = HUGE_NUMBER; + double *OMP_dt_EC; + + + return dt_EC; + +} // FUNCTION : Mis_GetTimeStep_ExactCooling +#endif // #ifdef EXACT_COOLING diff --git a/src/SourceTerms/Src_AdvanceDt.cpp b/src/SourceTerms/Src_AdvanceDt.cpp index 272497950b..ed0d00ed39 100644 --- a/src/SourceTerms/Src_AdvanceDt.cpp +++ b/src/SourceTerms/Src_AdvanceDt.cpp @@ -40,4 +40,8 @@ void Src_AdvanceDt( const int lv, const double TimeNew, const double TimeOld, co InvokeSolver( SRC_SOLVER, lv, TimeNew, TimeOld, dt, NULL_REAL, SaveSg_Flu, SaveSg_Mag, NULL_INT, OverlapMPI, Overlap_Sync ); +# ifdef EXACT_COOLING + if ( SrcTerms.ExactCooling ) IsInit_tcool[lv] = true; +# endif + } // FUNCTION : Src_AdvanceDt diff --git a/src/SourceTerms/Src_Close.cpp b/src/SourceTerms/Src_Close.cpp index bc1545746d..b23f58b90d 100644 --- a/src/SourceTerms/Src_Close.cpp +++ b/src/SourceTerms/Src_Close.cpp @@ -36,7 +36,22 @@ void Src_Close( const int lv, const int SaveSg_Flu, const real h_Flu_Array_S_Out // update all fluid variables for now memcpy( amr->patch[SaveSg_Flu][lv][PID]->fluid[0][0][0], h_Flu_Array_S_Out[N][0], FLU_NOUT_S*CUBE(PS1)*sizeof(real) ); - } + +# if ( defined GAMER_DEBUG && defined EXACT_COOLING ) + if ( SrcTerms.ExactCooling ) + { + for (int k=0; kpatch[SaveSg_Flu][lv][PID]->fluid[TCOOL][k][j][i]; + + if ( !Aux_IsFinite( TCool ) || TCool <= (real)0.0 ) + Aux_Error( ERROR_INFO, "Unphysical cooling time %14.7e (lv=%d, PID=%d, (i,j,k)=(%d,%d,%d)) !!\n", TCool, lv, PID, i, j, k ); + } + } // if ( SrcTerms.ExactCooling ) +# endif + } // for (int LocalID=0; LocalID<8; LocalID++) } // for (int TID=0; TIDBoxCenter[d]; @@ -71,6 +70,19 @@ void Src_Init() SrcTerms.Dlep_Profile_RadiusDevPtr = NULL; # endif +# ifdef EXACT_COOLING + SrcTerms.EC_FuncPtr = NULL; + SrcTerms.EC_CPUPtr = NULL; +# ifdef GPU + SrcTerms.EC_GPUPtr = NULL; +# endif + SrcTerms.EC_AuxArrayDevPtr_Flt = NULL; + SrcTerms.EC_AuxArrayDevPtr_Int = NULL; + SrcTerms.EC_TEF_lambda_DevPtr = NULL; + SrcTerms.EC_TEF_alpha_DevPtr = NULL; + SrcTerms.EC_TEFc_DevPtr = NULL; +# endif // #ifdef EXACT_COOLING + SrcTerms.User_FuncPtr = NULL; SrcTerms.User_CPUPtr = NULL; # ifdef GPU @@ -96,7 +108,22 @@ void Src_Init() } # endif -// (2) user-specified source term +// (2) exact cooling +# ifdef EXACT_COOLING + if ( SrcTerms.ExactCooling ) + { + Src_Init_ExactCooling(); + +// check if the source-term function is set properly + if ( SrcTerms.EC_FuncPtr == NULL ) Aux_Error( ERROR_INFO, "SrcTerms.EC_FuncPtr == NULL !!\n" ); + if ( SrcTerms.EC_CPUPtr == NULL ) Aux_Error( ERROR_INFO, "SrcTerms.EC_CPUPtr == NULL !!\n" ); +# ifdef GPU + if ( SrcTerms.EC_GPUPtr == NULL ) Aux_Error( ERROR_INFO, "SrcTerms.EC_GPUPtr == NULL !!\n" ); +# endif + } +# endif // #ifdef EXACT_COOLING + +// (3) user-specified source term if ( SrcTerms.User ) { if ( Src_Init_User_Ptr == NULL ) Aux_Error( ERROR_INFO, "Src_Init_User_Ptr == NULL !!\n" ); diff --git a/src/SourceTerms/Src_WorkBeforeMajorFunc.cpp b/src/SourceTerms/Src_WorkBeforeMajorFunc.cpp index 9efbea3e6d..92eb4f60d7 100644 --- a/src/SourceTerms/Src_WorkBeforeMajorFunc.cpp +++ b/src/SourceTerms/Src_WorkBeforeMajorFunc.cpp @@ -7,6 +7,10 @@ void Src_WorkBeforeMajorFunc_Deleptonization( const int lv, const double TimeNew, const double TimeOld, const double dt, double AuxArray_Flt[], int AuxArray_Int[] ); #endif +#ifdef EXACT_COOLING +void Src_WorkBeforeMajorFunc_ExactCooling( const int lv, const double TimeNew, const double TimeOld, const double dt, + double AuxArray_Flt[], int AuxArray_Int[] ); +#endif // this function pointer can be set by a test problem initializer for a user-specified source term void (*Src_WorkBeforeMajorFunc_User_Ptr) ( const int lv, const double TimeNew, const double TimeOld, const double dt, @@ -37,14 +41,20 @@ void (*Src_WorkBeforeMajorFunc_User_Ptr) ( const int lv, const double TimeNew void Src_WorkBeforeMajorFunc( const int lv, const double TimeNew, const double TimeOld, const double dt ) { -// (1) deleptonization # if ( MODEL == HYDRO ) +// (1) deleptonization if ( SrcTerms.Deleptonization ) Src_WorkBeforeMajorFunc_Deleptonization( lv, TimeNew, TimeOld, dt, Src_Dlep_AuxArray_Flt, Src_Dlep_AuxArray_Int ); # endif +# ifdef EXACT_COOLING +// (2) exact cooling + if ( SrcTerms.ExactCooling ) + Src_WorkBeforeMajorFunc_ExactCooling ( lv, TimeNew, TimeOld, dt, + Src_EC_AuxArray_Flt, Src_EC_AuxArray_Int ); +# endif -// (2) user-specified source term +// (3) user-specified source term // --> users may not define Src_WorkBeforeMajorFunc_User_Ptr if ( SrcTerms.User && Src_WorkBeforeMajorFunc_User_Ptr != NULL ) Src_WorkBeforeMajorFunc_User_Ptr ( lv, TimeNew, TimeOld, dt, diff --git a/src/TestProblem/Hydro/ClusterMerger/Aux_Record_ClusterMerger.cpp b/src/TestProblem/Hydro/ClusterMerger/Aux_Record_ClusterMerger.cpp new file mode 100644 index 0000000000..b2223d6be6 --- /dev/null +++ b/src/TestProblem/Hydro/ClusterMerger/Aux_Record_ClusterMerger.cpp @@ -0,0 +1,217 @@ +#include "GAMER.h" + + + + +// problem-specific global variables +// ======================================================================================= +extern int Merger_Coll_NumBHs; + +extern double *CM_BH_Mass; +extern double *CM_BH_Mdot_tot; +extern double *CM_BH_Mdot_hot; +extern double *CM_BH_Mdot_cold; + +extern double *CM_Bondi_SinkMass; +extern double *CM_Bondi_SinkMomX; +extern double *CM_Bondi_SinkMomY; +extern double *CM_Bondi_SinkMomZ; +extern double *CM_Bondi_SinkMomXAbs; +extern double *CM_Bondi_SinkMomYAbs; +extern double *CM_Bondi_SinkMomZAbs; +extern double *CM_Bondi_SinkE; +extern double *CM_Bondi_SinkEk; +extern double *CM_Bondi_SinkEt; +extern int *CM_Bondi_SinkNCell; + +extern double (*CM_RAcc_GasVel)[3]; +extern double *CM_RAcc_SoundSpeed; +extern double *CM_RAcc_GasDens; +extern double *CM_RAcc_RelativeVel; +extern double *CM_RAcc_ColdGasMass; +extern double (*CM_Jet_Vec)[3]; +extern double *CM_Jet_Mdot; +extern double *CM_Jet_Pdot; +extern double *CM_Jet_Edot; +extern double *E_inj_exp; +extern double *M_inj_exp; +extern double (*CM_ClusterCen)[3]; +extern double (*CM_BH_Vel)[3]; +extern int *CM_Cluster_NPar_close; +// ======================================================================================= + + + +//------------------------------------------------------------------------------------------------------- +// Function : Aux_Record_ClusterMerger +// Description : Record the cluster centers +// +// Note : 1. Invoked by main() using the function pointer "Aux_Record_User_Ptr", +// which must be set by a test problem initializer +// 2. Enabled by the runtime option "OPT__RECORD_USER" +// 3. This function will be called both during the program initialization and after each full update +// 4. Must enable Merger_Coll_LabelCenter +// +// Parameter : None +//------------------------------------------------------------------------------------------------------- +void Aux_Record_ClusterMerger() +{ + + const char FileName[] = "Record__ClusterCenter"; + static bool FirstTime = true; + +// header + if ( FirstTime ) + { + if ( MPI_Rank == 0 ) + { + if ( Aux_CheckFileExist( FileName ) ) + Aux_Message( stderr, "WARNING : file \"%s\" already exists !!\n", FileName ); + + FILE *File_User = fopen( FileName, "a" ); + fprintf( File_User, "# ClusterCen_x/y/z : BH position\n" ); + fprintf( File_User, "# BHVel_? : BH velocity [km/s]\n" ); + fprintf( File_User, "# GasVel_? : Gas velocity\n" ); + fprintf( File_User, "# RelativeVel : Relative velocity between BH and gas for each cluster inside the accretion radius\n" ); + fprintf( File_User, "# SoundSpeed : Average sound speed inside the accreiton radius\n" ); + fprintf( File_User, "# GasDens : Average gas density inside the accreiton radius [cgs]\n" ); + fprintf( File_User, "# mass_BH : BH mass [MSun]\n" ); + fprintf( File_User, "# Mdot_?_BH : BH accretion rate [cgs]\n" ); + fprintf( File_User, "# NVoidCell : Total number of finest cells within the feedback region\n" ); + fprintf( File_User, "# Mom?Inj : Total momentum change in the feedback region [cgs]\n" ); + fprintf( File_User, "# Mom?InjAbs : Total |momentum| change in the feedback region\n" ); + fprintf( File_User, "# EInj_exp : The expected amount of injected energy in the feedback region [erg]\n" ); + fprintf( File_User, "# E_Inj : Total injected energy in the feedback region [erg]\n" ); + fprintf( File_User, "# E_Inj_err : The relative error of the total injected energy\n" ); + fprintf( File_User, "# Ek_Inj : Total injected kinetic energy in the feedback region [erg]\n" ); + fprintf( File_User, "# Et_Inj : Total injected thermal energy in the feedback region [erg]\n" ); + fprintf( File_User, "# PowerInj : Toral injected power in the feedback region [cgs]\n" ); + fprintf( File_User, "# MInjexp : The expected amount of injected gas mass in the feedback region [Msun]\n" ); + fprintf( File_User, "# MassInj : Total mass change in the feedback region [Msun]\n" ); + fprintf( File_User, "# M_Inj_err : The relative error of the total injected mass\n" ); + fprintf( File_User, "# Mdot_Inj : The feedback injeciton rate of mass [cgs]\n" ); + fprintf( File_User, "# Pdot_Inj : The feedback injeciton rate of momentum [cgs]\n" ); + fprintf( File_User, "# Edot_Inj : The feedback injeciton rate of total energy [cgs]\n" ); + fprintf( File_User, "# Jet_Vec_? : Jet inject direction\n" ); + fprintf( File_User, "# num_par_sum : Total number of particles inside the accretion region\n" ); + fprintf( File_User, "# ColdGasMass : Cold gas mass inside the accretion radius [Msun]\n" ); + fprintf( File_User, "#\n" ); + fprintf( File_User, "#%23s %24s", "[ 1]", "[ 2]"); + const int N_att = 40; + int idx = 3; + for (int c=0; cFluSg[lv] ][lv][PID] +// lv : Refinement level of the targeted patch +// PID : ID of the targeted patch +// Threshold : User-provided threshold for the flag operation, which is loaded from the +// file "Input__Flag_User" +// +// Return : "true" if the flag criteria are satisfied +// "false" if the flag criteria are not satisfied +//------------------------------------------------------------------------------------------------------- +bool Flag_ClusterMerger( const int i, const int j, const int k, const int lv, const int PID, const double *Threshold ) +{ + + static bool FirstTime = true; + + const double dh = amr->dh[lv]; + const double Pos[3] = { amr->patch[0][lv][PID]->EdgeL[0] + (i+0.5)*dh, + amr->patch[0][lv][PID]->EdgeL[1] + (j+0.5)*dh, + amr->patch[0][lv][PID]->EdgeL[2] + (k+0.5)*dh }; + + bool Flag = false; + +// flag cells within the target radius, and if the radius is not resolved with a specific number (Threshold[0]) of cells + for (int c=0; cdh[MAX_LEVEL]; + if ( R_acc/dh_max <= Threshold[0] ) + Aux_Message( stderr, "WARNING : MAX_LEVEL is less than the desired refinement level set in Input__Flag_User!! dh_max = %13.7e\n", dh_max ); + + FirstTime = false; + } // if ( FirstTime ) + + return Flag; + +} // FUNCTION : Flag_ClusterMerger diff --git a/src/TestProblem/Hydro/ClusterMerger/Flu_ResetByUser_ClusterMerger.cpp b/src/TestProblem/Hydro/ClusterMerger/Flu_ResetByUser_ClusterMerger.cpp new file mode 100644 index 0000000000..e0dd48b78d --- /dev/null +++ b/src/TestProblem/Hydro/ClusterMerger/Flu_ResetByUser_ClusterMerger.cpp @@ -0,0 +1,1156 @@ +#include "GAMER.h" + + + +#if ( MODEL == HYDRO && defined GRAVITY && defined MASSIVE_PARTICLES ) +// problem-specific global variables +// ======================================================================================= +// (1) read from Input__TestProb +extern int Merger_Coll_NumHalos; +extern double *CM_BH_Mass; +extern double *Jet_HalfHeight; +extern double *Jet_Radius; + +extern bool AGN_feedback; +extern int Accretion_Mode, JetDirection_case; +extern double eta, eps_f, eps_m, R_acc, R_dep; +extern bool fixBH, AdjustBHPos, AdjustBHVel; +extern double AdjustPeriod; +// --------------------------------------------------------------------------------------- +// (2) read from files +extern int JetDirection_NBin; // number of bins of the jet direction table +extern double *CM_Jet_Time_table; // the time table of jet direction +extern double **CM_Jet_Theta_table; // the theta table of jet direction for 3 clusters +extern double **CM_Jet_Phi_table; // the phi table of jet direction for 3 clusters +// --------------------------------------------------------------------------------------- +// (3) variables to record +extern double (*CM_ClusterCen)[3]; +extern double (*CM_BH_Pos)[3]; // BH position (for updating CM_ClusterCen) +extern double (*CM_BH_Vel)[3]; // BH velocity +extern double *CM_BH_Mdot_tot; // the total accretion rate +extern double *CM_BH_Mdot_hot; // the hot accretion rate +extern double *CM_BH_Mdot_cold; // the cold accretion rate +extern double *CM_Jet_Mdot; // the feedback injection rate +extern double *CM_Jet_Pdot; +extern double *CM_Jet_Edot; +extern double (*CM_Jet_Vec)[3]; // jet direction +extern double (*CM_RAcc_GasVel)[3]; // gas velocity +extern double *CM_RAcc_SoundSpeed; +extern double *CM_RAcc_GasDens; +extern double *CM_RAcc_RelativeVel; // the relative velocity between BH and gas +extern double *CM_RAcc_ColdGasMass; +extern double *CM_RAcc_GasMass; +extern double *CM_RAcc_ParMass; +extern int *CM_Cluster_NPar_close; +extern double *CM_Bondi_SinkMass, *CM_Bondi_SinkMomX, *CM_Bondi_SinkMomY, *CM_Bondi_SinkMomZ; +extern double *CM_Bondi_SinkMomXAbs, *CM_Bondi_SinkMomYAbs, *CM_Bondi_SinkMomZAbs; +extern double *CM_Bondi_SinkE, *CM_Bondi_SinkEk, *CM_Bondi_SinkEt; +extern int *CM_Bondi_SinkNCell; +// --------------------------------------------------------------------------------------- +// (4) other variables +extern double *E_inj_exp; // the expected amount of injected energy +extern double *M_inj_exp; // the expected amount of injected gas mass +extern double (*ang_mom_sum)[3]; +extern int AdjustCount; // count the number of adjustments +extern int Merger_Coll_NumBHs; + +extern FieldIdx_t Idx_ParHalo; + +extern double *Jet_WaveK; // jet wavenumber used in the sin() function to have smooth bidirectional jets +extern double *V_cyl; // the volume of jet source +extern double *M_inj, *P_inj, *E_inj; // the injected density +extern double *normalize_const; // the exact normalization constant + +extern long_par *CM_ClusterIdx_Cur; + +static bool if_overlap = false; +static int merge_index = 0; // record BH 1 merge BH 2 / BH 2 merge BH 1 + +static bool FirstTime = true; +// ======================================================================================= + + +// problem-specific function prototypes +// ======================================================================================= +// (1) external functions +#ifdef MHD +extern double (*MHD_ResetByUser_VecPot_Ptr)( const double x, const double y, const double z, const double Time, + const double dt, const int lv, const char Component, double AuxArray[] ); +extern double (*MHD_ResetByUser_BField_Ptr)( const double x, const double y, const double z, const double Time, + const double dt, const int lv, const char Component, double AuxArray[], + const double B_in, const bool UseVecPot, const real *Ax, const real *Ay, + const real *Az, const int i, const int j, const int k ); +#endif +// --------------------------------------------------------------------------------------- +// (2) internal functions +static void GetClusterCenter( int lv, bool AdjustPos, bool AdjustVel, double Cen_old[][3], double Cen_new[][3], double Cen_Vel[][3] ); +static void SetJetDirection( const double TimeNew, const int lv, const int FluSg ); +// ======================================================================================= + + + +//------------------------------------------------------------------------------------------------------- +// Function : BH_accretion_rate +// Description : Calculate the black hole accretion rate +// +// Note : +// +// Parameter : mode : Accretion mode +// Mdot_tot : Pointer to store the total accretion rate +// Mdot_hot : Pointer to store the hot accretion rate +// Mdot_cold : Pointer to store the cold accretion rate +// r_acc : Accretion radius of the black hole +// mass_BH : Mass of the black hole +// rho_gas : Average gas density within the accretion radius +// cs : Average sound speed within the accretion radius +// v_rel : Relative velocity of the gas within the accretion radius and the black hole +// mass_coldGas : Mass of the cold gas within the accretion radius +// mass_gas : Mass of the gas within the accretion radius +// mass_par : Mass of the particle within the accretion radius +// +// Return : Mdot_tot : Total accretion rate +// Mdot_hot : Hot accretion rate +// Mdot_cold : Cold accretion rate +//------------------------------------------------------------------------------------------------------- +void BH_accretion_rate( const int mode, double *Mdot_tot, double *Mdot_hot, double *Mdot_cold, const double r_acc, + const double mass_BH, const double rho_gas, const double cs, const double v_rel, + const double mass_coldGas, const double mass_gas, const double mass_par ) +{ + + double acc_cold = 0.0, acc_hot = 0.0; + +// hot accretion rate + if ( ( mode == 1 || mode == 3 ) && rho_gas > 0.0 ) + { + acc_hot = 4.0 * M_PI * SQR(NEWTON_G) * SQR(mass_BH) * rho_gas / + pow( SQR(cs) + SQR(v_rel), 1.5 ); + } + +// cold accretion rate + if ( ( mode == 2 || mode == 3 ) && (mass_gas+mass_par) > 0.0 ) + { + const double t_ff = sqrt( 2*CUBE(r_acc) / NEWTON_G / (mass_gas+mass_par) ); + acc_cold = mass_coldGas / t_ff; + } + + *Mdot_tot = acc_hot + acc_cold; + *Mdot_hot = acc_hot; + *Mdot_cold = acc_cold; + +} // FUNCTION : BH_accretion_rate + + + +//------------------------------------------------------------------------------------------------------- +// Function : Flu_ResetByUser_Func_ClusterMerger +// Description : Function to reset the fluid field in the Bondi accretion problem +// +// Note : 1. Invoked by Flu_ResetByUser_API_ClusterMerger() and Hydro_Init_ByFunction_AssignData() using the +// function pointer "Flu_ResetByUser_Func_Ptr" +// --> This function pointer is reset by Init_TestProb_Hydro_ClusterMerger() +// --> Hydro_Init_ByFunction_AssignData(): constructing initial condition +// Flu_ResetByUser_API_ClusterMerger() : after each update +// 2. Input fluid[] stores the original values +// 3. Even when DUAL_ENERGY is adopted, one does NOT need to set the dual-energy variable here +// --> It will be set automatically +// 4. Enabled by the runtime option "OPT__RESET_FLUID" +// +// Parameter : fluid : Fluid array storing both the input (origial) and reset values +// --> Including both active and passive variables +// x/y/z : Target physical coordinates +// Time : Target physical time +// dt : Time interval to advance solution +// lv : Target refinement level +// AuxArray : Auxiliary array +// +// Return : true : This cell has been reset +// false : This cell has not been reset +//------------------------------------------------------------------------------------------------------- +int Flu_ResetByUser_Func_ClusterMerger( real fluid[], const double Emag, const double x, const double y, const double z, + const double Time, const double dt, const int lv, double AuxArray[] ) +{ + + const double Pos[3] = { x, y, z }; + +// (1) SMBH Accretion (note: gas depletion is currently disabled) + double dr2[3][3], r2[3]; + const double V_dep = 4.0 / 3.0 * M_PI * pow( R_dep, 3.0 ); // the volume to remove gas + double D_dep[Merger_Coll_NumBHs]; // the density need to be removed + for (int c=0; c= CM_Jet_Edot[1] ) status = 0; // only inject cluster 1 + else status = 1; // only inject cluster 2 + n_jet = Merger_Coll_NumBHs-1; + } + else // if ( if_overlap ) + { + status = 0; + n_jet = Merger_Coll_NumBHs; + } // if ( if_overlap ) ... else ... + + for (int c=status; c<(n_jet+status); c++) + { +// distance: jet center to mesh + for (int d=0; d<3; d++) Vec_c2m[d] = Pos[d] - CM_ClusterCen[c][d]; + + Dis_c2m = sqrt( SQR(Vec_c2m[0]) + SQR(Vec_c2m[1]) + SQR(Vec_c2m[2]) ); + + Jet_dh = fabs( CM_Jet_Vec[c][0]*Vec_c2m[0] + CM_Jet_Vec[c][1]*Vec_c2m[1] + CM_Jet_Vec[c][2]*Vec_c2m[2] ); + Jet_dr = sqrt( SQR(Dis_c2m) - SQR(Jet_dh) ); + + if ( Jet_dh <= Jet_HalfHeight[c] && Jet_dr <= Jet_Radius[c] ) + { + which_cluster += c+1; + + const bool Check_MinEint_No = false; + +// record the old fluid variables + const real dens_old = fluid[DENS]; +# ifdef MHD + const real emag_old = (real)0.5 * ( SQR(fluid[MAG_OFFSET+0]) + SQR(fluid[MAG_OFFSET+1]) + SQR(fluid[MAG_OFFSET+2]) ); +# else + const real emag_old = (real)0.0; +# endif + const real eint_old = Hydro_Con2Eint( fluid[DENS], fluid[MOMX], fluid[MOMY], fluid[MOMZ], + fluid[ENGY], Check_MinEint_No, NULL_REAL, PassiveFloorMask, emag_old, + NULL, NULL, EoS_AuxArray_Flt, EoS_AuxArray_Int, + h_EoS_Table ); + +// accrete mass + fluid[DENS] += M_inj[c]; + +// transfer into BH frame + fluid[MOMX] -= CM_BH_Vel[c][0]*dens_old; + fluid[MOMY] -= CM_BH_Vel[c][1]*dens_old; + fluid[MOMZ] -= CM_BH_Vel[c][2]*dens_old; + +// use a sine function to make the velocity smooth within the jet from +CM_Jet_Vec to -CM_Jet_Vec + EngySin = E_inj[c]*normalize_const[c]*sin( Jet_WaveK[c]*Jet_dh ); + +// the new momentum is calculated from the old density, new density, old momentum and injected energy +// the momentum injection alters only the component along the jet direction + real P_old_sqr = SQR(fluid[MOMX]) + SQR(fluid[MOMY]) + SQR(fluid[MOMZ]); + real Ekin_old = ( dens_old == 0.0 ) ? (real)0.0 : 0.5*P_old_sqr/dens_old; + real P_new = SQRT( 2*fluid[DENS]*(EngySin + Ekin_old) ); + double JetSign = SIGN( Vec_c2m[0]*CM_Jet_Vec[c][0] + Vec_c2m[1]*CM_Jet_Vec[c][1] + Vec_c2m[2]*CM_Jet_Vec[c][2] ); + + double P_old_perp[3], P_old_para, P_new_para; + P_old_para = fluid[MOMX] * CM_Jet_Vec[c][0] + fluid[MOMY] * CM_Jet_Vec[c][1] + fluid[MOMZ] * CM_Jet_Vec[c][2]; + P_old_perp[0] = fluid[MOMX] - P_old_para * CM_Jet_Vec[c][0]; + P_old_perp[1] = fluid[MOMY] - P_old_para * CM_Jet_Vec[c][1]; + P_old_perp[2] = fluid[MOMZ] - P_old_para * CM_Jet_Vec[c][2]; + P_new_para = SQRT( SQR(P_new) - SQR(P_old_perp[0]) - SQR(P_old_perp[1]) - SQR(P_old_perp[2]) ); + P_new_para *= JetSign; + + fluid[MOMX] = P_new_para * CM_Jet_Vec[c][0] + P_old_perp[0]; + fluid[MOMY] = P_new_para * CM_Jet_Vec[c][1] + P_old_perp[1]; + fluid[MOMZ] = P_new_para * CM_Jet_Vec[c][2] + P_old_perp[2]; + +// transfer back into the rest frame + fluid[MOMX] += CM_BH_Vel[c][0] * fluid[DENS]; + fluid[MOMY] += CM_BH_Vel[c][1] * fluid[DENS]; + fluid[MOMZ] += CM_BH_Vel[c][2] * fluid[DENS]; + + fluid[ENGY] = 0.5 * (SQR(fluid[MOMX]) + SQR(fluid[MOMY]) + SQR(fluid[MOMZ])) / fluid[DENS] + + eint_old + emag_old; + } // if ( Jet_dh <= Jet_HalfHeight[c] && Jet_dr <= Jet_Radius[c] ) + } // for (int c=status; c<(n_jet+status); c++) + + if ( which_cluster >= 3 ) Aux_Error( ERROR_INFO, "Error: which_cluster >= 3!\n" ); + + return which_cluster; + +} // FUNCTION : Flu_ResetByUser_Func_ClusterMerger + + + +//------------------------------------------------------------------------------------------------------- +// Function : Flu_ResetByUser_API_ClusterMerger +// Description : API for resetting the fluid array in the Bondi accretion problem +// +// Note : 1. Enabled by the runtime option "OPT__RESET_FLUID" +// 2. Invoked using the function pointer "Flu_ResetByUser_API_Ptr" +// --> This function pointer is reset by Init_TestProb_Hydro_ClusterMerger() +// 3. Currently does not work with "OPT__OVERLAP_MPI" +// 4. Invoke Flu_ResetByUser_Func_ClusterMerger() directly +// +// Parameter : lv : Target refinement level +// FluSg : Target fluid sandglass +// MagSg : Target B field sandglass +// TimeNew : Current physical time (system has been updated from TimeOld to TimeNew in EvolveLevel()) +// dt : Time interval to advance solution (can be different from TimeNew-TimeOld in COMOVING) +//------------------------------------------------------------------------------------------------------- +void Flu_ResetByUser_API_ClusterMerger( const int lv, const int FluSg, const int MagSg, const double TimeNew, const double dt ) +{ + + const bool CurrentMaxLv = ( NPatchTotal[lv] > 0 && lv == MAX_LEVEL ) ? true : + ( NPatchTotal[lv] > 0 && NPatchTotal[lv+1] == 0 ) ? true : false; + const double dh = amr->dh[lv]; + const double dv = CUBE(dh); +# if ( MODEL == HYDRO && !defined SRHD ) + const real Gamma_m1 = GAMMA - (real)1.0; + const real _Gamma_m1 = (real)1.0 / Gamma_m1; +# endif + +// (1) get the BH position and velocity and adjust them if needed + bool AdjustPosNow = false; + bool AdjustVelNow = false; + +// only adjust the BHs on the current maximum level + if ( CurrentMaxLv && AdjustCount < int(TimeNew/AdjustPeriod) ) + { + if ( AdjustBHPos == true ) AdjustPosNow = true; + if ( AdjustBHVel == true ) AdjustVelNow = true; + AdjustCount += 1; + } // if ( CurrentMaxLv && AdjustCount < int(TimeNew/AdjustPeriod)) + GetClusterCenter( lv, AdjustPosNow, AdjustVelNow, CM_BH_Pos, CM_ClusterCen, CM_BH_Vel ); + + +// (2) decide whether to merge BHs + const double AbsRelPos = DIST_3D_DBL( CM_BH_Pos[0], CM_BH_Pos[1] ); + const double AbsRelVel = DIST_3D_DBL( CM_BH_Vel[0], CM_BH_Vel[1] ); + const double soften = amr->dh[MAX_LEVEL]; + double escape_vel; + if ( AbsRelPos > soften ) + { + escape_vel = sqrt( 2 * NEWTON_G * (CM_BH_Mass[0]+CM_BH_Mass[1]) / AbsRelPos ); + } + else + { + escape_vel = sqrt( 2 * NEWTON_G * (CM_BH_Mass[0]+CM_BH_Mass[1]) / soften ); + } // if ( AbsRelPos > soften ) ... else ... + +// merge the two BHs if they are located within R_acc, and the relative velocity is small enough + if ( Merger_Coll_NumBHs == 2 ) + { + if ( AbsRelPos < R_acc && AbsRelVel < 3*escape_vel ) + { + Merger_Coll_NumBHs -= 1; + if ( CM_BH_Mass[0] >= CM_BH_Mass[1] ) merge_index = 1; // record BH 1 merge BH 2 / BH 2 merge BH 1 + else merge_index = 2; + CM_BH_Mass[0] += CM_BH_Mass[1]; + CM_BH_Mass[1] = 0.0; + +// relabel the BH and DM particles being merged + CM_ClusterIdx_Cur[1] = 0; + for (long p=0; pPar->NPar_AcPlusInac; p++) + { + if ( amr->Par->AttributeInt[Idx_ParHalo][p] != (long_par)1 ) continue; + if ( amr->Par->Mass[p] < (real)0.0 ) continue; + + amr->Par->Type[p] = PTYPE_DARK_MATTER; + } // for (long p=0; pPar->NPar_AcPlusInac; p++) + Aux_Message( stdout, "BHs Merge! In rank %d, TimeNew = %14.8e; merge_index = %d, " + "BHPos1 = %14.8e, %14.8e, %14.8e; BHPos2 = %14.8e, %14.8e, %14.8e; " + "BHVel1 = %14.8e, %14.8e, %14.8e; BHVel2 = %14.8e, %14.8e, %14.8e; " + "AbsRelPos = %14.8e, AbsRelVel = %14.8e, escape_vel = %14.8e.\n", + MPI_Rank, TimeNew, merge_index, + CM_BH_Pos[0][0], CM_BH_Pos[0][1], CM_BH_Pos[0][2], CM_BH_Pos[1][0], CM_BH_Pos[1][1], CM_BH_Pos[1][2], + CM_BH_Vel[0][0], CM_BH_Vel[0][1], CM_BH_Vel[0][2], CM_BH_Vel[1][0], CM_BH_Vel[1][1], CM_BH_Vel[1][2], + AbsRelPos, AbsRelVel, escape_vel ); + } // if ( AbsRelPos < R_acc && AbsRelVel < 3*escape_vel ) + } // if ( Merger_Coll_NumBHs == 2 ) + + + if ( AGN_feedback ) + { +// (3) set the injection parameters +// set the jet direction vector + SetJetDirection( TimeNew, lv, FluSg ); + + +// (4) calculate the accretion and feedback +// reset to 0 since we only want to record the number of void cells **for one sub-step** + for (int c=0; cNPatchComma[lv][1]; PID++) + { + const double x02 = amr->patch[0][lv][PID]->EdgeL[0] + 0.5*dh; + const double y02 = amr->patch[0][lv][PID]->EdgeL[1] + 0.5*dh; + const double z02 = amr->patch[0][lv][PID]->EdgeL[2] + 0.5*dh; + + for (int k=0; kpatch[FluSg][lv][PID]->fluid[v][k][j][i]; + +# ifdef MHD + const real Emag = MHD_GetCellCenteredBEnergyInPatch( lv, PID, i, j, k, MagSg ); +# else + const real Emag = (real)0.0; +# endif + + int status_overlap = 0; + + for (int c=0; c= 3 ) if_overlap_each_rank = true; + + }}} // for (int k=0; kNPatchComma[lv][1]; PID++) + + for (int c=0; cNPatchComma[lv][1]; PID++) + { + const double *EdgeL = amr->patch[0][lv][PID]->EdgeL; + const double *EdgeR = amr->patch[0][lv][PID]->EdgeR; + const double patch_pos[3] = { (EdgeL[0]+EdgeR[0])*0.5, (EdgeL[1]+EdgeR[1])*0.5, (EdgeL[2]+EdgeR[2])*0.5 }; + const double patch_d = sqrt( SQR(EdgeL[0]-EdgeR[0]) + SQR(EdgeL[1]-EdgeR[1]) + SQR(EdgeL[2]-EdgeR[2]) ) * 0.5; + + if ( DIST_SQR_3D( patch_pos, CM_ClusterCen[c] ) > SQR(2*R_acc+patch_d) ) continue; + + for (int p=0; ppatch[0][lv][PID]->NPar; p++) + { + const long ParID = amr->patch[0][lv][PID]->ParList[p]; + const real_par ParM = amr->Par->Mass[ParID]; + const real_par ParPos[3] = { amr->Par->PosX[ParID], amr->Par->PosY[ParID], amr->Par->PosZ[ParID] }; + + if ( DIST_SQR_3D( ParPos, CM_ClusterCen[c] ) > SQR(R_acc) ) continue; + + par_mass += ParM; + } // for (int p=0; ppatch[0][lv][PID]->NPar; p++) + } // for (int PID=0; PIDNPatchComma[lv][1]; PID++) + MPI_Allreduce( &par_mass, &CM_RAcc_ParMass[c], 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD ); + } // if ( Accretion_Mode == 2 || Accretion_Mode == 3 ) + } // for (int c=0; cNPatchComma[lv][1]; PID++) + { + int Reset = 0; + const double x0 = amr->patch[0][lv][PID]->EdgeL[0] + 0.5*dh; + const double y0 = amr->patch[0][lv][PID]->EdgeL[1] + 0.5*dh; + const double z0 = amr->patch[0][lv][PID]->EdgeL[2] + 0.5*dh; + + for (int k=0; kpatch[FluSg][lv][PID]->fluid[v][k][j][i]; + +// backup the unmodified values since we want to record the amount of sunk variables removed at the maximum level + fluid_old[v] = fluid[v]; + } + +# ifdef MHD + const real Emag = MHD_GetCellCenteredBEnergyInPatch( lv, PID, i, j, k, MagSg ); +# else + const real Emag = (real)0.0; +# endif + +// reset this cell + if ( CurrentMaxLv ) Reset = Flu_ResetByUser_Func_ClusterMerger( fluid, Emag, x, y, z, TimeNew, dt, lv, NULL ); + +// operations necessary only when this cell has been reset + if ( Reset != 0 ) + { +# if ( MODEL == HYDRO && !defined SRHD ) +// abort the program instead of applying a density floor + if ( fluid[DENS] < MIN_DENS ) Aux_Error( ERROR_INFO, "Fluid density has reached the floor!\n" ); + +// apply an energy floor + fluid[ENGY] = Hydro_CheckMinEintInEngy( fluid[DENS], fluid[MOMX], fluid[MOMY], fluid[MOMZ], fluid[ENGY], + (real)MIN_EINT, PassiveFloorMask, Emag ); + +// calculate the dual-energy variable +# ifdef DUAL_ENERGY + fluid[DUAL] = Hydro_Con2Dual( fluid[DENS], fluid[MOMX], fluid[MOMY], fluid[MOMZ], fluid[ENGY], Emag, + EoS_DensEint2Pres_CPUPtr, EoS_AuxArray_Flt, EoS_AuxArray_Int, h_EoS_Table ); +# endif + +// floor and normalize passive scalars +# if ( NCOMP_PASSIVE > 0 ) + for (int v=NCOMP_FLUID; vpatch[FluSg][lv][PID]->fluid[v][k][j][i] = fluid[v]; + } // if ( Reset != 0 ) + }}} // i,j,k + } // for (int PID=0; PIDNPatchComma[lv][1]; PID++) + } // if ( AGN_feedback ) + +} // FUNCTION : Flu_ResetByUser_API_ClusterMerger + + + +//------------------------------------------------------------------------------------------------------- +// Function : GetClusterCenter +// Description : Get the cluster centers +// +// Note : 1. Must enable Merger_Coll_LabelCenter +// +// Parameter : lv : Refeinement level to search on +// AdjustPos : If true, adjust the positions of the BHs +// AdjustVel : If true, adjust the velocities of the BHs +// Cen_old : Old BH position array with the shape of [Merger_Coll_NumBHs][3] +// Cen_new : New BH position array with the shape of [Merger_Coll_NumBHs][3] +// Cen_Vel : BH CoM velocity array with the shape of [Merger_Coll_NumBHs][3] +// +// Return : Cen_new, Cen_Vel (passed into and updated by this function) +//------------------------------------------------------------------------------------------------------- +void GetClusterCenter( int lv, bool AdjustPos, bool AdjustVel, double Cen_old[][3], double Cen_new[][3], double Cen_Vel[][3] ) +{ + +// fix the BH position and rest BH + if ( fixBH ) + { + for (int d=0; d<3; d++) Cen_new[0][d] = amr->BoxCenter[d]; + for (int d=0; d<3; d++) Cen_Vel[0][d] = 0.0; + + for (int c=0; c 0 && lv == MAX_LEVEL ) ? true : + ( NPatchTotal[lv] > 0 && NPatchTotal[lv+1] == 0 ) ? true : false; + +// initialize pos_min to be the old center + for (int c=0; cNPatchComma[lv][1]; PID++) + { + const double *EdgeL = amr->patch[0][lv][PID]->EdgeL; + const double *EdgeR = amr->patch[0][lv][PID]->EdgeR; + const double patch_pos[3] = { (EdgeL[0]+EdgeR[0])*0.5, (EdgeL[1]+EdgeR[1])*0.5, (EdgeL[2]+EdgeR[2])*0.5 }; + const double patch_d = DIST_3D_DBL( EdgeL, EdgeR ) * 0.5; + + if ( DIST_SQR_3D( patch_pos, Cen_new_pre[c] ) > SQR(10*R_acc+patch_d) ) continue; + + for (int p=0; ppatch[0][lv][PID]->NPar; p++) + { + const long_par ParID = amr->patch[0][lv][PID]->ParList[p]; + const real_par ParX_tmp = amr->Par->PosX[ParID]; + const real_par ParY_tmp = amr->Par->PosY[ParID]; + const real_par ParZ_tmp = amr->Par->PosZ[ParID]; + const real_par ParM_tmp = amr->Par->Mass[ParID]; + const real_par VelX_tmp = amr->Par->VelX[ParID]; + const real_par VelY_tmp = amr->Par->VelY[ParID]; + const real_par VelZ_tmp = amr->Par->VelZ[ParID]; + const real_par ParPos_tmp[3] = { ParX_tmp, ParY_tmp, ParZ_tmp }; + + if ( CM_ClusterIdx_Cur[amr->Par->AttributeInt[Idx_ParHalo][ParID]] != (long_par)c ) continue; + if ( DIST_SQR_3D( ParPos_tmp, Cen_new_pre[c] ) > SQR(10*R_acc) ) continue; + +// record the mass, position and velocity of this particle + ParX[c][num_par[c]] = ParX_tmp; + ParY[c][num_par[c]] = ParY_tmp; + ParZ[c][num_par[c]] = ParZ_tmp; + ParM[c][num_par[c]] = ParM_tmp; + VelX[c][num_par[c]] = VelX_tmp; + VelY[c][num_par[c]] = VelY_tmp; + VelZ[c][num_par[c]] = VelZ_tmp; + num_par[c] += 1; + + if ( num_par[c] >= N_max[c] ) + { +// increase the new maximum size if needed + N_max[c] = (int)ceil( PARLIST_GROWTH_FACTOR*(num_par[c]+1) ); + ParX[c] = (real_par*)realloc( ParX[c], N_max[c]*sizeof(real_par) ); + ParY[c] = (real_par*)realloc( ParY[c], N_max[c]*sizeof(real_par) ); + ParZ[c] = (real_par*)realloc( ParZ[c], N_max[c]*sizeof(real_par) ); + ParM[c] = (real_par*)realloc( ParM[c], N_max[c]*sizeof(real_par) ); + VelX[c] = (real_par*)realloc( VelX[c], N_max[c]*sizeof(real_par) ); + VelY[c] = (real_par*)realloc( VelY[c], N_max[c]*sizeof(real_par) ); + VelZ[c] = (real_par*)realloc( VelZ[c], N_max[c]*sizeof(real_par) ); + } + } // for (int p=0; ppatch[0][lv][PID]->NPar; p++) + } // for (int PID=0; PIDNPatchComma[lv][1]; PID++) + } // for (int c=0; cdh[MAX_LEVEL]; + double *pote_AllRank = new double [CM_Cluster_NPar_close_max]; + double *pote_ThisRank = new double [CM_Cluster_NPar_close_max]; + for (int c=0; c soften ) pote_ThisRank[i-start] += ParM_sum[c][j] / rel_pos; + else if ( rel_pos <= soften ) pote_ThisRank[i-start] += ParM_sum[c][j] / soften; + } + pote_ThisRank[i-start] *= -NEWTON_G; + } + + int N_recv[MPI_NRank], N_disp[MPI_NRank]; + for (int i=0; i= Pote_min ) continue; + Pote_min = pote_AllRank[i]; + pos_min[c][0] = ParX_sum[c][i]; + pos_min[c][1] = ParY_sum[c][i]; + pos_min[c][2] = ParZ_sum[c][i]; + } + } // for (int c=0; c 1 ) + { + bool all_BH_converged = true; + for (int c=0; c= dis_exp ) all_BH_converged = false; + + converged |= all_BH_converged; + } + + for (int c=0; cPar->NPar_AcPlusInac; p++) + { + if ( amr->Par->Mass[p] < (real_par)0.0 ) continue; + if ( CM_ClusterIdx_Cur[amr->Par->AttributeInt[Idx_ParHalo][p]] != (long_par)c ) continue; + if ( amr->Par->Type[p] != PTYPE_BLACK_HOLE ) continue; + + if ( CurrentMaxLv && AdjustPos ) + { + amr->Par->PosX[p] = pos_min[c][0]; + amr->Par->PosY[p] = pos_min[c][1]; + amr->Par->PosZ[p] = pos_min[c][2]; + } + if ( CurrentMaxLv && AdjustVel ) + { + amr->Par->VelX[p] = DM_Vel[c][0]; + amr->Par->VelY[p] = DM_Vel[c][1]; + amr->Par->VelZ[p] = DM_Vel[c][2]; + } + Cen_Tmp[0] = amr->Par->PosX[p]; + Cen_Tmp[1] = amr->Par->PosY[p]; + Cen_Tmp[2] = amr->Par->PosZ[p]; + Vel_Tmp[0] = amr->Par->VelX[p]; + Vel_Tmp[1] = amr->Par->VelY[p]; + Vel_Tmp[2] = amr->Par->VelZ[p]; + break; + } // for (long p=0; pPar->NPar_AcPlusInac; p++) + +// use MPI_MAX since Cen_Tmp[] is initialized as -inf + MPI_Allreduce( Cen_Tmp, Cen_new[c], 3, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD ); + MPI_Allreduce( Vel_Tmp, Cen_Vel[c], 3, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD ); + } // for (int c=0; cdh[lv]; + const double dv = CUBE(dh); + + for (int c=0; cNPatchComma[lv][1]; PID++) + { + for (int k=0; kpatch[0][lv][PID]->EdgeL[0] + (0.5+i)*dh, + amr->patch[0][lv][PID]->EdgeL[1] + (0.5+j)*dh, + amr->patch[0][lv][PID]->EdgeL[2] + (0.5+k)*dh }; + + for (int c=0; c SQR(R_acc) ) continue; + + double dr[3] = { pos2[0]-CM_ClusterCen[c][0], pos2[1]-CM_ClusterCen[c][1], pos2[2]-CM_ClusterCen[c][2] }; + ang_mom[c][0] += dv * ( dr[1]*amr->patch[FluSg][lv][PID]->fluid[3][k][j][i] - dr[2]*amr->patch[FluSg][lv][PID]->fluid[2][k][j][i] ); + ang_mom[c][1] += dv * ( dr[2]*amr->patch[FluSg][lv][PID]->fluid[1][k][j][i] - dr[0]*amr->patch[FluSg][lv][PID]->fluid[3][k][j][i] ); + ang_mom[c][2] += dv * ( dr[0]*amr->patch[FluSg][lv][PID]->fluid[2][k][j][i] - dr[1]*amr->patch[FluSg][lv][PID]->fluid[1][k][j][i] ); + } // for (int c=0; cNPatchComma[lv][1]; PID++) + + for (int c=0; c -#ifdef SUPPORT_HDF5 -#include "hdf5.h" -#endif + // problem-specific global variables // ======================================================================================= - int Merger_Coll_NumHalos; // number of clusters -static char Merger_File_Prof1[1000]; // profile table of cluster 1 -static char Merger_File_Prof2[1000]; // profile table of cluster 2 -static char Merger_File_Prof3[1000]; // profile table of cluster 3 - char Merger_File_Par1 [1000]; // particle file of cluster 1 - char Merger_File_Par2 [1000]; // particle file of cluster 2 - char Merger_File_Par3 [1000]; // particle file of cluster 3 - bool Merger_Coll_IsGas1; // (true/false) --> does cluster 1 have gas - bool Merger_Coll_IsGas2; // (true/false) --> does cluster 2 have gas - bool Merger_Coll_IsGas3; // (true/false) --> does cluster 3 have gas - bool Merger_Coll_UseMetals; // (true/false) --> do the clusters have a metal field - double Merger_Coll_PosX1; // x-position of the first cluster - double Merger_Coll_PosY1; // y-position of the first cluster - double Merger_Coll_PosX2; // x-position of the second cluster - double Merger_Coll_PosY2; // y-position of the second cluster - double Merger_Coll_PosX3; // x-position of the third cluster - double Merger_Coll_PosY3; // y-position of the third cluster - double Merger_Coll_VelX1; // x-velocity of the first cluster - double Merger_Coll_VelY1; // y-velocity of the first cluster - double Merger_Coll_VelX2; // x-velocity of the second cluster - double Merger_Coll_VelY2; // y-velocity of the second cluster - double Merger_Coll_VelX3; // x-velocity of the third cluster - double Merger_Coll_VelY3; // y-velocity of the third cluster - long NPar_EachCluster[3]; // Number of particles in each cluster - long NPar_AllCluster; // Number of particles in all clusters - -static double *Table_R1 = NULL; // radius of cluster 1 -static double *Table_D1 = NULL; // density of cluster 1 -static double *Table_P1 = NULL; // pressure of cluster 1 -static double *Table_M1 = NULL; // metallicity of cluster 1 - -static double *Table_R2 = NULL; // radius of cluster 2 -static double *Table_D2 = NULL; // density of cluster 2 -static double *Table_P2 = NULL; // pressure of cluster 2 -static double *Table_M2 = NULL; // metallicity of cluster 2 - -static double *Table_R3 = NULL; // radius of cluster 3 -static double *Table_D3 = NULL; // density of cluster 3 -static double *Table_P3 = NULL; // pressure of cluster 3 -static double *Table_M3 = NULL; // metallicity of cluster 3 - -static int Merger_NBin1; // number of radial bins of cluster 1 -static int Merger_NBin2; // number of radial bins of cluster 2 -static int Merger_NBin3; // number of radial bins of cluster 3 - -static FieldIdx_t ColorField1Idx = Idx_Undefined; -static FieldIdx_t ColorField2Idx = Idx_Undefined; -static FieldIdx_t ColorField3Idx = Idx_Undefined; +// (1) read from Input__TestProb + int Merger_Coll_NumHalos; // number of clusters +static char (*Merger_File_Prof)[1000]; // profile table of clusters + char (*Merger_File_Par) [1000]; // particle file of clusters +static bool *Merger_Coll_IsGas; // (true/false) --> does cluster have gas + double (*Merger_Coll_Pos)[3]; // position of clusters + double (*Merger_Coll_Vel)[3]; // velocity of clusters + double *CM_BH_Mass; // black hole mass of clusters + double *Jet_HalfHeight; // half height of the cylinder-shape jet source of clusters + double *Jet_Radius; // radius of the cylinder-shape jet source of clusters + + bool AGN_feedback; // turn on/off (1/0) AGN feedback + int Accretion_Mode; // 1: hot mode; 2: code mode; 3: combine (hot + cold) + double eta; // mass loading factor in jet feedback + double eps_f; // the radiative efficiency in jet feedback + double eps_m; // the fraction of total energy that goes into the thermal energy in jet feedback + double R_acc; // accretion radius: compute the accretion rate + double R_dep; // radius to deplete the accreted gas + int JetDirection_case; // methods for choosing the jet direction + // 1: fixed at x-axis; + // 2: import from table (generate JetDirection.txt) + // 3: align with angular momentum + +static char JetDirection_file[1000]; // jet direction file + + bool Merger_Coll_UseMetals; // (true/false) --> do the clusters have a metal field + bool Merger_Coll_LabelCenter; // (true/false) --> label the particle closest to the center of each cluster + bool AdjustBHPos; // (true/false) --> Adjust the BH position + bool AdjustBHVel; // (true/false) --> Adjust the BH velocity + double AdjustPeriod; // the time interval of adjustment + bool fixBH; // fix the BH at the simulation box center and set its velocity to be zero (1 cluster only) +// --------------------------------------------------------------------------------------- +// (2) read from files +static int *Merger_NBin; // number of radial bins of clusters +static double **Table_R = NULL; // radius of clusters +static double **Table_D = NULL; // density of clusters +static double **Table_P = NULL; // pressure of clusters +static double **Table_M = NULL; // metallicity of clusters + + long *NPar_EachCluster; // number of particles in each cluster + long NPar_AllCluster = 0L; // number of particles in all clusters + + int JetDirection_NBin; // number of bins of the jet direction table +static double *JetDirection = NULL; // jet direction[time/theta_1/phi_1/theta_2/phi_2/theta_3/phi_3] + double *CM_Jet_Time_table; // the time table of jet direction + double **CM_Jet_Theta_table; // the theta table of jet direction for clusters + double **CM_Jet_Phi_table; // the phi table of jet direction for clusters +// --------------------------------------------------------------------------------------- +// (3) variables to record + double (*CM_ClusterCen)[3]; // the center of each cluster + double (*CM_BH_Pos)[3]; // BH position of each cluster + double (*CM_BH_Vel)[3]; // BH velocity of each cluster + double *CM_BH_Mdot_tot; // the total accretion rate of BHs + double *CM_BH_Mdot_hot; // the hot accretion rate of BHs + double *CM_BH_Mdot_cold; // the cold accretion rate of BHs + double *CM_Jet_Mdot; // the feedback injeciton rate of mass + double *CM_Jet_Pdot; // the feedback injeciton rate of momentum + double *CM_Jet_Edot; // the feedback injeciton rate of total energy + double (*CM_Jet_Vec)[3]; // jet direction + double (*CM_RAcc_GasVel)[3]; // average gas velocity inside the accretion radius + double *CM_RAcc_SoundSpeed; // average sound speed inside the accreiton radius + double *CM_RAcc_GasDens; // average gas density inside the accreiton radius + double *CM_RAcc_RelativeVel; // relative velocity between BH and gas for each cluster inside the accretion radius + double *CM_RAcc_ColdGasMass; // cold gas mass inside the accretion radius + double *CM_RAcc_GasMass; // total gas mass inside the accretion radius + double *CM_RAcc_ParMass; // total DM mass inside the accretion radius + int *CM_Cluster_NPar_close; // total number of particles inside the 10 times the accrection radius of each cluster + double *CM_Bondi_SinkMass; // total mass change in the feedback region in one global time-step + double *CM_Bondi_SinkMomX; // total x-momentum change ... + double *CM_Bondi_SinkMomY; // total y-momentum change ... + double *CM_Bondi_SinkMomZ; // total z-momentum change ... + double *CM_Bondi_SinkMomXAbs; // total |x-momentum| change ... + double *CM_Bondi_SinkMomYAbs; // total |y-momentum| change ... + double *CM_Bondi_SinkMomZAbs; // total |z-momentum| change ... + double *CM_Bondi_SinkE; // total injected energy ... + double *CM_Bondi_SinkEk; // total injected kinetic energy ... + double *CM_Bondi_SinkEt; // total injected thermal energy ... + int *CM_Bondi_SinkNCell; // total number of finest cells within the feedback region +// --------------------------------------------------------------------------------------- +// (4) other variables + int AdjustCount = 0; // count the number of adjustments + int Merger_Coll_NumBHs; // number of BHs in the simulation + + double *E_inj_exp; // the expected amount of injected energy + double *M_inj_exp; // the expected amount of injected gas mass + double (*ang_mom_sum)[3]; + + double *Jet_WaveK; // jet wavenumber used in the sin() function to have smooth bidirectional jets + double *V_cyl; // the volume of jet source + double *M_inj; // the injected density + double *P_inj; // the injected momentum + double *E_inj; // the injected energy + double *normalize_const; // the exact normalization constant +#ifdef MASSIVE_PARTICLES + long_par *CM_ClusterIdx_Cur; // the current cluster index +#endif + +static FieldIdx_t *ColorFieldsIdx; +#ifdef MASSIVE_PARTICLES + FieldIdx_t Idx_ParHalo = Idx_Undefined; +#endif // ======================================================================================= // problem-specific function prototypes +// ======================================================================================= +// (1) external functions #ifdef MASSIVE_PARTICLES -FieldIdx_t Idx_ParHalo = Idx_Undefined; - void AddNewParticleAttribute_ClusterMerger(); - -long Read_Particle_Number_ClusterMerger(std::string filename); -void Par_Init_ByFunction_ClusterMerger(const long NPar_ThisRank, - const long NPar_AllRank, - real_par *ParMass, real_par *ParPosX, real_par *ParPosY, real_par *ParPosZ, - real_par *ParVelX, real_par *ParVelY, real_par *ParVelZ, real_par *ParTime, - long_par *ParType, real_par *AllAttributeFlt[PAR_NATT_FLT_TOTAL], - long_par *AllAttributeInt[PAR_NATT_INT_TOTAL] ); +void Par_Init_ByFunction_ClusterMerger( const long NPar_ThisRank, const long NPar_AllRank, + real_par *ParMass, real_par *ParPosX, real_par *ParPosY, real_par *ParPosZ, + real_par *ParVelX, real_par *ParVelY, real_par *ParVelZ, real_par *ParTime, + long_par *ParType, real_par *AllAttributeFlt[PAR_NATT_FLT_TOTAL], + long_par *AllAttributeInt[PAR_NATT_INT_TOTAL] ); #endif -int Read_Num_Points_ClusterMerger(std::string filename); -void Read_Profile_ClusterMerger(std::string filename, std::string fieldname, - double field[]); +void Aux_Record_ClusterMerger(); +bool Flag_ClusterMerger( const int i, const int j, const int k, const int lv, const int PID, const double *Threshold ); void AddNewField_ClusterMerger(); +void Init_User_ClusterMerger(); +int Flu_ResetByUser_Func_ClusterMerger( real fluid[], const double Emag, const double x, const double y, const double z, + const double Time, const double dt, const int lv, double AuxArray[] ); +void Flu_ResetByUser_API_ClusterMerger( const int lv, const int FluSg, const int MagSg, const double TimeNew, const double dt ); +extern void (*Flu_ResetByUser_API_Ptr)( const int lv, const int FluSg, const int MagSg, const double TimeNew, const double dt ); +// --------------------------------------------------------------------------------------- +// (2) internal functions +static void AllocateBHVarArray(); + +#ifdef SUPPORT_HDF5 +static int Read_Num_Points_ClusterMerger( std::string filename ); +static void Read_Profile_ClusterMerger( std::string filename, std::string fieldname, double field[] ); +#ifdef MASSIVE_PARTICLES +static long Read_Particle_Number_ClusterMerger( std::string filename ); +#endif + +static herr_t LoadField( const char *FieldName, void *FieldPtr, const hid_t H5_SetID_Target, + const hid_t H5_TypeID_Target ); +#endif +// ======================================================================================= @@ -180,32 +246,60 @@ void LoadInputTestProb( const LoadParaMode_t load_mode, ReadPara_t *ReadPara, HD // --> note that VARIABLE, DEFAULT, MIN, and MAX must have the same data type // --> some handy constants (e.g., NoMin_int, Eps_float, ...) are defined in "include/ReadPara.h" // --> LOAD_PARA() is defined in "include/TestProb.h" -// *************************************************************************************************************************** -// LOAD_PARA( load_mode, "KEY_IN_THE_FILE", &VARIABLE, DEFAULT, MIN, MAX ); -// *************************************************************************************************************************** - LOAD_PARA( load_mode, "Merger_Coll_NumHalos", &Merger_Coll_NumHalos, 2, 1, 3 ); - LOAD_PARA( load_mode, "Merger_Coll_IsGas1", &Merger_Coll_IsGas1, true, Useless_bool, Useless_bool ); - LOAD_PARA( load_mode, "Merger_Coll_IsGas2", &Merger_Coll_IsGas2, true, Useless_bool, Useless_bool ); - LOAD_PARA( load_mode, "Merger_Coll_IsGas3", &Merger_Coll_IsGas3, true, Useless_bool, Useless_bool ); - LOAD_PARA( load_mode, "Merger_File_Prof1", Merger_File_Prof1, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_File_Par1", Merger_File_Par1, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_File_Prof2", Merger_File_Prof2, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_File_Par2", Merger_File_Par2, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_File_Prof3", Merger_File_Prof3, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_File_Par3", Merger_File_Par3, NoDef_str, Useless_str, Useless_str ); - LOAD_PARA( load_mode, "Merger_Coll_PosX1", &Merger_Coll_PosX1, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_PosY1", &Merger_Coll_PosY1, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_PosX2", &Merger_Coll_PosX2, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_PosY2", &Merger_Coll_PosY2, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_PosX3", &Merger_Coll_PosX3, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_PosY3", &Merger_Coll_PosY3, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelX1", &Merger_Coll_VelX1, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelY1", &Merger_Coll_VelY1, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelX2", &Merger_Coll_VelX2, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelY2", &Merger_Coll_VelY2, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelX3", &Merger_Coll_VelX3, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_VelY3", &Merger_Coll_VelY3, -1.0, NoMin_double, NoMax_double ); - LOAD_PARA( load_mode, "Merger_Coll_UseMetals", &Merger_Coll_UseMetals, true, Useless_bool, Useless_bool ); +// ******************************************************************************************************************************** +// LOAD_PARA( load_mode, "KEY_IN_THE_FILE", &VARIABLE, DEFAULT, MIN, MAX ); +// ******************************************************************************************************************************** + LOAD_PARA( load_mode, "Merger_Coll_NumHalos", &Merger_Coll_NumHalos, 2, 1, 3 ); + for (int c=0; cAdd( "Merger_Coll_NumHalos", &Merger_Coll_NumHalos, 2, 1, 3 ); ReadPara->Read( FileName ); - delete ReadPara; -// Validate that we have the correct number of passive scalars - - if ( Merger_Coll_NumHalos + (int)Merger_Coll_UseMetals != NCOMP_PASSIVE_USER ) - Aux_Error( ERROR_INFO, - "please set NCOMP_PASSIVE_USER (currently %d) == Merger_Coll_NumHalos + Merger_Coll_UseMetals (currently %d) in the Makefile !!\n", NCOMP_PASSIVE_USER, Merger_Coll_NumHalos + (int)Merger_Coll_UseMetals ); +// (1-1-2) allocate runtime parameter memories + Merger_File_Prof = new char [ Merger_Coll_NumHalos ][ 1000 ]; + Merger_File_Par = new char [ Merger_Coll_NumHalos ][ 1000 ]; + Merger_Coll_IsGas = new bool [ Merger_Coll_NumHalos ]; + Merger_Coll_Pos = new double [ Merger_Coll_NumHalos ][ 3 ]; + Merger_Coll_Vel = new double [ Merger_Coll_NumHalos ][ 3 ]; + Jet_HalfHeight = new double [ Merger_Coll_NumHalos ]; + Jet_Radius = new double [ Merger_Coll_NumHalos ]; -// convert to code units - Merger_Coll_PosX1 *= Const_kpc / UNIT_L; - Merger_Coll_PosY1 *= Const_kpc / UNIT_L; - Merger_Coll_PosX2 *= Const_kpc / UNIT_L; - Merger_Coll_PosY2 *= Const_kpc / UNIT_L; - Merger_Coll_PosX3 *= Const_kpc / UNIT_L; - Merger_Coll_PosY3 *= Const_kpc / UNIT_L; - Merger_Coll_VelX1 *= (Const_km/Const_s) / UNIT_V; - Merger_Coll_VelY1 *= (Const_km/Const_s) / UNIT_V; - Merger_Coll_VelX2 *= (Const_km/Const_s) / UNIT_V; - Merger_Coll_VelY2 *= (Const_km/Const_s) / UNIT_V; - Merger_Coll_VelX3 *= (Const_km/Const_s) / UNIT_V; - Merger_Coll_VelY3 *= (Const_km/Const_s) / UNIT_V; - - if ( OPT__INIT != INIT_BY_RESTART ) { - -// (2) load the radial profiles - const std::string filename1(Merger_File_Prof1); - const std::string filename2(Merger_File_Prof2); - const std::string filename3(Merger_File_Prof3); + CM_BH_Mass = new double [ Merger_Coll_NumHalos ]; - // cluster 1 - if ( Merger_Coll_IsGas1 ) { +// (1-1-3) load the rest cluster parameters + ReadPara = new ReadPara_t; - if ( MPI_Rank == 0 ) { - Merger_NBin1 = Read_Num_Points_ClusterMerger(filename1); - Aux_Message(stdout, "num_points1 = %d\n", Merger_NBin1); - } - - MPI_Bcast(&Merger_NBin1, 1, MPI_INT, 0, MPI_COMM_WORLD); - - Table_R1 = new double [Merger_NBin1]; - Table_D1 = new double [Merger_NBin1]; - Table_P1 = new double [Merger_NBin1]; - Table_M1 = new double [Merger_NBin1]; - - if ( MPI_Rank == 0 ) { - Read_Profile_ClusterMerger(filename1, "/fields/radius", Table_R1); - Read_Profile_ClusterMerger(filename1, "/fields/density", Table_D1); - Read_Profile_ClusterMerger(filename1, "/fields/pressure", Table_P1); - if ( Merger_Coll_UseMetals ) - Read_Profile_ClusterMerger(filename1, "/fields/metallicity", Table_M1); - else - for ( int i; i < Merger_NBin1; i++ ) Table_M1[i] = 0.0; - - // convert to code units (assuming the input units are cgs) - for ( int b=0; bRead( FileName ); - MPI_Bcast(Table_R1, Merger_NBin1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_D1, Merger_NBin1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_P1, Merger_NBin1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_M1, Merger_NBin1, MPI_DOUBLE, 0, MPI_COMM_WORLD); + delete ReadPara; - } // if ( Merger_Coll_IsGas1 ) +// validate that we have the correct number of passive scalars + if ( Merger_Coll_NumHalos + (int)Merger_Coll_UseMetals != NCOMP_PASSIVE_USER ) + Aux_Error( ERROR_INFO, "please set NCOMP_PASSIVE_USER (currently %d) == Merger_Coll_NumHalos + Merger_Coll_UseMetals (currently %d) in the Makefile !!\n", + NCOMP_PASSIVE_USER, Merger_Coll_NumHalos + (int)Merger_Coll_UseMetals ); - // cluster 2 - if ( Merger_Coll_NumHalos > 1 && Merger_Coll_IsGas2) { +// set the correct parameters when fixing the BH + if ( Merger_Coll_NumHalos != 1 && fixBH ) + { + fixBH = false; + Aux_Message( stdout, "WARNING! Reset fixBH to be false for multiple clusters!\n" ); + } - if (MPI_Rank == 0) { - Merger_NBin2 = Read_Num_Points_ClusterMerger(filename2); - Aux_Message(stdout, "num_points2 = %d\n", Merger_NBin2); - } + if ( fixBH ) + { + AdjustBHPos = false; + AdjustBHVel = false; + } - MPI_Bcast(&Merger_NBin2, 1, MPI_INT, 0, MPI_COMM_WORLD); +// convert to code units + R_acc *= Const_kpc / UNIT_L; + R_dep *= Const_kpc / UNIT_L; + for (int c=0; c 1 && Merger_Coll_IsGas2 ) + const std::string filename( Merger_File_Prof[c] ); - // cluster 3 - if ( Merger_Coll_NumHalos > 2 && Merger_Coll_IsGas3) { + if ( !Aux_CheckFileExist( Merger_File_Prof[c] ) ) + Aux_Error( ERROR_INFO, "file \"%s\" does not exist !!\n", Merger_File_Prof[c] ); - if ( MPI_Rank == 0 ) { - Merger_NBin3 = Read_Num_Points_ClusterMerger(filename3); - Aux_Message(stdout, "num_points3 = %d\n", Merger_NBin3); + if ( MPI_Rank == 0 ) + { + Merger_NBin[c] = Read_Num_Points_ClusterMerger( filename ); + Aux_Message( stdout, "num_points%d = %d\n", c+1, Merger_NBin[c] ); } - MPI_Bcast(&Merger_NBin3, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast( &Merger_NBin[c], 1, MPI_INT, 0, MPI_COMM_WORLD ); - Table_R3 = new double [Merger_NBin3]; - Table_D3 = new double [Merger_NBin3]; - Table_P3 = new double [Merger_NBin3]; - Table_M3 = new double [Merger_NBin3]; + Table_R[c] = new double [ Merger_NBin[c] ]; + Table_D[c] = new double [ Merger_NBin[c] ]; + Table_P[c] = new double [ Merger_NBin[c] ]; + Table_M[c] = new double [ Merger_NBin[c] ]; - if ( MPI_Rank == 0 ) { - Read_Profile_ClusterMerger(filename3, "/fields/radius", Table_R3); - Read_Profile_ClusterMerger(filename3, "/fields/density", Table_D3); - Read_Profile_ClusterMerger(filename3, "/fields/pressure", Table_P3); + if ( MPI_Rank == 0 ) + { + Read_Profile_ClusterMerger( filename, "/fields/radius", Table_R[c] ); + Read_Profile_ClusterMerger( filename, "/fields/density", Table_D[c] ); + Read_Profile_ClusterMerger( filename, "/fields/pressure", Table_P[c] ); if ( Merger_Coll_UseMetals ) - Read_Profile_ClusterMerger(filename3, "/fields/metallicity", Table_M3); + Read_Profile_ClusterMerger( filename, "/fields/metallicity", Table_M[c] ); else - for ( int i; i < Merger_NBin3; i++ ) Table_M3[i] = 0.0; - // convert to code units (assuming the input units are cgs) - for (int b=0; bBoxCenter[0]; + Merger_Coll_Pos[0][1] = amr->BoxCenter[1]; + Merger_Coll_Vel[0][0] = 0.0; + Merger_Coll_Vel[0][1] = 0.0; + } + for (int c=0; cBoxCenter[2]; + Merger_Coll_Vel[c][2] = 0.0; + } - } - - MPI_Bcast(Table_R3, Merger_NBin3, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_D3, Merger_NBin3, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_P3, Merger_NBin3, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(Table_M3, Merger_NBin3, MPI_DOUBLE, 0, MPI_COMM_WORLD); - - } // if ( Merger_Coll_NumHalos > 2 && Merger_Coll_IsGas3 ) - -// (3) Determine particle number - - // check file existence - if ( !Aux_CheckFileExist(Merger_File_Par1) ) - Aux_Error( ERROR_INFO, "file \"%s\" does not exist !!\n", Merger_File_Par1 ); +// set the number of black holes to be the same as the number of clusters initially + Merger_Coll_NumBHs = Merger_Coll_NumHalos; - if ( Merger_Coll_NumHalos > 1 && !Aux_CheckFileExist(Merger_File_Par2) ) - Aux_Error( ERROR_INFO, "file \"%s\" does not exist !!\n", Merger_File_Par2 ); +// allocate BH related memories + AllocateBHVarArray(); - if ( Merger_Coll_NumHalos > 2 && !Aux_CheckFileExist(Merger_File_Par3) ) - Aux_Error( ERROR_INFO, "file \"%s\" does not exist !!\n", Merger_File_Par3 ); +// set initial values + for (int c=0; c 1 ) { - NPar_EachCluster[1] = Read_Particle_Number_ClusterMerger(pfilename2); - Aux_Message( stdout, " Number of particles in cluster 2 = %ld\n", NPar_EachCluster[1] ); - } else { - NPar_EachCluster[1] = 0; - } + const std::string pfilename( Merger_File_Par[c] ); - if ( Merger_Coll_NumHalos > 2 ) { - NPar_EachCluster[2] = Read_Particle_Number_ClusterMerger(pfilename3); - Aux_Message( stdout, " Number of particles in cluster 3 = %ld\n", NPar_EachCluster[2] ); - } else { - NPar_EachCluster[2] = 0; - } + if ( MPI_Rank == 0 ) + { + NPar_EachCluster[c] = Read_Particle_Number_ClusterMerger( pfilename ); - } + Aux_Message( stdout, " Number of particles in cluster %d = %ld\n", + c+1, NPar_EachCluster[c] ); + } // if ( MPI_Rank == 0 ) - MPI_Bcast(NPar_EachCluster, 3, MPI_LONG, 0, MPI_COMM_WORLD); + MPI_Bcast( &NPar_EachCluster[c], 1, MPI_LONG, 0, MPI_COMM_WORLD ); - NPar_AllCluster = NPar_EachCluster[0] + NPar_EachCluster[1] + NPar_EachCluster[2]; + NPar_AllCluster += NPar_EachCluster[c]; + } // for (int c=0; cPar->NPar_Active_AllRank = NPar_AllCluster; PRINT_RESET_PARA( amr->Par->NPar_Active_AllRank, FORMAT_LONG, "(PAR_NPAR in Input__Parameter)" ); - } // if ( OPT__INIT != INIT_BY_RESTART ) -// (4) reset other general-purpose parameters -// --> a helper macro PRINT_RESET_PARA is defined in Macro.h +// (4) load the jet direction table + if ( AGN_feedback && JetDirection_case == 2 ) + { +// allocate memories + CM_Jet_Theta_table = new double* [ Merger_Coll_NumBHs ]; + CM_Jet_Phi_table = new double* [ Merger_Coll_NumBHs ]; + + const bool RowMajor_No = false; // load data into the column-major order + const bool AllocMem_Yes = true; // allocate memory for JetDirection + const int NCol = 1 + 2*Merger_Coll_NumBHs; // total number of columns to load + // target columns: (time, theta_1, phi_1, ...) + int Col[NCol]; + for (int c=0; c a helper macro PRINT_WARNING is defined in TestProb.h const long End_Step_Default = __INT_MAX__; const double End_T_Default = 10.0*Const_Gyr/UNIT_T; - if ( END_STEP < 0 ) { + if ( END_STEP < 0 ) + { END_STEP = End_Step_Default; PRINT_RESET_PARA( END_STEP, FORMAT_LONG, "" ); } - if ( END_T < 0.0 ) { + if ( END_T < 0.0 ) + { END_T = End_T_Default; PRINT_RESET_PARA( END_T, FORMAT_REAL, "" ); } + if ( Merger_Coll_LabelCenter && !OPT__RECORD_USER ) + { + OPT__RECORD_USER = true; + PRINT_RESET_PARA( OPT__RECORD_USER, FORMAT_BOOL, "" ); + } + -// (4) make a note +// (6) make a note if ( MPI_Rank == 0 ) { Aux_Message( stdout, "=============================================================================\n" ); - Aux_Message( stdout, " test problem ID = %d\n", TESTPROB_ID ); - Aux_Message( stdout, " number of clusters = %d\n", Merger_Coll_NumHalos ); - if ( Merger_Coll_IsGas1 ) - Aux_Message( stdout, " profile file 1 = %s\n", Merger_File_Prof1 ); - Aux_Message( stdout, " particle file 1 = %s\n", Merger_File_Par1 ); - Aux_Message( stdout, " cluster 1 w/ gas = %s\n", (Merger_Coll_IsGas1)? "yes":"no" ); - if ( Merger_Coll_IsGas1 ) - Aux_Message( stdout, " cluster 1 x-position = %g\n", Merger_Coll_PosX1 ); - Aux_Message( stdout, " cluster 1 y-position = %g\n", Merger_Coll_PosY1 ); - Aux_Message( stdout, " cluster 1 x-velocity = %g\n", Merger_Coll_VelX1 ); - Aux_Message( stdout, " cluster 1 y-velocity = %g\n", Merger_Coll_VelY1 ); - if ( Merger_Coll_NumHalos > 1 ) { - if ( Merger_Coll_IsGas2 ) - Aux_Message( stdout, " profile file 2 = %s\n", Merger_File_Prof2 ); - Aux_Message( stdout, " particle file 2 = %s\n", Merger_File_Par2 ); - Aux_Message( stdout, " cluster 2 w/ gas = %s\n", (Merger_Coll_IsGas2)? "yes":"no" ); - if ( Merger_Coll_IsGas2 ) - Aux_Message( stdout, " cluster 2 x-position = %g\n", Merger_Coll_PosX2 ); - Aux_Message( stdout, " cluster 2 y-position = %g\n", Merger_Coll_PosY2 ); - Aux_Message( stdout, " cluster 2 x-velocity = %g\n", Merger_Coll_VelX2 ); - Aux_Message( stdout, " cluster 2 y-velocity = %g\n", Merger_Coll_VelY2 ); + Aux_Message( stdout, " test problem ID = %d\n", TESTPROB_ID ); + Aux_Message( stdout, " number of clusters = %d\n", Merger_Coll_NumHalos ); + Aux_Message( stdout, " turn on AGN feedback = %s\n", (AGN_feedback)? "yes":"no" ); + for (int c=0; c 2 ) { - if ( Merger_Coll_IsGas3 ) - Aux_Message( stdout, " profile file 3 = %s\n", Merger_File_Prof3 ); - Aux_Message( stdout, " particle file 3 = %s\n", Merger_File_Par3 ); - Aux_Message( stdout, " cluster 3 w/ gas = %s\n", (Merger_Coll_IsGas3)? "yes":"no" ); - if ( Merger_Coll_IsGas3 ) - Aux_Message( stdout, " cluster 3 x-position = %g\n", Merger_Coll_PosX3 ); - Aux_Message( stdout, " cluster 3 y-position = %g\n", Merger_Coll_PosY3 ); - Aux_Message( stdout, " cluster 3 x-velocity = %g\n", Merger_Coll_VelX3 ); - Aux_Message( stdout, " cluster 3 y-velocity = %g\n", Merger_Coll_VelY3 ); - } - Aux_Message( stdout, " use metals = %s\n", (Merger_Coll_UseMetals)? "yes":"no" ); + Aux_Message( stdout, " adjust BH position = %s\n", (AdjustBHPos)? "yes":"no" ); + Aux_Message( stdout, " adjust BH velocity = %s\n", (AdjustBHVel)? "yes":"no" ); + Aux_Message( stdout, " adjust period = %g\n", AdjustPeriod ); + } // if ( AGN_feedback ) + Aux_Message( stdout, "=============================================================================\n" ); - } + +// check if the accretion region is larger than the jet cylinder + for (int c=0; cBoxCenter[2] }; - const double ClusterCenter2[3] = { Merger_Coll_PosX2, Merger_Coll_PosY2, amr->BoxCenter[2] }; - const double ClusterCenter3[3] = { Merger_Coll_PosX3, Merger_Coll_PosY3, amr->BoxCenter[2] }; - - double r1, r2, r3, Dens1, Dens2, Dens3, Pres1, Pres2, Pres3; - double Metl1, Metl2, Metl3, rmax1, rmax2, rmax3; - double Dens, MomX, MomY, MomZ, Pres, Eint, Etot, Metl; - - rmax1 = Table_R1[Merger_NBin1-1]; - rmax2 = Merger_Coll_NumHalos > 1 ? Table_R2[Merger_NBin2-1] : -1.0; - rmax3 = Merger_Coll_NumHalos > 2 ? Table_R3[Merger_NBin3-1] : -1.0; - - // for each cell, we sum up the density and pressure from each halo and then calculate the weighted velocity - if ( Merger_Coll_IsGas1 ) { - r1 = sqrt( SQR(x-ClusterCenter1[0]) + SQR(y-ClusterCenter1[1]) + SQR(z-ClusterCenter1[2]) ); - double rr1 = r1 < rmax1 ? r1 : rmax1; - Dens1 = Mis_InterpolateFromTable( Merger_NBin1, Table_R1, Table_D1, rr1 ); - Pres1 = Mis_InterpolateFromTable( Merger_NBin1, Table_R1, Table_P1, rr1 ); - Metl1 = Mis_InterpolateFromTable( Merger_NBin1, Table_R1, Table_M1, rr1 ); - } else { - r1 = HUGE_NUMBER; - Dens1 = 0.0; - Pres1 = 0.0; - Metl1 = 0.0; - } + bool AnyGasHalo = false; + for (int c=0; c 1 && Merger_Coll_IsGas2 ) { - r2 = sqrt( SQR(x-ClusterCenter2[0]) + SQR(y-ClusterCenter2[1]) + SQR(z-ClusterCenter2[2]) ); - double rr2 = r2 < rmax2 ? r2 : rmax2; - Dens2 = Mis_InterpolateFromTable( Merger_NBin2, Table_R2, Table_D2, rr2 ); - Pres2 = Mis_InterpolateFromTable( Merger_NBin2, Table_R2, Table_P2, rr2 ); - Metl2 = Mis_InterpolateFromTable( Merger_NBin2, Table_R2, Table_M2, rr2 ); - } else { - r2 = HUGE_NUMBER; - Dens2 = 0.0; - Pres2 = 0.0; - Metl2 = 0.0; - } + const double pos_in[3] = { x, y, z }; - if ( Merger_Coll_NumHalos > 2 && Merger_Coll_IsGas3 ) { - r3 = sqrt( SQR(x-ClusterCenter3[0]) + SQR(y-ClusterCenter3[1]) + SQR(z-ClusterCenter3[2]) ); - double rr3 = r3 < rmax3 ? r3 : rmax3; - Dens3 = Mis_InterpolateFromTable( Merger_NBin3, Table_R3, Table_D3, rr3 ); - Pres3 = Mis_InterpolateFromTable( Merger_NBin3, Table_R3, Table_P3, rr3 ); - Metl3 = Mis_InterpolateFromTable( Merger_NBin3, Table_R3, Table_M3, rr3 ); - } else { - r3 = HUGE_NUMBER; - Dens3 = 0.0; - Pres3 = 0.0; - Metl3 = 0.0; - } + real Dens = 0.0, MomX = 0.0, MomY = 0.0, MomZ = 0.0, Pres = 0.0, Eint = 0.0, Etot = 0.0, Metl = 0.0; - if ( Dens1 == NULL_REAL ) - Dens1 = Table_D1[Merger_NBin1-1]; - if ( Pres1 == NULL_REAL ) - Pres1 = Table_P1[Merger_NBin1-1]; - if ( Metl1 == NULL_REAL ) - Metl1 = Table_M1[Merger_NBin1-1]; - - if ( Dens2 == NULL_REAL ) - Dens2 = Table_D2[Merger_NBin2-1]; - if ( Pres2 == NULL_REAL ) - Pres2 = Table_P2[Merger_NBin2-1]; - if ( Metl2 == NULL_REAL ) - Metl2 = Table_M2[Merger_NBin2-1]; - - if ( Dens3 == NULL_REAL ) - Dens3 = Table_D3[Merger_NBin3-1]; - if ( Pres3 == NULL_REAL ) - Pres3 = Table_P3[Merger_NBin3-1]; - if ( Metl3 == NULL_REAL ) - Metl3 = Table_M3[Merger_NBin3-1]; - - Dens = Dens1 + Dens2 + Dens3; - Pres = Pres1 + Pres2 + Pres3; - - MomX = 0.0; - MomY = 0.0; - if ( r1 <= rmax1 ) { - MomX += Merger_Coll_VelX1*Dens1; - MomY += Merger_Coll_VelY1*Dens1; - } - if ( r2 <= rmax2 ) { - MomX += Merger_Coll_VelX2*Dens2; - MomY += Merger_Coll_VelY2*Dens2; - } - if ( r3 <= rmax3 ) { - MomX += Merger_Coll_VelX3*Dens3; - MomY += Merger_Coll_VelY3*Dens3; - } - MomZ = 0.0; + for (int c=0; c 1 && Merger_Coll_IsGas2 ) { - if ( r2 < rmax2 ) - fluid[ColorField2Idx] = Dens2; - else - fluid[ColorField2Idx] = 0.0; + +#ifdef SUPPORT_HDF5 +//------------------------------------------------------------------------------------------------------- +// Function : Output_HDF5_User_ClusterMerger +// Description : Store the problem specific parameter in HDF5 outputs (Data_*) under User group +// +// Note : 1. This function only works in MPI_RANK == 0 +// 2. We supports int, uint, long, ulong, bool, float, double, and string datatype +// 3. There MUST be more than one parameter to be stored +// 4. The pointer of the data MUST still exist outside the function, e.g. global variables +// +// Parameter : HDF5_OutUser : the structure storing the parameters +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void Output_HDF5_User_ClusterMerger( HDF5_Output_t *HDF5_OutUser ) +{ + + HDF5_OutUser->Add( "Merger_Coll_NumBHs", &Merger_Coll_NumBHs ); + for (int c=0; cAdd( BH_Pos_name, &CM_BH_Pos[c][d] ); + HDF5_OutUser->Add( ClusterCen_name, &CM_ClusterCen[c][d] ); + HDF5_OutUser->Add( BH_Vel_name, &CM_BH_Vel[c][d] ); + } + char BH_Mass_name[50], BH_Mdot_tot_name[50], BH_Mdot_hot_name[50], BH_Mdot_cold_name[50]; + sprintf( BH_Mass_name, "BH_Mass_%d", c ); + sprintf( BH_Mdot_tot_name, "BH_Mdot_tot_%d", c ); + sprintf( BH_Mdot_hot_name, "BH_Mdot_hot_%d", c ); + sprintf( BH_Mdot_cold_name, "BH_Mdot_cold_%d", c ); + HDF5_OutUser->Add( BH_Mass_name, &CM_BH_Mass [c] ); + HDF5_OutUser->Add( BH_Mdot_tot_name, &CM_BH_Mdot_tot [c] ); + HDF5_OutUser->Add( BH_Mdot_hot_name, &CM_BH_Mdot_hot [c] ); + HDF5_OutUser->Add( BH_Mdot_cold_name, &CM_BH_Mdot_cold[c] ); } + HDF5_OutUser->Add( "AdjustCount", &AdjustCount ); - if ( Merger_Coll_NumHalos > 2 && Merger_Coll_IsGas3 ) { - if ( r3 < rmax3 ) - fluid[ColorField3Idx] = Dens3; - else - fluid[ColorField3Idx] = 0.0; +# ifdef MASSIVE_PARTICLES + for (int c=0; cAdd( CM_ClusterIdx_Cur_name, &CM_ClusterIdx_Cur[c] ); } +# endif -} // FUNCTION : SetGridIC -#endif // #if ( MODEL == HYDRO && defined MASSIVE_PARTICLES ) +} // FUNCTION : Output_HDF5_User_ClusterMerger +#endif // #ifdef SUPPORT_HDF5 @@ -676,20 +790,87 @@ void SetGridIC( real fluid[], const double x, const double y, const double z, co void End_ClusterMerger() { - delete [] Table_R1; - delete [] Table_D1; - delete [] Table_P1; - delete [] Table_M1; +# ifdef SUPPORT_HDF5 + if ( OPT__INIT != INIT_BY_RESTART ) + { + delete [] NPar_EachCluster; + delete [] Merger_NBin; + for (int c=0; c Field label sent to AddField() will be used as the output name of the field +// --> Field index returned by AddField() can be used to access the field data +// 3. Pre-declared field indices are put in Field.h +// +// Parameter : None +// +// Return : None +//------------------------------------------------------------------------------------------------------- void AddNewField_ClusterMerger() { if ( Merger_Coll_UseMetals ) Idx_Metal = AddField( "Metal", FIXUP_FLUX_YES, FIXUP_REST_YES, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); - if ( ColorField1Idx == Idx_Undefined ) - ColorField1Idx = AddField( "ColorField1", FIXUP_FLUX_YES, FIXUP_REST_YES, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); - if ( Merger_Coll_NumHalos > 1 && ColorField2Idx == Idx_Undefined ) - ColorField2Idx = AddField( "ColorField2", FIXUP_FLUX_YES, FIXUP_REST_YES, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); - if ( Merger_Coll_NumHalos > 2 && ColorField3Idx == Idx_Undefined ) - ColorField3Idx = AddField( "ColorField3", FIXUP_FLUX_YES, FIXUP_REST_YES, FLOOR_YES, NORMALIZE_NO, INTERP_FRAC_NO ); + + for (int c=0; c Use Init_User_AfterPoisson_Ptr() instead if this information is required +// --> It's OK to modify mass density on grids and particle mass/position here +// --> But grid distribution won't change unless you manually call the corresponding +// grid refinement routines here +// --> Modifying particle position requires special attention in order to ensure that +// all particles still reside in leaf patches. Do this only if you know what +// you are doing. +// 3. To add new particles, remember to call Par_AddParticleAfterInit() +// +// Parameter : None +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void Init_User_ClusterMerger() +{ + + if ( OPT__INIT != INIT_BY_RESTART ) return; + + if ( OPT__RESTART_RESET ) + Aux_Error( ERROR_INFO, "OPT__RESTART_RESET should be disabled !!\n" ); + +# ifdef SUPPORT_HDF5 + const char FileName[] = "RESTART"; + + hid_t H5_FileID, H5_SetID_OutputUser, H5_TypeID_OutputUser; + herr_t H5_Status; + + H5_FileID = H5Fopen( FileName, H5F_ACC_RDONLY, H5P_DEFAULT ); + if ( H5_FileID < 0 ) + Aux_Error( ERROR_INFO, "failed to open the restart HDF5 file \"%s\" !!\n", FileName ); + + H5_SetID_OutputUser = H5Dopen( H5_FileID, "User/UserPara", H5P_DEFAULT ); + if ( H5_SetID_OutputUser < 0 ) + Aux_Error( ERROR_INFO, "failed to open the dataset \"%s\" !!\n", "User/OutputUser" ); + + H5_TypeID_OutputUser = H5Dget_type( H5_SetID_OutputUser ); + if ( H5_TypeID_OutputUser < 0 ) + Aux_Error( ERROR_INFO, "failed to open the datatype of \"%s\" !!\n", "User/OutputUser" ); + + LoadField( "Merger_Coll_NumBHs", &Merger_Coll_NumBHs, H5_SetID_OutputUser, H5_TypeID_OutputUser ); + +// allocate BH related memories + AllocateBHVarArray(); + + for (int c=0; c 0/<0 +//------------------------------------------------------------------------------------------------------- +herr_t LoadField( const char *FieldName, void *FieldPtr, const hid_t H5_SetID_Target, + const hid_t H5_TypeID_Target ) +{ + + int H5_FieldIdx; + size_t H5_FieldSize; + hid_t H5_TypeID_Field; // datatype ID of the target field in the compound variable + hid_t H5_TypeID_Load; // datatype ID for loading the target field + herr_t H5_Status; + + +// load + H5_FieldIdx = H5Tget_member_index( H5_TypeID_Target, FieldName ); + + if ( H5_FieldIdx >= 0 ) + { + H5_TypeID_Field = H5Tget_member_type( H5_TypeID_Target, H5_FieldIdx ); + H5_FieldSize = H5Tget_size( H5_TypeID_Field ); + + H5_TypeID_Load = H5Tcreate( H5T_COMPOUND, H5_FieldSize ); + H5_Status = H5Tinsert( H5_TypeID_Load, FieldName, 0, H5_TypeID_Field ); + + H5_Status = H5Dread( H5_SetID_Target, H5_TypeID_Load, H5S_ALL, H5S_ALL, H5P_DEFAULT, FieldPtr ); + if ( H5_Status < 0 ) Aux_Error( ERROR_INFO, "failed to load the field \"%s\" !!\n", FieldName ); + + H5_Status = H5Tclose( H5_TypeID_Field ); + H5_Status = H5Tclose( H5_TypeID_Load ); + } // if ( H5_FieldIdx >= 0 ) + else + { + Aux_Error( ERROR_INFO, "target field \"%s\" does not exist in the restart file !!\n", FieldName ); + return -1; + } // if ( H5_FieldIdx >= 0 ) ... else ... + + return 0; + +} // FUNCTION : LoadField +#endif // #ifdef SUPPORT_HDF5 diff --git a/src/TestProblem/Hydro/ClusterMerger/Par_Init_ByFunction_ClusterMerger.cpp b/src/TestProblem/Hydro/ClusterMerger/Par_Init_ByFunction_ClusterMerger.cpp index 04459297e6..1102c3d48e 100644 --- a/src/TestProblem/Hydro/ClusterMerger/Par_Init_ByFunction_ClusterMerger.cpp +++ b/src/TestProblem/Hydro/ClusterMerger/Par_Init_ByFunction_ClusterMerger.cpp @@ -1,48 +1,43 @@ #include "GAMER.h" +#include -#ifdef SUPPORT_HDF5 -#include "hdf5.h" -#endif -#include // floating-point type in the input particle file typedef double real_par_in; //typedef float real_par_in; -extern char Merger_File_Par1[1000]; -extern char Merger_File_Par2[1000]; -extern char Merger_File_Par3[1000]; -extern int Merger_Coll_NumHalos; -extern double Merger_Coll_PosX1; -extern double Merger_Coll_PosY1; -extern double Merger_Coll_PosX2; -extern double Merger_Coll_PosY2; -extern double Merger_Coll_PosX3; -extern double Merger_Coll_PosY3; -extern double Merger_Coll_VelX1; -extern double Merger_Coll_VelY1; -extern double Merger_Coll_VelX2; -extern double Merger_Coll_VelY2; -extern double Merger_Coll_VelX3; -extern double Merger_Coll_VelY3; -extern long NPar_EachCluster[3]; -extern long NPar_AllCluster; - +// problem-specific global variables +// ======================================================================================= +extern char (*Merger_File_Par)[1000]; +extern int Merger_Coll_NumHalos; +extern double (*Merger_Coll_Pos)[3]; +extern double (*Merger_Coll_Vel)[3]; +extern bool Merger_Coll_LabelCenter; +extern long *NPar_EachCluster; #ifdef MASSIVE_PARTICLES +extern FieldIdx_t Idx_ParHalo; +#endif +// ======================================================================================= -extern FieldIdx_t Idx_ParHalo; - -void Read_Particles_ClusterMerger(std::string filename, long offset, long num, - real_par_in xpos[], real_par_in ypos[], - real_par_in zpos[], real_par_in xvel[], - real_par_in yvel[], real_par_in zvel[], - real_par_in mass[], real_par_in ptype[]); +// problem-specific function prototypes +// ======================================================================================= +#ifdef MASSIVE_PARTICLES +#ifdef SUPPORT_HDF5 +static void Read_Particles_ClusterMerger( std::string filename, long offset, long num, + real_par_in xpos[], real_par_in ypos[], + real_par_in zpos[], real_par_in xvel[], + real_par_in yvel[], real_par_in zvel[], + real_par_in mass[], real_par_in ptype[] ); +#endif +#endif +// ======================================================================================= +#ifdef MASSIVE_PARTICLES //------------------------------------------------------------------------------------------------------- // Function : Par_Init_ByFunction_ClusterMerger // Description : Initialize all particle attributes for the merging cluster test @@ -92,61 +87,62 @@ void Par_Init_ByFunction_ClusterMerger( const long NPar_ThisRank, const long NPa long_par *AllAttributeInt[PAR_NATT_INT_TOTAL] ) { -#ifdef SUPPORT_HDF5 +# ifdef SUPPORT_HDF5 if ( MPI_Rank == 0 ) Aux_Message( stdout, "%s ...\n", __FUNCTION__ ); - // prepare to load data +// prepare to load data if ( MPI_Rank == 0 ) Aux_Message( stdout, " Preparing to load data ... " ); const int NCluster = Merger_Coll_NumHalos; - long NPar_ThisRank_EachCluster[3]={0,0,0}, Offset[3]; // [0/1/2] --> cluster 1/2/3 + long NPar_ThisRank_EachCluster[NCluster], Offset[NCluster]; + + for (int c=0; c convert to code unit before storing to the particle repository to avoid floating-point overflow - // --> we have assumed that the loaded data are in cgs - +// --> convert to code unit before storing to the particle repository to avoid floating-point overflow +// --> we have assumed that the loaded data are in cgs ParPosX[pp] = real_par( xpos[p] / UNIT_L ); ParPosY[pp] = real_par( ypos[p] / UNIT_L ); ParPosZ[pp] = real_par( zpos[p] / UNIT_L ); if ( (long_par)ptype[p] == PTYPE_TRACER ) { - // tracer particles have zero mass - // and their velocities will be set by - // the grid later +// tracer particles have zero mass and their velocities will be set by the grid later ParMass[pp] = (real_par)0.0; ParVelX[pp] = (real_par)0.0; ParVelY[pp] = (real_par)0.0; ParVelX[pp] = (real_par)0.0; - } else { - // for massive particles get their mass - // and velocity + } + else + { +// for massive particles get their mass and velocity ParMass[pp] = real_par( mass[p] / UNIT_M ); ParVelX[pp] = real_par( xvel[p] / UNIT_V ); ParVelY[pp] = real_par( yvel[p] / UNIT_V ); ParVelZ[pp] = real_par( zvel[p] / UNIT_V ); } - // synchronize all particles to the physical time at the base level +// synchronize all particles to the physical time at the base level ParTime[pp] = (real_par)Time[0]; - // set tag for each cluster +// set tag for each cluster AllAttributeInt[Idx_ParHalo][pp] = (long_par)c; - } // for (long p=0; pBoxCenter[2] }; - const double ClusterCenter2[3] - = { Merger_Coll_PosX2, Merger_Coll_PosY2, amr->BoxCenter[2] }; - const double ClusterCenter3[3] - = { Merger_Coll_PosX3, Merger_Coll_PosY3, amr->BoxCenter[2] }; - - for (long p=0; p Example: +// LOAD_PARA( load_mode, "TestProb_ID", &TESTPROB_ID, TESTPROB_ID, TESTPROB_ID, TESTPROB_ID ); +// +// Parameter : load_mode : Mode for loading parameters +// --> LOAD_READPARA : Read parameters from Input__TestProb +// LOAD_HDF5_OUTPUT : Store parameters in HDF5 snapshots +// ReadPara : Data structure for reading parameters (used with LOAD_READPARA) +// HDF5_InputTest : Data structure for storing parameters in HDF5 snapshots (used with LOAD_HDF5_OUTPUT) +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void LoadInputTestProb( const LoadParaMode_t load_mode, ReadPara_t *ReadPara, HDF5_Output_t *HDF5_InputTest ) +{ + +# ifndef SUPPORT_HDF5 + if ( load_mode == LOAD_HDF5_OUTPUT ) Aux_Error( ERROR_INFO, "please turn on SUPPORT_HDF5 in the Makefile for load_mode == LOAD_HDF5_OUTPUT !!\n" ); +# endif + + if ( load_mode == LOAD_READPARA && ReadPara == NULL ) Aux_Error( ERROR_INFO, "load_mode == LOAD_READPARA and ReadPara == NULL !!\n" ); + if ( load_mode == LOAD_HDF5_OUTPUT && HDF5_InputTest == NULL ) Aux_Error( ERROR_INFO, "load_mode == LOAD_HDF5_OUTPUT and HDF5_InputTest == NULL !!\n" ); + +// add parameters in the following format: +// --> note that VARIABLE, DEFAULT, MIN, and MAX must have the same data type +// --> some handy constants (e.g., NoMin_int, Eps_float, ...) are defined in "include/ReadPara.h" +// --> LOAD_PARA() is defined in "include/TestProb.h" +// ************************************************************************************************************************ +// LOAD_PARA( load_mode, "KEY_IN_THE_FILE", &VARIABLE, DEFAULT, MIN, MAX ); +// ************************************************************************************************************************ + LOAD_PARA( load_mode, "EC_Temp", &EC_Temp, 1000000.0, Eps_double, NoMax_double ); + LOAD_PARA( load_mode, "EC_Dens", &EC_Dens, 1.0, Eps_double, NoMax_double ); + +} // FUNCITON : LoadInputTestProb + + + +//------------------------------------------------------------------------------------------------------- +// Function : SetParameter +// Description : Load and set the problem-specific runtime parameters +// +// Note : 1. Filename is set to "Input__TestProb" by default +// 2. Major tasks in this function: +// (1) load the problem-specific runtime parameters +// (2) set the problem-specific derived parameters +// (3) reset other general-purpose parameters if necessary +// (4) make a note of the problem-specific parameters +// 3. Must call EoS_Init() before calling any other EoS routine +// +// Parameter : None +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void SetParameter() +{ + + if ( MPI_Rank == 0 ) Aux_Message( stdout, " Setting runtime parameters ...\n" ); + + +// (1) load the problem-specific runtime parameters +// (1-1) read parameters from Input__TestProb + const char FileName[] = "Input__TestProb"; + ReadPara_t *ReadPara = new ReadPara_t; + + LoadInputTestProb( LOAD_READPARA, ReadPara, NULL ); + + ReadPara->Read( FileName ); + + delete ReadPara; + +// (1-2) set the default values + +// (1-3) check the runtime parameters + + +// (2) set the problem-specific derived parameters + + +// (3) reset other general-purpose parameters +// --> a helper macro PRINT_WARNING is defined in TestProb.h + const long End_Step_Default = __INT_MAX__; + const double End_T_Default = 100.0*Const_Myr/UNIT_T; + + if ( END_STEP < 0 ) { + END_STEP = End_Step_Default; + PRINT_RESET_PARA( END_STEP, FORMAT_LONG, "" ); + } + + if ( END_T < 0.0 ) { + END_T = End_T_Default; + PRINT_RESET_PARA( END_T, FORMAT_REAL, "" ); + } + + +// (4) make a note + if ( MPI_Rank == 0 ) + { + Aux_Message( stdout, "=============================================================================\n" ); + Aux_Message( stdout, " test problem ID = %d\n", TESTPROB_ID ); + Aux_Message( stdout, " EC_Temp = %13.7e\n", EC_Temp ); + Aux_Message( stdout, " EC_Dens = %13.7e\n", EC_Dens ); + Aux_Message( stdout, "=============================================================================\n" ); + } + + + if ( MPI_Rank == 0 ) Aux_Message( stdout, " Setting runtime parameters ... done\n" ); + +} // FUNCTION : SetParameter + + + +//------------------------------------------------------------------------------------------------------- +// Function : SetGridIC +// Description : Set the problem-specific initial condition on grids +// +// Note : 1. This function may also be used to estimate the numerical errors when OPT__OUTPUT_USER is enabled +// --> In this case, it should provide the analytical solution at the given "Time" +// 2. This function will be invoked by multiple OpenMP threads when OPENMP is enabled +// (unless OPT__INIT_GRID_WITH_OMP is disabled) +// --> Please ensure that everything here is thread-safe +// 3. Even when DUAL_ENERGY is adopted for HYDRO, one does NOT need to set the dual-energy variable here +// --> It will be calculated automatically +// 4. For MHD, do NOT add magnetic energy (i.e., 0.5*B^2) to fluid[ENGY] here +// --> It will be added automatically later +// +// Parameter : fluid : Fluid field to be initialized +// x/y/z : Physical coordinates +// Time : Physical time +// lv : Target refinement level +// AuxArray : Auxiliary array +// +// Return : fluid +//------------------------------------------------------------------------------------------------------- +void SetGridIC( real fluid[], const double x, const double y, const double z, const double Time, + const int lv, double AuxArray[] ) +{ + + const double cl_X = 0.7; // mass-fraction of hydrogen + const double cl_Z = 0.018; // metallicity (in Zsun) + const double cl_mol = 1.0/(2*cl_X+0.75*(1-cl_X-cl_Z)+cl_Z*0.5); // mean (total) molecular weights + + double Dens, MomX, MomY, MomZ, Pres, Eint, Etot; +// Convert the input number density into mass density rho + double cl_dens = (EC_Dens*MU_NORM*cl_mol) / UNIT_D; + double cl_pres = EoS_DensTemp2Pres_CPUPtr( cl_dens, EC_Temp, NULL, EoS_AuxArray_Flt, EoS_AuxArray_Int, h_EoS_Table ); + + Dens = cl_dens; + MomX = 0.0; + MomY = 0.0; + MomZ = 0.0; + Pres = cl_pres; + Eint = EoS_DensPres2Eint_CPUPtr( Dens, Pres, NULL, EoS_AuxArray_Flt, EoS_AuxArray_Int, h_EoS_Table ); // assuming EoS requires no passive scalars + Etot = Hydro_ConEint2Etot( Dens, MomX, MomY, MomZ, Eint, 0.0 ); // do NOT include magnetic energy here + +// set the output array + fluid[DENS] = Dens; + fluid[MOMX] = MomX; + fluid[MOMY] = MomY; + fluid[MOMZ] = MomZ; + fluid[ENGY] = Etot; + +} // FUNCTION : SetGridIC + + + +//------------------------------------------------------------------------------------------------------- +// Function : OutputExactCooling +// Description : Output the temperature relative error in the exact cooling problem +// +// Note : 1. Enabled by the runtime option "OPT__OUTPUT_USER" +// 2. Construct the analytical solution corresponding to the cooling function +// +// Parameter : None +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void Output_ExactCooling() +{ + const char FileName[] = "Record__CoolingErr"; + static bool FirstTime = true; + +// header + if ( FirstTime ) + { + if ( MPI_Rank == 0 ) + { + if ( Aux_CheckFileExist( FileName ) ) + Aux_Message( stderr, "WARNING : file \"%s\" already exists !!\n", FileName ); + + FILE *File_User = fopen( FileName, "a" ); + fprintf( File_User, "#%13s%10s ", "Time", "DumpID" ); + fprintf( File_User, "%14s %14s %14s %14s %14s", "Temp_nume", "Temp_anal", "Err", "Tcool_nume", "Tcool_anal" ); + fprintf( File_User, "\n" ); + fclose( File_User ); + } + FirstTime = false; + } // if ( FirstTime ) + + const double cl_X = 0.7; // mass-fraction of hydrogen + const double cl_Z = 0.018; // metallicity (in Zsun) + const double cl_mol = 1.0/(2*cl_X+0.75*(1-cl_X-cl_Z)+cl_Z*0.5); // mean (total) molecular weights + const double cl_mole = 2.0/(1+cl_X); // mean electron molecular weights + const double cl_moli = 1.0/cl_X; // mean proton molecular weights + const double cl_moli_mole = cl_moli*cl_mole; // Assume the molecular weights are constant, mu_e*mu_i = 1.464 + const int lv = 0; + +// get the numerical result + real fluid[NCOMP_TOTAL]; + double Temp_nume = 0.0; + double Temp_nume_tmp = 0.0; + double Tcool_nume = 0.0; + int count = 0; + + for (int PID=0; PIDNPatchComma[lv][1]; PID++) + for (int k=0; kpatch[ amr->FluSg[lv] ][lv][PID]->fluid[v][k][j][i]; + Temp_nume_tmp = Hydro_Con2Temp( fluid[0], fluid[1], fluid[2], fluid[3], fluid[4], fluid+NCOMP_FLUID, + true, MIN_TEMP, PassiveFloorMask, 0.0, EoS_DensEint2Temp_CPUPtr, EoS_GuessHTilde_CPUPtr, + EoS_HTilde2Temp_CPUPtr, EoS_AuxArray_Flt, EoS_AuxArray_Int, h_EoS_Table ); + Tcool_nume += 1.0/(GAMMA-1)*(Const_kB*cl_moli_mole*Temp_nume_tmp)/(fluid[0]*UNIT_D/MU_NORM*cl_mol*3.2217e-27*sqrt(Temp_nume_tmp))/Const_Myr; + Temp_nume += Temp_nume_tmp; + count += 1; + }}} // i, j, k, PID + Temp_nume /= count; + Tcool_nume /= count; + +// compute the analytical solution for single branch cooling function + double Temp_anal, Tcool_anal; + if ( sqrt(EC_Temp) >= 3.2217e-27/2.0*(GAMMA-1)*EC_Dens*cl_mol*cl_mol/cl_mole/cl_moli/Const_kB*Time[0]*UNIT_T ) + { + Temp_anal = pow(sqrt(EC_Temp) - 3.2217e-27/2.0*(GAMMA-1)*EC_Dens*cl_mol*cl_mol/cl_mole/cl_moli/Const_kB*Time[0]*UNIT_T, 2.0); + if ( Temp_anal < MIN_TEMP ) Temp_anal = MIN_TEMP; + } + else Temp_anal = MIN_TEMP; + + Tcool_anal = 1.0/(GAMMA-1)*EC_Dens*Const_kB*Temp_anal/((EC_Dens*cl_mol/cl_mole)*(EC_Dens*cl_mol/cl_moli)*3.2217e-27*sqrt(Temp_anal))/Const_Myr; + +// record + if ( MPI_Rank == 0 ) + { + FILE *File_User = fopen( FileName, "a" ); + fprintf( File_User, "%14.7e%10d ", Time[0]*UNIT_T/Const_Myr, DumpID ); + fprintf( File_User, "%14.7e %14.7e %14.7e %14.7e %14.7e", Temp_nume, Temp_anal, (Temp_nume-Temp_anal)/Temp_anal, Tcool_nume, Tcool_anal ); + fprintf( File_User, "\n" ); + fclose( File_User ); + } + +} // FUNCTION : Output_ExactCooling +#endif // #if ( MODEL == HYDRO ) + + + +//------------------------------------------------------------------------------------------------------- +// Function : Init_TestProb_Hydro_ExactCooling +// Description : Test problem initializer +// +// Note : None +// +// Parameter : None +// +// Return : None +//------------------------------------------------------------------------------------------------------- +void Init_TestProb_Hydro_ExactCooling() +{ + + if ( MPI_Rank == 0 ) Aux_Message( stdout, "%s ...\n", __FUNCTION__ ); + + +// validate the compilation flags and runtime parameters + Validate(); + + +# if ( MODEL == HYDRO ) +// set the problem-specific runtime parameters + SetParameter(); + + + Init_Function_User_Ptr = SetGridIC; + Output_User_Ptr = Output_ExactCooling; +# ifdef SUPPORT_HDF5 + Output_HDF5_InputTest_Ptr = LoadInputTestProb; +# endif +# endif + + if ( MPI_Rank == 0 ) Aux_Message( stdout, "%s ... done\n", __FUNCTION__ ); + +} // FUNCTION : Init_TestProb_Hydro_ExactCooling diff --git a/src/configure.py b/src/configure.py index 6d91253cc9..cb21ec4802 100755 --- a/src/configure.py +++ b/src/configure.py @@ -661,6 +661,12 @@ def load_arguments( sys_setting : SystemSetting ): help="Feedback from particles to grids and vice versa.\n" ) + parser.add_argument( "--exact_cooling", type=str2bool, metavar="BOOLEAN", gamer_name="EXACT_COOLING", + default=False, + depend={"model":"HYDRO"}, + help="Enable exact cooling.\n" + ) + parser.add_argument( "--par_attribute_flt", type=int, metavar="INTEGER", gamer_name="PAR_NATT_FLT_USER", default=0, depend={"particle":True},