Skip to content

Commit 2fea744

Browse files
committed
Merge branch 'jgfouca/gw_bridge_cmake_cleanup' into master (PR #7733)
Eamxx: clean up GW Cmake There is no reason to build the f90 bridge stuff in the top-level GW. It's only needed for testing. Also, add a placeholder gw_process so that there is at least one source file in the library when ETI is off. [BFB]
2 parents 871f2f1 + faa55eb commit 2fea744

File tree

4 files changed

+89
-16
lines changed

4 files changed

+89
-16
lines changed

components/eamxx/src/physics/gw/CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
set(PATH_TO_LEGACY_GW ${SCREAM_BASE_DIR}/../eam/src/physics/cam/gw)
21
set(GW_SRCS
3-
${PATH_TO_LEGACY_GW}/gw_utils.F90
4-
${PATH_TO_LEGACY_GW}/gw_common.F90
5-
${PATH_TO_LEGACY_GW}/gw_convect.F90
6-
${PATH_TO_LEGACY_GW}/gw_diffusion.F90
7-
${PATH_TO_LEGACY_GW}/gw_front.F90
8-
${PATH_TO_LEGACY_GW}/gw_oro.F90
9-
${PATH_TO_LEGACY_GW}/../vdiff_lu_solver.F90
10-
${CMAKE_CURRENT_SOURCE_DIR}/tests/infra/gw_iso_c.f90
2+
eamxx_gw_process_interface.cpp
113
)
124

135
# Add ETI source files if not on CUDA/HIP
@@ -38,16 +30,10 @@ if (NOT EAMXX_ENABLE_GPU OR Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE OR Kokkos
3830
endif()
3931

4032
add_library(gw ${GW_SRCS})
41-
set_target_properties(gw PROPERTIES
42-
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules
43-
)
4433

4534
target_include_directories(gw PUBLIC
4635
${CMAKE_CURRENT_SOURCE_DIR}
47-
${CMAKE_CURRENT_BINARY_DIR}/modules
4836
${CMAKE_CURRENT_SOURCE_DIR}/impl
49-
${PATH_TO_LEGACY_GW}
50-
${PATH_TO_LEGACY_GW}/..
5137
)
5238
target_link_libraries(gw physics_share scream_share)
5339

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "gw_functions.hpp"
2+
#include "eamxx_gw_process_interface.hpp"
3+
4+
#include <ekat_assert.hpp>
5+
#include <ekat_units.hpp>
6+
7+
#include <array>
8+
9+
namespace scream
10+
{
11+
12+
// =========================================================================================
13+
GWMicrophysics::GWMicrophysics(const ekat::Comm& comm, const ekat::ParameterList& params)
14+
: AtmosphereProcess(comm, params)
15+
{
16+
// Nothing to do here
17+
}
18+
19+
// =========================================================================================
20+
void GWMicrophysics::set_grids(const std::shared_ptr<const GridsManager> grids_manager)
21+
{
22+
m_grid = grids_manager->get_grid("physics");
23+
}
24+
25+
// =========================================================================================
26+
} // namespace scream
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#ifndef SCREAM_GW_MICROPHYSICS_HPP
2+
#define SCREAM_GW_MICROPHYSICS_HPP
3+
4+
#include "share/atm_process/atmosphere_process.hpp"
5+
#include "physics/gw/gw_functions.hpp"
6+
#include "share/physics/eamxx_common_physics_functions.hpp"
7+
8+
#include <ekat_parameter_list.hpp>
9+
10+
#include <string>
11+
12+
namespace scream
13+
{
14+
/*
15+
* The class responsible to handle the gravity wave physics
16+
*
17+
* The AD should store exactly ONE instance of this class stored
18+
* in its list of subcomponents (the AD should make sure of this).
19+
*
20+
* This is currently just a placeholder
21+
*/
22+
23+
class GWMicrophysics : public AtmosphereProcess
24+
{
25+
public:
26+
// Constructors
27+
GWMicrophysics (const ekat::Comm& comm, const ekat::ParameterList& params);
28+
29+
// The type of subcomponent
30+
AtmosphereProcessType type () const { return AtmosphereProcessType::Physics; }
31+
32+
// The name of the subcomponent
33+
std::string name () const { return "gw"; }
34+
35+
// Set the grid
36+
void set_grids (const std::shared_ptr<const GridsManager> grids_manager);
37+
38+
protected:
39+
std::shared_ptr<const AbstractGrid> m_grid;
40+
}; // class GWMicrophysics
41+
42+
} // namespace scream
43+
44+
#endif // SCREAM_GW_MICROPHYSICS_HPP
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
set(PATH_TO_LEGACY_GW ${SCREAM_BASE_DIR}/../eam/src/physics/cam/gw)
12
set(INFRA_SRCS
23
gw_test_data.cpp
34
gw_iso_c.f90
5+
${PATH_TO_LEGACY_GW}/gw_utils.F90
6+
${PATH_TO_LEGACY_GW}/gw_common.F90
7+
${PATH_TO_LEGACY_GW}/gw_convect.F90
8+
${PATH_TO_LEGACY_GW}/gw_diffusion.F90
9+
${PATH_TO_LEGACY_GW}/gw_front.F90
10+
${PATH_TO_LEGACY_GW}/gw_oro.F90
11+
${PATH_TO_LEGACY_GW}/../vdiff_lu_solver.F90
12+
)
13+
14+
set_target_properties(gw PROPERTIES
15+
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules
416
)
517

618
add_library(gw_test_infra ${INFRA_SRCS})
719
target_link_libraries(gw_test_infra PUBLIC gw scream_test_support)
8-
target_include_directories(gw_test_infra PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
20+
target_include_directories(gw_test_infra PUBLIC
21+
${CMAKE_CURRENT_SOURCE_DIR}
22+
${CMAKE_CURRENT_BINARY_DIR}/modules
23+
${PATH_TO_LEGACY_GW}
24+
${PATH_TO_LEGACY_GW}/..
25+
)

0 commit comments

Comments
 (0)