diff --git a/configure.ac b/configure.ac index 2420d9accf40e42defb9e3995c587e6d042bc955..c561ce33590ff4015023a8b785a6236032c2bb6a 100644 --- a/configure.ac +++ b/configure.ac @@ -2836,6 +2836,9 @@ case "$with_rt" in if test "$number_group" -eq "0"; then AC_MSG_ERROR([SPHM1RT: Cannot work with zero photon groups]) fi + if test $number_group -lt 4; then + AC_MSG_ERROR([SPHM1RT: Cannot work with < four photon groups for now]) + fi if ! test $number_group -eq $number_group; then # abuse -eq to check whether $number_group is an integer. -eq # only works with those. diff --git a/doc/RTD/source/RadiativeTransfer/SPHM1_RT.rst b/doc/RTD/source/RadiativeTransfer/SPHM1_RT.rst index 6b13a4b3af228c308e734b5a9f57d3792142b034..9a663dcf34f982f00ba343cab0b42fb157a59ad3 100644 --- a/doc/RTD/source/RadiativeTransfer/SPHM1_RT.rst +++ b/doc/RTD/source/RadiativeTransfer/SPHM1_RT.rst @@ -20,7 +20,8 @@ Compiling for SPHM1-RT - To compile swift to be able to run with SPHM1-RT, you need to configure with ``--with-rt=SPHM1RT_N`` where ``N`` is the integer number of photon groups that - you intend to use in your simulation. + you intend to use in your simulation. The number of photon groups for SPHM1RT has + to be four for now (since it is hard-coded in thermo-chemistry solver). - SPHM1-RT is compatible with any SPH scheme. You'll need to compile using ``--with-hydro=sphenix`` or other SPH schemes, e.g. we have tested gadget2, minimal, and sphenix. diff --git a/examples/RadiativeTransferTests/AdvectionDifferentTimeStepSizes_1D/README b/examples/RadiativeTransferTests/AdvectionDifferentTimeStepSizes_1D/README index 3cf3226b923b9b9206377770fac9fb1f6f68f06c..686f50d9e943a9188f5bdf116338eb37f2573b07 100644 --- a/examples/RadiativeTransferTests/AdvectionDifferentTimeStepSizes_1D/README +++ b/examples/RadiativeTransferTests/AdvectionDifferentTimeStepSizes_1D/README @@ -32,7 +32,7 @@ GEAR_RT: --with-riemann-solver=hllc --with-stars=GEAR --with-feedback=none --with-grackle=$GRACKLE_ROOT SPHM1RT: - --with-rt=SPHM1RT_3 --with-hydro-dimension=1 --with-stars=basic --with-sundials=$SUNDIALS_ROOT + --with-rt=SPHM1RT_4 --with-hydro-dimension=1 --with-stars=basic --with-sundials=$SUNDIALS_ROOT IMPORTANT: Need SUNDIALS version = 5 . SUNDIALS_ROOT is the root directory that contains the lib and include directories, e.g. on cosma: diff --git a/examples/RadiativeTransferTests/Advection_1D/README b/examples/RadiativeTransferTests/Advection_1D/README index 731c528cfc3014dc6714492e54a554240962417a..13dd7ce4caeeb00bd17b4998dffdbd92eacaee9c 100644 --- a/examples/RadiativeTransferTests/Advection_1D/README +++ b/examples/RadiativeTransferTests/Advection_1D/README @@ -19,7 +19,7 @@ GEAR_RT: --with-riemann-solver=hllc --with-stars=GEAR --with-feedback=none --with-grackle=$GRACKLE_ROOT SPHM1RT: - --with-rt=SPHM1RT_3 --with-hydro-dimension=1 --with-stars=basic --with-sundials=$SUNDIALS_ROOT + --with-rt=SPHM1RT_4 --with-hydro-dimension=1 --with-stars=basic --with-sundials=$SUNDIALS_ROOT IMPORTANT: Need SUNDIALS version = 5 . SUNDIALS_ROOT is the root directory that contains the lib and include directories, e.g. on cosma: diff --git a/examples/RadiativeTransferTests/Advection_1D/plotSolution.py b/examples/RadiativeTransferTests/Advection_1D/plotSolution.py index ed2ac188579a3c37c8ce31dcaa65c2c82fd0879e..4feadac2a7e7c5371d89738739315ad1bcbe43b0 100755 --- a/examples/RadiativeTransferTests/Advection_1D/plotSolution.py +++ b/examples/RadiativeTransferTests/Advection_1D/plotSolution.py @@ -115,6 +115,11 @@ def plot_photons(filename, energy_boundaries=None, flux_boundaries=None): boxsize = meta.boxsize[0] ngroups = int(meta.subgrid_scheme["PhotonGroupNumber"]) + # Currently, SPHM1RT only works for frequency group = 4 in the code + # However, we only plot 3 frequency groups here, so + # we set ngroups = 3: + if scheme.startswith("SPH M1closure"): + ngroups = 3 for g in range(ngroups): # workaround to access named columns data with swiftsimio visualisaiton diff --git a/examples/RadiativeTransferTests/Advection_1D/rt_advection1D.yml b/examples/RadiativeTransferTests/Advection_1D/rt_advection1D.yml index 76fb70f54b4485e29eef7dcbbad088fa36c0ec19..a528dbeb1624e60679f23aecbde2de7a8376c296 100644 --- a/examples/RadiativeTransferTests/Advection_1D/rt_advection1D.yml +++ b/examples/RadiativeTransferTests/Advection_1D/rt_advection1D.yml @@ -63,9 +63,9 @@ GEARRT: SPHM1RT: cred: 2.99792458e10 # reduce the speed of light in the code unit CFL_condition: 0.1 # CFL condition for RT, independent of hydro - photon_groups_Hz: [1., 2.] # Photon frequency group bin edges in Hz. Needs to be 1 less than the number of groups (N) requested during the configuration (--with-RT=SPHM1RT_N). + photon_groups_Hz: [0., 1., 2.] # Photon frequency group bin edges in Hz. Needs to be 1 less than the number of groups (N) requested during the configuration (--with-RT=SPHM1RT_N). use_const_emission_rates: 1 # (Optional) use constant emission rates for stars as defined with star_emission_rates parameter - star_emission_rates: [1e-32, 1e-32, 1e-32] # (Optional) constant star emission rates for each photon frequency group to use if use_constant_emission_rates is set. + star_emission_rates: [1e-32,1e-32, 1e-32, 1e-32] # (Optional) constant star emission rates for each photon frequency group to use if use_constant_emission_rates is set. stellar_spectrum_type: 0 # Which radiation spectrum to use. 0: constant from 0 until some max frequency set by stellar_spectrum_const_max_frequency_Hz. 1: blackbody spectrum. stellar_spectrum_const_max_frequency_Hz: 1.e17 # (Conditional) if stellar_spectrum_type=0, use this maximal frequency for the constant spectrum. skip_thermochemistry: 1 # (Optional) skip the thermochemistry. This is intended only for debugging and testing the radiation transport, as it breaks the purpose of RT. diff --git a/examples/RadiativeTransferTests/StromgrenSphere_2D/README b/examples/RadiativeTransferTests/StromgrenSphere_2D/README index c1269bdaacc0deae1b0cac364acd6fa687c344f4..d291adc607e54c1ab20e561f725fe54a535e0416 100644 --- a/examples/RadiativeTransferTests/StromgrenSphere_2D/README +++ b/examples/RadiativeTransferTests/StromgrenSphere_2D/README @@ -25,7 +25,7 @@ To use the GEAR RT model, compile with : --with-rt=GEAR_1 --with-rt-riemann-solver=GLF --with-hydro-dimension=2 --with-hydro=gizmo-mfv --with-riemann-solver=hllc --with-stars=GEAR --with-feedback=none --with-grackle=$GRACKLE_ROOT To use the SPHM1 RT model, compile with : - --with-rt=SPHM1RT_1 --with-hydro-dimension=2 --with-stars=basic --with-feedback=none --with-sundials=$SUNDIALS_ROOT + --with-rt=SPHM1RT_4 --with-hydro-dimension=2 --with-stars=basic --with-feedback=none --with-sundials=$SUNDIALS_ROOT IMPORTANT: Need SUNDIALS version = 5 . SUNDIALS_ROOT is the root directory that contains the lib and include directories, e.g. on cosma: diff --git a/examples/RadiativeTransferTests/StromgrenSphere_3D/README b/examples/RadiativeTransferTests/StromgrenSphere_3D/README index f4cf4fc6608f4fea5988933000877b1f375e2785..69bbb63c5e2398da5109899db0ca9d717dd5c0ae 100644 --- a/examples/RadiativeTransferTests/StromgrenSphere_3D/README +++ b/examples/RadiativeTransferTests/StromgrenSphere_3D/README @@ -61,7 +61,7 @@ https://github.com/SWIFTSIM/swiftsim-rt-tools/blob/main/additionalTests/instruct To use the SPHM1 RT model, compile with : for propagation test: - --with-rt=SPHM1RT_1 --with-stars=basic --with-feedback=none --with-sundials=$SUNDIALS_ROOT + --with-rt=SPHM1RT_4 --with-stars=basic --with-feedback=none --with-sundials=$SUNDIALS_ROOT for Stromgren3D test: --with-rt=SPHM1RT_4 --with-stars=basic --with-feedback=none --with-sundials=$SUNDIALS_ROOT diff --git a/examples/RadiativeTransferTests/StromgrenSphere_3D/propagationTest-3D.yml b/examples/RadiativeTransferTests/StromgrenSphere_3D/propagationTest-3D.yml index db02aad603371173f86423a56f7db4f4d574b4cc..3fa7414add7e5f2dafd8f5c5a0651a953b79e288 100644 --- a/examples/RadiativeTransferTests/StromgrenSphere_3D/propagationTest-3D.yml +++ b/examples/RadiativeTransferTests/StromgrenSphere_3D/propagationTest-3D.yml @@ -61,9 +61,9 @@ GEARRT: SPHM1RT: cred: 2.99792458e10 # reduce the speed of light in the code unit CFL_condition: 0.1 # CFL condition for RT, independent of hydro - photon_groups_Hz: [] # Photon frequency group bin edges in Hz. Needs to be 1 less than the number of groups (N) requested during the configuration (--with-RT=SPHM1RT_N). + photon_groups_Hz: [0.,1.,2.] # Photon frequency group bin edges in Hz. Needs to be 1 less than the number of groups (N) requested during the configuration (--with-RT=SPHM1RT_N). use_const_emission_rates: 1 # (Optional) use constant emission rates for stars as defined with star_emission_rates_erg_LSol parameter - star_emission_rates: [382600.0] # (Optional) constant star emission rates (1e-28 Lsun) for each photon frequency group to use if use_constant_emission_rates is set. + star_emission_rates: [382600.0, 1e-32, 1e-32, 1e-32] # (Optional) constant star emission rates (1e-28 Lsun) for each photon frequency group to use if use_constant_emission_rates is set. stellar_spectrum_type: 0 # Which radiation spectrum to use. 0: constant from 0 until some max frequency set by stellar_spectrum_const_max_frequency_Hz. 1: blackbody spectrum. stellar_spectrum_const_max_frequency_Hz: 1.e17 # (Conditional) if stellar_spectrum_type=0, use this maximal frequency for the constant spectrum. stars_max_timestep: 1.953125e-06 # update stars every step!