From 975adb5a4c625996cd51d75525621730e6d09dd0 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 04:57:52 +0000 Subject: [PATCH 1/6] Experiments with configuring switches --- CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d29eb500f1..af703ffca4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,9 +15,51 @@ project(WW3 # Options # #]==============================================================================] -## List of switches -# to-do: make configurable -list(APPEND switches "CESMCOUPLED" "DIST" "MPI" "PR1" "FLX4" "ST6" "STAB0" "LN1" "NL1" "BT1" "DB1" "MLIM" "TR0" "BS0" "RWND" "WNX1" "WNT0" "CRX1" "CRT0" "O0" "O1" "O2" "O3" "O4" "O5" "O6" "O7" "O14" "O15" "IS0" "REF0" "NOGRB" "IC4") +## Configuration switches + +set(WW3_SWITCHES "${WW3_USER_SWITCHES}") +# Infrastructure switches, unlikely to change +list(APPEND WW3_SWITCHES "${UserSwitches}" "CESMCOUPLED" "DIST" "MPI" "NOGRB") + +# Check if a switch has been set for each scheme, otherwise set a default +# We don't check that UserSwitches are valid +foreach(pair IN ITEMS + #prefix; default value pair + "PR;PR1" # Propogation scheme + "FLX;FLX4" # Flux computation + "LN;LN1" # Linear Input + "ST;ST6" # input and dissipation + "ST;STAB0" # input and dissipation + "NL;NL1" # nonlinear interactions + "BT;BT1" # bottom friction + "IC;IC4" # damping by sea ice + "IS;IS0" # scattering by sea ice + "REF;REF0" # reflection + "DB;DB1" # depth-induced breaking + "TR;TR0" # triad interactions + "BS;BS0" # bottom scattering + "WNT;WNT0" # wind interpolation (time) + "WNX;WNX1" # wind interpolation (space)) + "CRT;CRT0" # current interpolation (time) + "CRX;CRX1" # current interpolation (space) +) + list(GET pair 0 prefix) + list(GET pair 1 default) + + set(_tmp "${UserSwitches}") + list(FILTER _tmp INCLUDE REGEX "^${prefix}.") + if(_tmp STREQUAL "") + list(APPEND WW3_SWITCHES "${default}") + endif() +endforeach() + +message(STATUS "${WW3_SWITCHES}") + +# output +list(APPEND WW3_SWITCHES "O0" "O1" "O2" "O3" "O4" "O5" "O6" "O7" "O14" "O15") + +# miscellaneous +list(APPEND WW3_SWITCHES "MLIM" "RWND" ) option(WW3_ACCESS3 "Use ACCESS3 dependencies and install ACCESS3 libraries" OFF) option(WW3_OPENMP "Enable OpenMP threading" OFF) @@ -29,11 +71,10 @@ if(NOT WW3_ACCESS3) endif() if(WW3_OPENMP) - list(APPEND switches "OMPG") + list(APPEND WW3_SWITCHES "OMPG") endif() - #[==============================================================================[ # Project configuration # #]==============================================================================] @@ -73,11 +114,11 @@ else() endif() ## Global compile definitions -foreach(switch ${switches}) +foreach(switch ${WW3_SWITCHES}) add_compile_definitions(W3_${switch}) endforeach() -if ("CESMCOUPLED" IN_LIST switches) +if ("CESMCOUPLED" IN_LIST WW3_SWITCHES) add_compile_definitions(CESMCOUPLED) endif() @@ -139,7 +180,7 @@ endif() # Process switches and get list of extra source files include(${CMAKE_CURRENT_SOURCE_DIR}/model/src/cmake/check_switches.cmake) -check_switches("${switches}" switch_files) +check_switches("${WW3_SWITCHES}" switch_files) message(VERBOSE "WW3 switch files: ${switch_files}") include(${CMAKE_CURRENT_SOURCE_DIR}/model/src/cmake/src_list.cmake) From 221633ddbec052f494b77d122731c80a93edcec5 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 05:10:11 +0000 Subject: [PATCH 2/6] better var names --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af703ffca4..f4575ea8b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,8 @@ list(APPEND WW3_SWITCHES "${UserSwitches}" "CESMCOUPLED" "DIST" "MPI" "NOGRB") # Check if a switch has been set for each scheme, otherwise set a default # We don't check that UserSwitches are valid -foreach(pair IN ITEMS - #prefix; default value pair +foreach(_pair IN ITEMS + #prefix; default value _pair "PR;PR1" # Propogation scheme "FLX;FLX4" # Flux computation "LN;LN1" # Linear Input @@ -43,13 +43,13 @@ foreach(pair IN ITEMS "CRT;CRT0" # current interpolation (time) "CRX;CRX1" # current interpolation (space) ) - list(GET pair 0 prefix) - list(GET pair 1 default) + list(GET _pair 0 _prefix) + list(GET _pair 1 _default) set(_tmp "${UserSwitches}") - list(FILTER _tmp INCLUDE REGEX "^${prefix}.") + list(FILTER _tmp INCLUDE REGEX "^${_prefix}.") if(_tmp STREQUAL "") - list(APPEND WW3_SWITCHES "${default}") + list(APPEND WW3_SWITCHES "${_default}") endif() endforeach() From 3183e1b992f411760cf25b2c719b2782030e0133 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 05:18:55 +0000 Subject: [PATCH 3/6] better var names --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4575ea8b1..08b3d1a5ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,8 @@ project(WW3 ## Configuration switches -set(WW3_SWITCHES "${WW3_USER_SWITCHES}") -# Infrastructure switches, unlikely to change -list(APPEND WW3_SWITCHES "${UserSwitches}" "CESMCOUPLED" "DIST" "MPI" "NOGRB") +set(WW3_USER_SWITCHES) +list(APPEND WW3_SWITCHES "${${WW3_USER_SWITCHES}}") # Check if a switch has been set for each scheme, otherwise set a default # We don't check that UserSwitches are valid @@ -53,14 +52,17 @@ foreach(_pair IN ITEMS endif() endforeach() -message(STATUS "${WW3_SWITCHES}") - +# Infrastructure switches, unlikely to change +list(APPEND WW3_SWITCHES "${UserSwitches}" "CESMCOUPLED" "DIST" "MPI" "NOGRB") # output list(APPEND WW3_SWITCHES "O0" "O1" "O2" "O3" "O4" "O5" "O6" "O7" "O14" "O15") # miscellaneous list(APPEND WW3_SWITCHES "MLIM" "RWND" ) +message(WW3_SWITCHES "${WW3_SWITCHES}") + + option(WW3_ACCESS3 "Use ACCESS3 dependencies and install ACCESS3 libraries" OFF) option(WW3_OPENMP "Enable OpenMP threading" OFF) message(STATUS " - WW3_ACCESS3 ${WW3_ACCESS3}") From 950784c9e2f09f967747d8c8e87183396daaad42 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 05:19:57 +0000 Subject: [PATCH 4/6] better var names --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08b3d1a5ee..1ea6b6e9b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(WW3_USER_SWITCHES) list(APPEND WW3_SWITCHES "${${WW3_USER_SWITCHES}}") # Check if a switch has been set for each scheme, otherwise set a default -# We don't check that UserSwitches are valid +# We don't check that WW3_USER_SWITCHES are valid foreach(_pair IN ITEMS #prefix; default value _pair "PR;PR1" # Propogation scheme From a307228381fae300535fd07aa77db9230b8a0ff6 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 05:20:23 +0000 Subject: [PATCH 5/6] better var names --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ea6b6e9b5..0653b9a466 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ list(APPEND WW3_SWITCHES "${${WW3_USER_SWITCHES}}") # Check if a switch has been set for each scheme, otherwise set a default # We don't check that WW3_USER_SWITCHES are valid foreach(_pair IN ITEMS - #prefix; default value _pair + #prefix; default value "PR;PR1" # Propogation scheme "FLX;FLX4" # Flux computation "LN;LN1" # Linear Input From cc9735eb10b0218d05590761f35a82dd265913e3 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Wed, 4 Feb 2026 05:21:02 +0000 Subject: [PATCH 6/6] better var names --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0653b9a466..84c89d9200 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ foreach(_pair IN ITEMS list(GET _pair 0 _prefix) list(GET _pair 1 _default) - set(_tmp "${UserSwitches}") + set(_tmp "${WW3_USER_SWITCHES}") list(FILTER _tmp INCLUDE REGEX "^${_prefix}.") if(_tmp STREQUAL "") list(APPEND WW3_SWITCHES "${_default}")