From 744cbda29f7ba7781148c81afe3a81afc570b49c Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 13:25:33 +0100 Subject: [PATCH 1/8] Templated GammaCalculator over m_deriv Made the necessary changes to GammaCalculator.hpp to template over m_deriv, and implemented the choice over max_spatial_derivative_order in ScalarFieldLevel.cpp/InitialData. --- Examples/ScalarField/ScalarFieldLevel.cpp | 14 ++++++++++++-- Examples/ScalarField/params.txt | 2 +- Source/CCZ4/GammaCalculator.hpp | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Examples/ScalarField/ScalarFieldLevel.cpp b/Examples/ScalarField/ScalarFieldLevel.cpp index 8f5391b5a..a833c9271 100644 --- a/Examples/ScalarField/ScalarFieldLevel.cpp +++ b/Examples/ScalarField/ScalarFieldLevel.cpp @@ -60,8 +60,18 @@ void ScalarFieldLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + } + else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + } } #ifdef CH_USE_HDF5 diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index fe72116eb..d26550ef3 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -# output_path = "" # Main path for all files. Must exist! +# output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5 diff --git a/Source/CCZ4/GammaCalculator.hpp b/Source/CCZ4/GammaCalculator.hpp index 763886039..f439373bf 100644 --- a/Source/CCZ4/GammaCalculator.hpp +++ b/Source/CCZ4/GammaCalculator.hpp @@ -16,6 +16,7 @@ #include "VarsTools.hpp" #include "simd.hpp" +template class GammaCalculator { // Only variables needed are metric @@ -32,7 +33,7 @@ class GammaCalculator }; protected: - const FourthOrderDerivatives + const deriv_t m_deriv; //!< An object for calculating derivatives of the variables public: From c7f5885a1812979e69eeb9f200c9da4669f712ab Mon Sep 17 00:00:00 2001 From: Ericka Florio Date: Wed, 1 May 2024 13:30:38 +0100 Subject: [PATCH 2/8] Altered KerrBHLevel and ApparentHorizonFinderTest Added the choice over max_spatial_derivative_order and new templated format for GammaCalculator to the KerrBH example (InitialData) and ApparentHorizonFinderTest3DLevel.hpp InitialData function (still commented out). --- Examples/KerrBH/KerrBHLevel.cpp | 14 ++++++++++++-- .../ApparentHorizonTest3DLevel.hpp | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Examples/KerrBH/KerrBHLevel.cpp b/Examples/KerrBH/KerrBHLevel.cpp index 5488e66f6..c0d41168f 100644 --- a/Examples/KerrBH/KerrBHLevel.cpp +++ b/Examples/KerrBH/KerrBHLevel.cpp @@ -47,8 +47,18 @@ void KerrBHLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + } + else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + } #ifdef USE_AHFINDER // Diagnostics needed for AHFinder diff --git a/Tests/ApparentHorizonFinderTest3D/ApparentHorizonTest3DLevel.hpp b/Tests/ApparentHorizonFinderTest3D/ApparentHorizonTest3DLevel.hpp index f86247e3b..518de8c17 100755 --- a/Tests/ApparentHorizonFinderTest3D/ApparentHorizonTest3DLevel.hpp +++ b/Tests/ApparentHorizonFinderTest3D/ApparentHorizonTest3DLevel.hpp @@ -82,8 +82,19 @@ class ApparentHorizonTest3DLevel : public GRAMRLevel // Gamma's are not needed // fillAllGhosts(); - // BoxLoops::loop(GammaCalculator(m_dx), m_state_new, m_state_new, - // EXCLUDE_GHOST_CELLS); + // fillAllGhosts(); + /*if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + } + else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + { + GammaCalculator my_gamma_calculator(m_dx); + BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, + EXCLUDE_GHOST_CELLS); + }*/ } virtual void specificEvalRHS(GRLevelData &a_soln, GRLevelData &a_rhs, From 802672fa29d1598032c8cd9871b18988c614d73e Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 16:56:07 +0100 Subject: [PATCH 3/8] Fixed clang formatting In GammaCalculator and ScalarFieldLevel, which the auto tests for pushing to the repo complained about. --- Examples/KerrBH/KerrBHLevel.cpp | 8 ++++---- Examples/ScalarField/ScalarFieldLevel.cpp | 8 ++++---- Examples/ScalarField/params.txt | 2 +- Source/CCZ4/GammaCalculator.hpp | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Examples/KerrBH/KerrBHLevel.cpp b/Examples/KerrBH/KerrBHLevel.cpp index c0d41168f..a6c7fd606 100644 --- a/Examples/KerrBH/KerrBHLevel.cpp +++ b/Examples/KerrBH/KerrBHLevel.cpp @@ -47,17 +47,17 @@ void KerrBHLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + if (m_p.max_spatial_derivative_order == 4) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } - else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + else if (m_p.max_spatial_derivative_order == 6) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } #ifdef USE_AHFINDER diff --git a/Examples/ScalarField/ScalarFieldLevel.cpp b/Examples/ScalarField/ScalarFieldLevel.cpp index a833c9271..34fac7d19 100644 --- a/Examples/ScalarField/ScalarFieldLevel.cpp +++ b/Examples/ScalarField/ScalarFieldLevel.cpp @@ -60,17 +60,17 @@ void ScalarFieldLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + if (m_p.max_spatial_derivative_order == 4) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } - else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + else if (m_p.max_spatial_derivative_order == 6) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } } diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index d26550ef3..6421f63c6 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -# output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! +output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5 diff --git a/Source/CCZ4/GammaCalculator.hpp b/Source/CCZ4/GammaCalculator.hpp index f439373bf..c3710a1a8 100644 --- a/Source/CCZ4/GammaCalculator.hpp +++ b/Source/CCZ4/GammaCalculator.hpp @@ -16,8 +16,7 @@ #include "VarsTools.hpp" #include "simd.hpp" -template -class GammaCalculator +template class GammaCalculator { // Only variables needed are metric template struct Vars From a81c481a9b4f273f24150c654f6bee938b4166d8 Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 16:56:07 +0100 Subject: [PATCH 4/8] Fixed clang formatting In GammaCalculator and ScalarFieldLevel, which the auto tests for pushing to the repo complained about. --- Examples/KerrBH/KerrBHLevel.cpp | 8 ++++---- Examples/ScalarField/ScalarFieldLevel.cpp | 8 ++++---- Examples/ScalarField/params.txt | 2 +- Source/CCZ4/GammaCalculator.hpp | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Examples/KerrBH/KerrBHLevel.cpp b/Examples/KerrBH/KerrBHLevel.cpp index c0d41168f..a6c7fd606 100644 --- a/Examples/KerrBH/KerrBHLevel.cpp +++ b/Examples/KerrBH/KerrBHLevel.cpp @@ -47,17 +47,17 @@ void KerrBHLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + if (m_p.max_spatial_derivative_order == 4) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } - else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + else if (m_p.max_spatial_derivative_order == 6) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } #ifdef USE_AHFINDER diff --git a/Examples/ScalarField/ScalarFieldLevel.cpp b/Examples/ScalarField/ScalarFieldLevel.cpp index a833c9271..34fac7d19 100644 --- a/Examples/ScalarField/ScalarFieldLevel.cpp +++ b/Examples/ScalarField/ScalarFieldLevel.cpp @@ -60,17 +60,17 @@ void ScalarFieldLevel::initialData() m_state_new, m_state_new, INCLUDE_GHOST_CELLS); fillAllGhosts(); - if (m_p.max_spatial_derivative_order == FourthOrderDerivatives) + if (m_p.max_spatial_derivative_order == 4) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } - else if (m_p.max_spatial_derivative_order == SixthOrderDerivatives) + else if (m_p.max_spatial_derivative_order == 6) { GammaCalculator my_gamma_calculator(m_dx); BoxLoops::loop(my_gamma_calculator, m_state_new, m_state_new, - EXCLUDE_GHOST_CELLS); + EXCLUDE_GHOST_CELLS); } } diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index d26550ef3..6421f63c6 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -# output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! +output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5 diff --git a/Source/CCZ4/GammaCalculator.hpp b/Source/CCZ4/GammaCalculator.hpp index f439373bf..c3710a1a8 100644 --- a/Source/CCZ4/GammaCalculator.hpp +++ b/Source/CCZ4/GammaCalculator.hpp @@ -16,8 +16,7 @@ #include "VarsTools.hpp" #include "simd.hpp" -template -class GammaCalculator +template class GammaCalculator { // Only variables needed are metric template struct Vars From cc83fadcd9de7b37fc09aae836b15c068ce38e92 Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 17:05:04 +0100 Subject: [PATCH 5/8] Another formatting fix --- Source/CCZ4/GammaCalculator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CCZ4/GammaCalculator.hpp b/Source/CCZ4/GammaCalculator.hpp index c3710a1a8..4da58d483 100644 --- a/Source/CCZ4/GammaCalculator.hpp +++ b/Source/CCZ4/GammaCalculator.hpp @@ -16,7 +16,7 @@ #include "VarsTools.hpp" #include "simd.hpp" -template class GammaCalculator +template class GammaCalculator { // Only variables needed are metric template struct Vars From 1aacb88da9ae7bfc8dcbaea10318d06d67a0ae6d Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 18:03:03 +0100 Subject: [PATCH 6/8] Reset params output_path variable to be blank --- Examples/ScalarField/params.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index 6421f63c6..dc72f0e37 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! +output_path = "" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5 From 42539fffa63c47e6f25c95b218440a139e2e85c0 Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 18:03:03 +0100 Subject: [PATCH 7/8] Reset params output_path variable to be blank --- Examples/ScalarField/params.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index 6421f63c6..dc72f0e37 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -output_path = "/nfs/st01/hpc-gr-epss/eaf49/dump" # Main path for all files. Must exist! +output_path = "" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5 From 90a6923e7470e1e32f68470b90cd31d84a6dd8cf Mon Sep 17 00:00:00 2001 From: the-florist Date: Wed, 1 May 2024 18:20:28 +0100 Subject: [PATCH 8/8] Commented out output_path in SF params --- Examples/ScalarField/params.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/ScalarField/params.txt b/Examples/ScalarField/params.txt index dc72f0e37..fe72116eb 100644 --- a/Examples/ScalarField/params.txt +++ b/Examples/ScalarField/params.txt @@ -7,7 +7,7 @@ verbosity = 0 # location / naming of output files -output_path = "" # Main path for all files. Must exist! +# output_path = "" # Main path for all files. Must exist! chk_prefix = ScalarField_ plot_prefix = ScalarFieldp_ # restart_file = ScalarField_000000.3d.hdf5