Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions components/eam/src/physics/cam/gw/gw_convect.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ module gw_convect

public :: gw_convect_init
public :: gw_beres_src
! Only public for bridging/testing
public :: gw_convect_project_winds
public :: gw_heating_depth
public :: gw_storm_speed
public :: gw_convect_gw_sources

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

errstring = ""

#ifndef SCREAM_CONFIG_IS_CMAKE
#ifdef SCREAM_CONFIG_IS_CMAKE
! Just set k_src_wind to pver
k_src_wind = pver
#else
do k = 0, pver
if ( pref_edge(k+1) < plev_src_wind ) k_src_wind = k+1
end do
if ( pref_edge(k+1) < plev_src_wind ) k_src_wind = k+1
end do
#endif

#ifndef SCREAM_CONFIG_IS_CMAKE
Expand Down
10 changes: 9 additions & 1 deletion components/eamxx/scripts/gen_boiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2494,10 +2494,14 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
}"""

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

_, _, _, all_dims, input_scalars, _, _, _ = group_data(arg_data, filter_out_intent="out")
all_scalar_inputs = all_dims + [scalar_name for scalar_name, _ in input_scalars]
scalar_comments = "// " + ", ".join(all_scalar_inputs)

if has_array:
c2f_transpose_code = "" if not need_transpose else \
"""
Expand Down Expand Up @@ -2531,6 +2535,8 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
// Set up inputs
{data_struct} baseline_data[] = {{
// TODO
{scalar_comments}
{data_struct}(),
}};

static constexpr Int num_runs = sizeof(baseline_data) / sizeof({data_struct});{gen_random}
Expand All @@ -2539,6 +2545,7 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
// inout data is in original state
{data_struct} test_data[] = {{
// TODO
{data_struct}(baseline_data[0]),
}};

// Read baseline data
Expand Down Expand Up @@ -2567,6 +2574,7 @@ def gen_cxx_bfb_unit_impl(self, phys, sub, force_arg_data=None):
}}
}}
}} // run_bfb""".format(data_struct=data_struct,
scalar_comments=scalar_comments,
sub=sub,
gen_random=gen_random,
c2f_transpose_code=c2f_transpose_code,
Expand Down
8 changes: 8 additions & 0 deletions components/eamxx/src/physics/gw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ if (NOT EAMXX_ENABLE_GPU OR Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE OR Kokkos
eti/gw_gw_front_project_winds.cpp
eti/gw_gw_front_gw_sources.cpp
eti/gw_gw_cm_src.cpp
eti/gw_gw_convect_project_winds.cpp
eti/gw_gw_heating_depth.cpp
eti/gw_gw_storm_speed.cpp
eti/gw_gw_convect_gw_sources.cpp
eti/gw_gw_beres_src.cpp
eti/gw_gw_ediff.cpp
eti/gw_gw_diff_tend.cpp
eti/gw_gw_oro_src.cpp
) # GW ETI SRCS
endif()

Expand Down
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_beres_src.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_beres_src_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_beres_src on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_convect_gw_sources.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_convect_gw_sources_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_convect_gw_sources on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_convect_project_winds_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_convect_project_winds on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_diff_tend.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_diff_tend_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_diff_tend on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_ediff.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_ediff_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_ediff on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_heating_depth.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_heating_depth_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_heating_depth on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_oro_src.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_oro_src_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_oro_src on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
14 changes: 14 additions & 0 deletions components/eamxx/src/physics/gw/eti/gw_gw_storm_speed.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "impl/gw_gw_storm_speed_impl.hpp"

namespace scream {
namespace gw {

/*
* Explicit instantiation for doing gw_storm_speed on Reals using the
* default device.
*/

template struct Functions<Real,DefaultDevice>;

} // namespace gw
} // namespace scream
162 changes: 162 additions & 0 deletions components/eamxx/src/physics/gw/gw_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,160 @@ struct Functions
const uview_1d<Spack>& xv,
const uview_1d<Spack>& yv,
const uview_1d<Spack>& c);

KOKKOS_FUNCTION
static void gw_convect_project_winds(
// Inputs
const Int& pver,
const Int& ncol,
const uview_1d<const Spack>& u,
const uview_1d<const Spack>& v,
// Outputs
const uview_1d<Spack>& xv,
const uview_1d<Spack>& yv,
const uview_1d<Spack>& ubm,
const uview_1d<Spack>& ubi);

KOKKOS_FUNCTION
static void gw_heating_depth(
// Inputs
const Int& pver,
const Int& ncol,
const Spack& maxq0_conversion_factor,
const Spack& hdepth_scaling_factor,
const bool& use_gw_convect_old,
const uview_1d<const Spack>& zm,
const uview_1d<const Spack>& netdt,
// Outputs
const uview_1d<Int>& mini,
const uview_1d<Int>& maxi,
const uview_1d<Spack>& hdepth,
const uview_1d<Spack>& maxq0_out,
const uview_1d<Spack>& maxq0);

