Skip to content

Commit

Permalink
Merge branch 'all/streamInfo_for_core_interfaces' into develop (PR #1133
Browse files Browse the repository at this point in the history
)

This merge adds the domain % streamInfo instance of an MPAS_streamInfo_type type
as an argument to the setup_packages and get_mesh_stream core interface routines
for all cores. Before the calls to these two core interface routines in
mpas_init, the streamInfo instance has been initialized with the core's streams
XML file, enabling cores to make decisions based on the streams XML file
regarding packages and the stream to provide the mesh information for a core.

* all/streamInfo_for_core_interfaces:
  Add streamInfo argument to the get_mesh_stream routine for all cores
  Add streamInfo argument to the setup_packages routine for all cores
  • Loading branch information
mgduda committed Jan 19, 2024
2 parents 2f6a2c1 + 8343107 commit b8b9453
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 22 deletions.
10 changes: 6 additions & 4 deletions src/core_atmosphere/mpas_atm_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ end subroutine atm_setup_domain
!> not allocated until after this routine has been called.
!
!-----------------------------------------------------------------------
function atm_setup_packages(configs, packages, iocontext) result(ierr)
function atm_setup_packages(configs, streamInfo, packages, iocontext) result(ierr)

use mpas_dmpar
use mpas_derived_types, only : mpas_pool_type, mpas_io_context_type
use mpas_derived_types, only : mpas_pool_type, mpas_io_context_type, MPAS_streamInfo_type
use mpas_pool_routines, only : mpas_pool_get_config, mpas_pool_get_package

#ifdef DO_PHYSICS
Expand All @@ -113,6 +113,7 @@ function atm_setup_packages(configs, packages, iocontext) result(ierr)
implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packages
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: ierr
Expand Down Expand Up @@ -336,15 +337,16 @@ end function atm_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function atm_get_mesh_stream(configs, stream) result(ierr)
function atm_get_mesh_stream(configs, streamInfo, stream) result(ierr)

use mpas_kind_types, only : StrKIND
use mpas_derived_types, only : mpas_pool_type
use mpas_derived_types, only : mpas_pool_type, MPAS_streamInfo_type
use mpas_pool_routines, only : mpas_pool_get_config

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
10 changes: 6 additions & 4 deletions src/core_init_atmosphere/mpas_init_atm_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ end subroutine init_atm_setup_domain
!> not allocated until after this routine has been called.
!
!-----------------------------------------------------------------------
function init_atm_setup_packages(configs, packages, iocontext) result(ierr)
function init_atm_setup_packages(configs, streamInfo, packages, iocontext) result(ierr)

use mpas_derived_types, only : mpas_pool_type, mpas_io_context_type
use mpas_derived_types, only : mpas_pool_type, mpas_io_context_type, MPAS_streamInfo_type
use mpas_pool_routines, only : mpas_pool_get_config, mpas_pool_get_package

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packages
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: ierr
Expand Down Expand Up @@ -420,15 +421,16 @@ end function init_atm_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function init_atm_get_mesh_stream(configs, stream) result(ierr)
function init_atm_get_mesh_stream(configs, streamInfo, stream) result(ierr)

use mpas_kind_types, only : StrKIND
use mpas_derived_types, only : mpas_pool_type
use mpas_derived_types, only : mpas_pool_type, MPAS_streamInfo_type
use mpas_pool_routines, only : mpas_pool_get_config

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
6 changes: 4 additions & 2 deletions src/core_landice/mode_forward/mpas_li_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ end subroutine li_setup_domain!}}}
!> *not* allocated until after this routine is called.
!
!-----------------------------------------------------------------------
function li_setup_packages(configPool, packagePool, iocontext) result(ierr)
function li_setup_packages(configPool, streamInfo, packagePool, iocontext) result(ierr)

