Skip to content

Commit fa1885b

Browse files
committed
Merge branch 'jgfouca/more_gw_bridges' into next (PR #7461)
Add remaining cxx -> f90 bridges and bfb unit tests for GWD subroutines GWD subroutines completed here: * gw_convect_init * gw_convect_project_winds * gw_heating_depth * gw_storm_speed * gw_convect_gw_sources * gw_beres_src * gw_ediff * gw_diff_tend * gw_oro_src With this PR, all the bridges we need to begin porting are in place (I think). [BFB] except will require new bfb unit baselines
2 parents a274001 + edede8d commit fa1885b

34 files changed

+2202
-5
lines changed

components/eam/src/physics/cam/gw/gw_convect.F90

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ module gw_convect
1717

1818
public :: gw_convect_init
1919
public :: gw_beres_src
20+
! Only public for bridging/testing
21+
public :: gw_convect_project_winds
22+
public :: gw_heating_depth
23+
public :: gw_storm_speed
24+
public :: gw_convect_gw_sources
2025

2126
! Dimension for heating depth.
2227
integer :: maxh
@@ -42,14 +47,19 @@ subroutine gw_convect_init( plev_src_wind, mfcc_in, errstring)
4247
real(r8), intent(in) :: mfcc_in(:,:,:) ! Source spectra to keep as table
4348
character(len=*), intent(out) :: errstring ! Report any errors from this routine
4449
integer :: ierr
50+
#ifndef SCREAM_CONFIG_IS_CMAKE
4551
integer :: k
52+
#endif
4653

4754
errstring = ""
4855

49-
#ifndef SCREAM_CONFIG_IS_CMAKE
56+
#ifdef SCREAM_CONFIG_IS_CMAKE
57+
! Just set k_src_wind to pver
58+
k_src_wind = pver
59+
#else
5060
do k = 0, pver
51-
if ( pref_edge(k+1) < plev_src_wind ) k_src_wind = k+1
52-
end do
61+
if ( pref_edge(k+1) < plev_src_wind ) k_src_wind = k+1
62+
end do
5363
#endif
5464

5565
#ifndef SCREAM_CONFIG_IS_CMAKE

components/eamxx/scripts/gen_boiler.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,10 +2494,14 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
24942494
}"""
24952495

24962496
_, _, _, _, scalars, real_data, int_data, bool_data = group_data(arg_data, filter_out_intent="in")
2497-
check_scalars, check_arrays = "", ""
2497+
check_scalars, check_arrays, scalar_comments = "", "", ""
24982498
for scalar in scalars:
24992499
check_scalars += f" REQUIRE(d_baseline.{scalar[0]} == d_test.{scalar[0]});\n"
25002500

2501+
_, _, _, all_dims, input_scalars, _, _, _ = group_data(arg_data, filter_out_intent="out")
2502+
all_scalar_inputs = all_dims + [scalar_name for scalar_name, _ in input_scalars]
2503+
scalar_comments = "// " + ", ".join(all_scalar_inputs)
2504+
25012505
if has_array:
25022506
c2f_transpose_code = "" if not need_transpose else \
25032507
"""
@@ -2531,6 +2535,8 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
25312535
// Set up inputs
25322536
{data_struct} baseline_data[] = {{
25332537
// TODO
2538+
{scalar_comments}
2539+
{data_struct}(),
25342540
}};
25352541
25362542
static constexpr Int num_runs = sizeof(baseline_data) / sizeof({data_struct});{gen_random}
@@ -2539,6 +2545,7 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
25392545
// inout data is in original state
25402546
{data_struct} test_data[] = {{
25412547
// TODO
2548+
{data_struct}(baseline_data[0]),
25422549
}};
25432550
25442551
// Read baseline data
@@ -2567,6 +2574,7 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
25672574
}}
25682575
}}
25692576
}} // run_bfb""".format(data_struct=data_struct,
2577+
scalar_comments=scalar_comments,
25702578
sub=sub,
25712579
gen_random=gen_random,
25722580
c2f_transpose_code=c2f_transpose_code,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ if (NOT EAMXX_ENABLE_GPU OR Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE OR Kokkos
2323
eti/gw_gw_front_project_winds.cpp
2424
eti/gw_gw_front_gw_sources.cpp
2525
eti/gw_gw_cm_src.cpp
26+
eti/gw_gw_convect_project_winds.cpp
27+
eti/gw_gw_heating_depth.cpp
28+
eti/gw_gw_storm_speed.cpp
29+
eti/gw_gw_convect_gw_sources.cpp
30+
eti/gw_gw_beres_src.cpp
31+
eti/gw_gw_ediff.cpp
32+
eti/gw_gw_diff_tend.cpp
33+
eti/gw_gw_oro_src.cpp
2634
) # GW ETI SRCS
2735
endif()
2836

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_beres_src_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_beres_src on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_convect_gw_sources_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_convect_gw_sources on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_convect_project_winds_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_convect_project_winds on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_diff_tend_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_diff_tend on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_ediff_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_ediff on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_heating_depth_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_heating_depth on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "impl/gw_gw_oro_src_impl.hpp"
2+
3+
namespace scream {
4+
namespace gw {
5+
6+
/*
7+
* Explicit instantiation for doing gw_oro_src on Reals using the
8+
* default device.
9+
*/
10+
11+
template struct Functions<Real,DefaultDevice>;
12+
13+
} // namespace gw
14+
} // namespace scream

0 commit comments

Comments
 (0)