KOKKOS_FUNCTION
static void gw_storm_speed(
// Inputs
const Int& pver,
const Int& ncol,
const Spack& storm_speed_min,
const uview_1d<const Spack>& ubm,
const uview_1d<const Int>& mini,
const uview_1d<const Int>& maxi,
// Outputs
const uview_1d<Int>& storm_speed,
const uview_1d<Spack>& uh,
const uview_1d<Spack>& umin,
const uview_1d<Spack>& umax);

KOKKOS_FUNCTION
static void gw_convect_gw_sources(
// Inputs
const Int& pver,
const Int& pgwv,
const Int& ncol,
const Int& ngwv,
const uview_1d<const Spack>& lat,
const Spack& hdepth_min,
const uview_1d<const Spack>& hdepth,
const uview_1d<const Int>& mini,
const uview_1d<const Int>& maxi,
const uview_1d<const Spack>& netdt,
const uview_1d<const Spack>& uh,
const uview_1d<const Int>& storm_speed,
const uview_1d<const Spack>& maxq0,
const uview_1d<const Spack>& umin,
const uview_1d<const Spack>& umax,
// Outputs
const uview_1d<Spack>& tau);

KOKKOS_FUNCTION
static void gw_beres_src(
// Inputs
const Int& pver,
const Int& pgwv,
const Int& ncol,
const Int& ngwv,
const uview_1d<const Spack>& lat,
const uview_1d<const Spack>& u,
const uview_1d<const Spack>& v,
const uview_1d<const Spack>& netdt,
const uview_1d<const Spack>& zm,
// Outputs
const uview_1d<Int>& src_level,
const uview_1d<Int>& tend_level,
const uview_1d<Spack>& tau,
const uview_1d<Spack>& ubm,
const uview_1d<Spack>& ubi,
const uview_1d<Spack>& xv,
const uview_1d<Spack>& yv,
const uview_1d<Spack>& c,
const uview_1d<Spack>& hdepth,
const uview_1d<Spack>& maxq0_out,
// Inputs
const Spack& maxq0_conversion_factor,
const Spack& hdepth_scaling_factor,
const Spack& hdepth_min,
const Spack& storm_speed_min,
const bool& use_gw_convect_old);

KOKKOS_FUNCTION
static void gw_ediff(
// Inputs
const Int& ncol,
const Int& pver,
const Int& ngwv,
const Int& kbot,
const Int& ktop,
const uview_1d<const Int>& tend_level,
const uview_1d<const Spack>& gwut,
const uview_1d<const Spack>& ubm,
const uview_1d<const Spack>& nm,
const uview_1d<const Spack>& rho,
const Spack& dt,
const Spack& gravit,
const uview_1d<const Spack>& pmid,
const uview_1d<const Spack>& rdpm,
const uview_1d<const Spack>& c,
// Outputs
const uview_1d<Spack>& egwdffi);

KOKKOS_FUNCTION
static void gw_diff_tend(
// Inputs
const Int& ncol,
const Int& pver,
const Int& kbot,
const Int& ktop,
const uview_1d<const Spack>& q,
const Spack& dt,
// Outputs
const uview_1d<Spack>& dq);

KOKKOS_FUNCTION
static void gw_oro_src(
// Inputs
const Int& pver,
const Int& pgwv,
const Int& ncol,
const uview_1d<const Spack>& u,
const uview_1d<const Spack>& v,
const uview_1d<const Spack>& t,
const uview_1d<const Spack>& sgh,
const uview_1d<const Spack>& pmid,
const uview_1d<const Spack>& pint,
const uview_1d<const Spack>& dpm,
const uview_1d<const Spack>& zm,
const uview_1d<const Spack>& nm,
// Outputs
const uview_1d<Int>& src_level,
const uview_1d<Int>& tend_level,
const uview_1d<Spack>& tau,
const uview_1d<Spack>& ubm,
const uview_1d<Spack>& ubi,
const uview_1d<Spack>& xv,
const uview_1d<Spack>& yv,
const uview_1d<Spack>& c);
}; // struct Functions

} // namespace gw
Expand All @@ -301,5 +455,13 @@ struct Functions
# include "impl/gw_gw_front_project_winds_impl.hpp"
# include "impl/gw_gw_front_gw_sources_impl.hpp"
# include "impl/gw_gw_cm_src_impl.hpp"
# include "impl/gw_gw_convect_project_winds_impl.hpp"
# include "impl/gw_gw_heating_depth_impl.hpp"
# include "impl/gw_gw_storm_speed_impl.hpp"
# include "impl/gw_gw_convect_gw_sources_impl.hpp"
# include "impl/gw_gw_beres_src_impl.hpp"
# include "impl/gw_gw_ediff_impl.hpp"
# include "impl/gw_gw_diff_tend_impl.hpp"
# include "impl/gw_gw_oro_src_impl.hpp"
#endif // GPU && !KOKKOS_ENABLE_*_RELOCATABLE_DEVICE_CODE
#endif // P3_FUNCTIONS_HPP
Loading
Loading