implicit none
type (mpas_pool_type), intent(inout) :: configPool
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packagePool
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: ierr
Expand Down Expand Up @@ -236,11 +237,12 @@ end function li_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function li_get_mesh_stream(configs, stream) result(ierr)
function li_get_mesh_stream(configs, streamInfo, stream) result(ierr)

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
6 changes: 4 additions & 2 deletions src/core_ocean/driver/mpas_ocn_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ end subroutine ocn_setup_domain!}}}
!> *not* allocated until after this routine is called.
!
!-----------------------------------------------------------------------
function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{
function ocn_setup_packages(configPool, streamInfo, packagePool, iocontext) result(ierr)!{{{

use ocn_analysis_driver

type (mpas_pool_type), intent(inout) :: configPool
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packagePool
type (mpas_io_context_type), intent(inout) :: iocontext

Expand Down Expand Up @@ -529,14 +530,15 @@ end function ocn_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function ocn_get_mesh_stream(configs, stream) result(ierr)!{{{
function ocn_get_mesh_stream(configs, streamInfo, stream) result(ierr)!{{{

use mpas_derived_types
use mpas_pool_routines

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
6 changes: 4 additions & 2 deletions src/core_seaice/model_forward/mpas_seaice_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ end subroutine seaice_setup_domain!}}}
!> *not* allocated until after this routine is called.
!
!-----------------------------------------------------------------------
function seaice_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{
function seaice_setup_packages(configPool, streamInfo, packagePool, iocontext) result(ierr)!{{{

use mpas_derived_types

implicit none

type (mpas_pool_type), intent(inout) :: configPool
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packagePool
type (mpas_io_context_type), intent(inout) :: iocontext

Expand Down Expand Up @@ -718,14 +719,15 @@ end function seaice_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function seaice_get_mesh_stream(configs, stream) result(ierr)!{{{
function seaice_get_mesh_stream(configs, streamInfo, stream) result(ierr)!{{{

use mpas_derived_types
use mpas_pool_routines

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
6 changes: 4 additions & 2 deletions src/core_sw/mpas_sw_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ end subroutine sw_setup_domain!}}}
!> *not* allocated until after this routine is called.
!
!-----------------------------------------------------------------------
function sw_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{
function sw_setup_packages(configPool, streamInfo, packagePool, iocontext) result(ierr)!{{{

use mpas_derived_types

implicit none

type (mpas_pool_type), intent(inout) :: configPool
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packagePool
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: ierr
Expand Down Expand Up @@ -234,14 +235,15 @@ end function sw_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function sw_get_mesh_stream(configs, stream) result(ierr)!{{{
function sw_get_mesh_stream(configs, streamInfo, stream) result(ierr)!{{{

use mpas_derived_types
use mpas_pool_routines

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
6 changes: 4 additions & 2 deletions src/core_test/mpas_test_core_interface.F
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ end subroutine test_setup_domain!}}}
!> *not* allocated until after this routine is called.
!
!-----------------------------------------------------------------------
function test_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{
function test_setup_packages(configPool, streamInfo, packagePool, iocontext) result(ierr)!{{{

use mpas_derived_types

implicit none

type (mpas_pool_type), intent(inout) :: configPool
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packagePool
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: ierr
Expand Down Expand Up @@ -268,14 +269,15 @@ end function test_setup_log!}}}
!> are available.
!
!-----------------------------------------------------------------------
function test_get_mesh_stream(configs, stream) result(ierr)!{{{
function test_get_mesh_stream(configs, streamInfo, stream) result(ierr)!{{{

use mpas_derived_types
use mpas_pool_routines

implicit none

type (mpas_pool_type), intent(inout) :: configs
type (MPAS_streamInfo_type), intent(inout) :: streamInfo
character(len=StrKIND), intent(out) :: stream
integer :: ierr

Expand Down
5 changes: 3 additions & 2 deletions src/driver/mpas_subdriver.F
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ end subroutine xml_stream_get_attributes
call mpas_log_write('Package definition failed for core '//trim(domain_ptr % core % coreName), messageType=MPAS_LOG_CRIT)
end if
ierr = domain_ptr % core % setup_packages(domain_ptr % configs, domain_ptr % packages, domain_ptr % iocontext)
ierr = domain_ptr % core % setup_packages(domain_ptr % configs, domain_ptr % streamInfo, domain_ptr % packages, &
domain_ptr % iocontext)
if ( ierr /= 0 ) then
call mpas_log_write('Package setup failed for core '//trim(domain_ptr % core % coreName), messageType=MPAS_LOG_CRIT)
end if
Expand Down Expand Up @@ -296,7 +297,7 @@ end subroutine xml_stream_get_attributes
! Using information from the namelist, a graph.info file, and a file containing
! mesh fields, build halos and allocate blocks in the domain
!
ierr = domain_ptr % core % get_mesh_stream(domain_ptr % configs, mesh_stream)
ierr = domain_ptr % core % get_mesh_stream(domain_ptr % configs, domain_ptr % streamInfo, mesh_stream)
if ( ierr /= 0 ) then
call mpas_log_write('Failed to find mesh stream for core '//trim(domain_ptr % core % coreName), messageType=MPAS_LOG_CRIT)
end if
Expand Down
8 changes: 6 additions & 2 deletions src/framework/mpas_core_types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
end interface

abstract interface
function mpas_setup_packages_function(configs, packages, iocontext) result(iErr)
function mpas_setup_packages_function(configs, streamInfo, packages, iocontext) result(iErr)
import mpas_pool_type
import mpas_io_context_type
import mpas_streaminfo_type

type (mpas_pool_type), intent(inout) :: configs
type (mpas_streaminfo_type), intent(inout) :: streamInfo
type (mpas_pool_type), intent(inout) :: packages
type (mpas_io_context_type), intent(inout) :: iocontext
integer :: iErr
Expand All @@ -42,11 +44,13 @@
end interface

abstract interface
function mpas_get_mesh_stream_function(configs, stream) result(iErr)
function mpas_get_mesh_stream_function(configs, streamInfo, stream) result(iErr)
use mpas_kind_types
import mpas_pool_type
import mpas_streaminfo_type

type (mpas_pool_type), intent(inout) :: configs
type (mpas_streaminfo_type), intent(inout) :: streamInfo
character (len=StrKIND), intent(out) :: stream
integer :: iErr
end function mpas_get_mesh_stream_function
Expand Down

0 comments on commit b8b9453

Please sign in to comment.