Skip to content

Commit

Permalink
Merge pull request #2233 from GEOS-ESM/feature/mathomp4/2133-pre-esmf…
Browse files Browse the repository at this point in the history
…-file

Fixes #2133. Add ability to set ESMF Logging mode at Run Time
  • Loading branch information
mathomp4 authored Jul 20, 2023
2 parents 6084c6c + 64c00b3 commit 483096b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added ability to use an `ESMF.rc` file to pass in pre-`ESMF_Initialize` options to ESMF (see [ESMF Docs](https://earthsystemmodeling.org/docs/release/latest/ESMF_refdoc/node4.html#SECTION04024000000000000000) for allowed flags.
- NOTE: File *must* be called `ESMF.rc`
- Added ability to run ExtDataDriver.x on a MAPL "tile" grid
- Add ability to introduce a time-step delay in ExtDataDriver.x to simulate the timestep latency of a real model
- Added a MAPL\_Sleep function, equivalent to some vendor supplied but non-standard sleep function
Expand Down
21 changes: 19 additions & 2 deletions gridcomps/Cap/MAPL_Cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,32 @@ subroutine run_model(this, comm, unusable, rc)
integer, optional, intent(out) ::rc

integer(kind=INT64) :: start_tick, stop_tick, tick_rate
integer :: rank, ierror
integer :: status
class(Logger), pointer :: lgr
logical :: file_exists

_UNUSED_DUMMY(unusable)

call start_timer()

call ESMF_Initialize (logKindFlag=this%cap_options%esmf_logging_mode, mpiCommunicator=comm, rc=status)
_VERIFY(status)
! Look for a file called "ESMF.rc" but we want to do this on root and then
! broadcast the result to the other ranks

call MPI_COMM_RANK(comm, rank, ierror)

if (rank == 0) then
inquire(file='ESMF.rc', exist=file_exists)
end if
call MPI_BCAST(file_exists, 1, MPI_LOGICAL, 0, comm, ierror)

! If the file exists, we pass it into ESMF_Initialize, else, we
! use the one from the command line arguments
if (file_exists) then
call ESMF_Initialize (configFileName='ESMF.rc', mpiCommunicator=comm, _RC)
else
call ESMF_Initialize (logKindFlag=this%cap_options%esmf_logging_mode, mpiCommunicator=comm, _RC)
end if

! Note per ESMF this is a temporary routine as eventually MOAB will
! be the only mesh generator. But until then, this allows us to
Expand Down

0 comments on commit 483096b

Please # to comment.