From ff381c451b677b47449dce62fd0778685574db37 Mon Sep 17 00:00:00 2001 From: David Bold Date: Mon, 22 Jul 2024 11:13:05 +0200 Subject: [PATCH 1/3] Allow to compile custom BOUT++ directory It can be convinient if you want your own version of BOUT++, but want to compile both BOUT++ and hermes for different architectures / os or with different flags. This allows to have only one source for BOUT++ and on for hermes-3. You only need to invoke cmake and make/ninja just once per build and get always updates from BOUT++ and hermes-3 code changes. An example cmake invocation can now look like this: `cmake -S . -B build-opt -DHERMES_BUILD_BOUT=ON -DHERMES_UPDATE_GIT_SUBMODULE=OFF -DHERMES_TESTS=OFF -DHERMES_UNIT_TESTS=OFF -DHERMES_BOUT_SRC=$HOME/soft/BOUT-dev -DBOUT_ENABLE_METRIC_3D=ON -DBOUT_ENABLE_PYTHON=OFF -DBOUT_USE_FFTW=OFF -DBOUT_UPDATE_GIT_SUBMODULE=OFF -DBOUT_USE_PETSC=ON -DBOUT_USE_SUNDIALS=ON -DCHECK=0 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -march=native -g -DNDEBUG"` or for a build with debugging: `cmake -S . -B build-debug -DHERMES_BUILD_BOUT=ON -DHERMES_UPDATE_GIT_SUBMODULE=OFF -DHERMES_TESTS=OFF -DHERMES_UNIT_TESTS=OFF -DHERMES_BOUT_SRC=$HOME/soft/BOUT-dev -DBOUT_ENABLE_METRIC_3D=ON -DBOUT_ENABLE_PYTHON=OFF -DBOUT_USE_FFTW=OFF -DBOUT_UPDATE_GIT_SUBMODULE=OFF -DBOUT_USE_PETSC=ON -DBOUT_USE_SUNDIALS=ON -DCHECK=4 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-Og -march=native -g -DNDEBUG"` This ensures that BOUT++ and hermes-3 also use the same flags for compilation, which makes it easier to check the impact of such changes. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98a96282..a3e47535 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,8 @@ message(STATUS "Git revision: ${HERMES_REVISION}") option(HERMES_BUILD_BOUT "Build BOUT++ in external/BOUT-dev" ON) if(HERMES_BUILD_BOUT) set(BOUT_BUILD_EXAMPLES, OFF) # Don't create example makefiles - add_subdirectory(external/BOUT-dev) + option(HERMES_BOUT_SRC "Directory of BOUT++ dir" external/BOUT-dev) + add_subdirectory(${HERMES_BOUT_SRC} ${CMAKE_CURRENT_BINARY_DIR}/external/BOUT-dev) else() find_package(bout++ REQUIRED) endif() From 970345f4f30394185e860181daccab4ff4705f9c Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 24 Jul 2024 10:44:47 +0200 Subject: [PATCH 2/3] Fix: option is for boolean, set for everything --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3e47535..12000d20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ message(STATUS "Git revision: ${HERMES_REVISION}") option(HERMES_BUILD_BOUT "Build BOUT++ in external/BOUT-dev" ON) if(HERMES_BUILD_BOUT) set(BOUT_BUILD_EXAMPLES, OFF) # Don't create example makefiles - option(HERMES_BOUT_SRC "Directory of BOUT++ dir" external/BOUT-dev) + set(HERMES_BOUT_SRC "external/BOUT-dev" CACHE STRING "Directory of BOUT++ dir") add_subdirectory(${HERMES_BOUT_SRC} ${CMAKE_CURRENT_BINARY_DIR}/external/BOUT-dev) else() find_package(bout++ REQUIRED) From 519306ba432390d838a3b1738576235c6ae90e73 Mon Sep 17 00:00:00 2001 From: John Lloyd Baker <101975363+PoloidalLloyd@users.noreply.github.com> Date: Fri, 2 Aug 2024 18:09:19 +0100 Subject: [PATCH 3/3] Fixing kappa_par conversion (#238) Added Tnorm division to kappa_par conversion --- src/evolve_pressure.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evolve_pressure.cxx b/src/evolve_pressure.cxx index 38f1e9f4..265cf20a 100644 --- a/src/evolve_pressure.cxx +++ b/src/evolve_pressure.cxx @@ -432,7 +432,7 @@ void EvolvePressure::outputVars(Options& state) { set_with_attrs(state[std::string("kappa_par_") + name], kappa_par, {{"time_dimension", "t"}, {"units", "W / m / eV"}, - {"conversion", Pnorm * Omega_ci * SQ(rho_s0)}, + {"conversion", (Pnorm * Omega_ci * SQ(rho_s0) )/ Tnorm}, {"long_name", name + " heat conduction coefficient"}, {"species", name}, {"source", "evolve_pressure"}});