diff --git a/README.md b/README.md index cc38c2fbbc..f4145ad8b1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -MPAS-v8.4.2-1.18 +MPAS-v8.4.2-1.19 ==== The Model for Prediction Across Scales (MPAS) is a collaborative project for diff --git a/src/core_atmosphere/Registry.xml b/src/core_atmosphere/Registry.xml index c54f3e21e6..c2a9fea3c7 100644 --- a/src/core_atmosphere/Registry.xml +++ b/src/core_atmosphere/Registry.xml @@ -32,17 +32,17 @@ description="The number of atmospheric layers"/> -#ifdef MPAS_UFS_DYCORE - - -#endif -#ifdef DO_PHYSICS +#if defined(DO_PHYSICS) || defined(MPAS_UFS_DYCORE) + + +#endif +#ifdef DO_PHYSICS - - -#endif -#ifdef MPAS_UFS_DYCORE - - - - - - - - - - - - - - - - #endif @@ -2112,8 +2090,7 @@ -#ifndef MPAS_CAM_DYCORE -#ifndef MPAS_UFS_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) #ifdef MPAS_JEDI_IO @@ -2235,7 +2212,6 @@ #endif #endif -#endif #ifdef DO_PHYSICS @@ -2552,8 +2528,7 @@ -#ifndef MPAS_CAM_DYCORE -#ifndef MPAS_UFS_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) -#endif #endif @@ -2774,6 +2748,21 @@ units="-" description="number of months per year" possible_values="Positive integer values. DO NOT CHANGE."/> + + + + + + #endif @@ -4380,6 +4369,9 @@ #endif #ifdef MPAS_UFS_DYCORE + + + @@ -4404,6 +4396,9 @@ + + + @@ -4427,6 +4422,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #endif @@ -4655,87 +4904,105 @@ - - + + - - - - - - - - - - - - - - - - - + - + - + - + - - - + + - - + + + + + + + + @@ -4769,87 +5036,68 @@ + + description="standard deviation of subgrid-scale orography (meso-scale GWD)"/> + description="orographic convexity (meso-scale GWD)"/> + description="asymmetry of subgrid-scale orography for westerly flow (meso-scale GWD)"/> + description="asymmetry of subgrid-scale orography for southerly flow (meso-scale GWD)"/> + description="asymmetry of subgrid-scale orography for south-westerly flow (meso-scale GWD)"/> + description="asymmetry of subgrid-scale orography for north-westerly flow (meso-scale GWD)"/> + description="effective orographic length for westerly flow (meso-scale GWD)"/> + description="effective orographic length for southerly flow (meso-scale GWD)"/> + description="effective orographic length for south-westerly flow (meso-scale GWD)"/> + description="effective orographic length for north-westerly flow (meso-scale GWD)"/> + description="standard deviation of subgrid-scale orography (small-scale GWD)"/> + description="orographic convexity (small-scale GWD)"/> + description="asymmetry of subgrid-scale orography for westerly flow (small-scale GWD)"/> + description="asymmetry of subgrid-scale orography for southerly flow (small-scale GWD)"/> + description="asymmetry of subgrid-scale orography for south-westerly flow (small-scale GWD)"/> + description="asymmetry of subgrid-scale orography for north-westerly flow (small-scale GWD)"/> + description="effective orographic length for westerly flow (small-scale GWD)"/> + description="effective orographic length for southerly flow (small-scale GWD)"/> + description="effective orographic length for south-westerly flow (small-scale GWD)"/> + description="effective orographic length for north-westerly flow (small-scale GWD)"/> #endif diff --git a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F index df247ce404..e210535b1b 100644 --- a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F +++ b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F @@ -232,7 +232,7 @@ subroutine mpas_atm_dynamics_init(domain) type (domain_type), intent(inout) :: domain -#ifdef MPAS_CAM_DYCORE +#if defined(MPAS_CAM_DYCORE) || defined(MPAS_UFS_DYCORE) ! Used in allocating scratch fields for physics tendencies type (mpas_pool_type), pointer :: tend_physics type (field2DReal), pointer :: tend_ru_physicsField, tend_rtheta_physicsField, tend_rho_physicsField @@ -307,7 +307,7 @@ subroutine mpas_atm_dynamics_init(domain) real (kind=RKIND), dimension(:,:), pointer :: deformation_coef_s #endif -#ifdef MPAS_CAM_DYCORE +#if defined(MPAS_CAM_DYCORE) || defined(MPAS_UFS_DYCORE) nullify(tend_physics) call mpas_pool_get_subpool(domain % blocklist % structs, 'tend_physics', tend_physics) @@ -319,6 +319,17 @@ subroutine mpas_atm_dynamics_init(domain) call mpas_pool_get_field(tend_physics, 'tend_ru_physics', tend_ru_physicsField) call mpas_allocate_scratch_field(tend_ru_physicsField) +#ifdef MPAS_UFS_DYCORE + ! + ! Under UFS these fields persist for the whole run: the UFS coupling layer + ! (atmos_coupling.F90::ufs_physics_to_mpas) overwrites tend_ru_physics and + ! tend_rtheta_physics before every dynamics step, while tend_rho_physics are not + ! (yet) used and must stay zero. + ! + tend_rtheta_physicsField % array(:,:) = 0.0_RKIND + tend_rho_physicsField % array(:,:) = 0.0_RKIND + tend_ru_physicsField % array(:,:) = 0.0_RKIND +#endif #endif #ifdef MPAS_OPENACC @@ -1493,7 +1504,7 @@ subroutine mpas_atm_dynamics_finalize(domain) type (domain_type), intent(inout) :: domain -#ifdef MPAS_CAM_DYCORE +#if defined(MPAS_CAM_DYCORE) || defined(MPAS_UFS_DYCORE) ! Used in allocating scratch fields for physics tendencies type (mpas_pool_type), pointer :: tend_physics type (field2DReal), pointer :: tend_ru_physicsField, tend_rtheta_physicsField, tend_rho_physicsField @@ -1569,7 +1580,7 @@ subroutine mpas_atm_dynamics_finalize(domain) #endif -#ifdef MPAS_CAM_DYCORE +#if defined(MPAS_CAM_DYCORE) || defined(MPAS_UFS_DYCORE) nullify(tend_physics) call mpas_pool_get_subpool(domain % blocklist % structs, 'tend_physics', tend_physics) @@ -1933,7 +1944,7 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group) real (kind=RKIND), dimension(:,:), pointer :: rho_pp, rtheta_pp, ru_p, rw_p, pv_edge, rho_edge real (kind=RKIND) :: theta_local, fac_m -#ifndef MPAS_CAM_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) ! Used in allocating scratch fields for physics tendencies type (field2DReal), pointer :: tend_ru_physicsField, tend_rtheta_physicsField, tend_rho_physicsField #endif @@ -2031,7 +2042,7 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group) end do !$acc end parallel -#ifndef MPAS_CAM_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) call mpas_pool_get_field(tend_physics, 'tend_rtheta_physics', tend_rtheta_physicsField) call mpas_allocate_scratch_field(tend_rtheta_physicsField) @@ -2169,7 +2180,7 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group) #endif #else -#ifndef MPAS_CAM_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) ! ! If no physics are being used, simply zero-out the physics tendency fields ! @@ -2679,7 +2690,7 @@ subroutine atm_srk3(domain, dt, itimestep, exchange_halo_group) deallocate(qtot) ! we are finished with these now !$acc exit data delete(tend_rtheta_physics,tend_rho_physics,tend_ru_physics) -#ifndef MPAS_CAM_DYCORE +#if !defined(MPAS_CAM_DYCORE) && !defined(MPAS_UFS_DYCORE) call mpas_deallocate_scratch_field(tend_rtheta_physicsField) call mpas_deallocate_scratch_field(tend_rho_physicsField) call mpas_deallocate_scratch_field(tend_ru_physicsField) @@ -5056,7 +5067,7 @@ subroutine atm_advance_scalars_work(nCells, num_scalars, dt, & do k=1,nVertLevels do iScalar=1,num_scalars scalar_tend_column(iScalar,k) = 0.0_RKIND -#ifndef DO_PHYSICS +#if !defined(DO_PHYSICS) && !defined(MPAS_UFS_DYCORE) scalar_tend_save(iScalar,k,iCell) = 0.0_RKIND ! testing purposes - we have no sources or sinks #endif end do @@ -5394,7 +5405,7 @@ subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdge do k = 1,nVertLevels do iScalar = 1,num_scalars -#ifndef DO_PHYSICS +#if !defined(DO_PHYSICS) && !defined(MPAS_UFS_DYCORE) scalar_tend(iScalar,k,iCell) = 0.0_RKIND ! testing purposes - we have no sources or sinks #endif scalars_old(iScalar,k,iCell) = scalars_old(iScalar,k,iCell)+dt*scalar_tend(iScalar,k,iCell) / rho_zz_old(k,iCell) diff --git a/src/external/ezxml/CMakeLists.txt b/src/external/ezxml/CMakeLists.txt index 34955dbd98..f820368f24 100644 --- a/src/external/ezxml/CMakeLists.txt +++ b/src/external/ezxml/CMakeLists.txt @@ -1,5 +1,9 @@ -add_library(ezxml ezxml.c) +if(MPAS_UFS_DYCORE) + add_library(ezxml ezxml_shim.c ezxml.c) +else() + add_library(ezxml ezxml.c) +endif() add_library(${PROJECT_NAME}::external::ezxml ALIAS ezxml) target_include_directories(ezxml PUBLIC $) diff --git a/src/external/ezxml/ezxml_shim.c b/src/external/ezxml/ezxml_shim.c new file mode 100644 index 0000000000..85fae38175 --- /dev/null +++ b/src/external/ezxml/ezxml_shim.c @@ -0,0 +1,29 @@ +#include "ezxml_shim.h" + +ezxml_t shim_parse_file(const char *file) { + return ezxml_parse_file(file); +} + +ezxml_t shim_child(ezxml_t xml, const char *name) { + return ezxml_child(xml, name); +} + +ezxml_t shim_next(ezxml_t xml) { + return xml ? xml->next : (ezxml_t)0; +} + +const char *shim_name(ezxml_t xml) { + return xml ? xml->name : (const char *)0; +} + +const char *shim_txt(ezxml_t xml) { + return xml ? xml->txt : ""; +} + +const char *shim_attr(ezxml_t xml, const char *attrname) { + return ezxml_attr(xml, attrname); +} + +void shim_free(ezxml_t xml) { + ezxml_free(xml); +} diff --git a/src/external/ezxml/ezxml_shim.h b/src/external/ezxml/ezxml_shim.h new file mode 100644 index 0000000000..18b5e617d3 --- /dev/null +++ b/src/external/ezxml/ezxml_shim.h @@ -0,0 +1,22 @@ +#ifndef EZXML_SHIM_H +#define EZXML_SHIM_H + +#include "ezxml.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ezxml_t shim_parse_file(const char *file); +ezxml_t shim_child(ezxml_t xml, const char *name); +ezxml_t shim_next(ezxml_t xml); /* next element with the SAME tag name */ +const char *shim_name(ezxml_t xml); +const char *shim_txt(ezxml_t xml); +const char *shim_attr(ezxml_t xml, const char *attrname); +void shim_free(ezxml_t xml); + +#ifdef __cplusplus +} +#endif + +#endif /* EZXML_SHIM_H */