Skip to content

Commit

Permalink
remove FoX depdencies (#17)
Browse files Browse the repository at this point in the history
* remove FoX depdencies
* remove fox submodule
* update streamfilename

Co-authored-by: Jun Wang <junwang-noaa@users.noreply.github.com>
  • Loading branch information
junwang-noaa and junwang-noaa authored Apr 14, 2021
1 parent c4c30bd commit 69a3a61
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "fox"]
path = fox
url = https://github.com/ESMCI/fox.git
11 changes: 7 additions & 4 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module atm_comp_nuopc
use shr_cal_mod , only : shr_cal_ymd2date, shr_cal_ymd2julian, shr_cal_date2julian
use shr_mpi_mod , only : shr_mpi_bcast
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_get_stream_pointer, shr_strdata_setOrbs
use dshr_mod , only : dshr_model_initphase, dshr_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
Expand Down Expand Up @@ -111,7 +111,7 @@ module atm_comp_nuopc

! datm_in namelist input
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: streamfilename = nullstr ! filename to obtain stream info from
character(CL) :: dataMode = nullstr ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from
Expand Down Expand Up @@ -392,8 +392,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize stream data type
xmlfilename = 'datm.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ATM', logunit, rc=rc)
streamfilename = 'datm.streams'//trim(inst_suffix)
#ifndef DISABLE_FoX
streamfilename = trim(streamfilename)//'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ATM', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_TraceRegionExit('datm_strdata_init')

Expand Down
11 changes: 7 additions & 4 deletions dice/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module ice_comp_nuopc
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_config, shr_strdata_advance
use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy
use dshr_fldlist_mod , only : fldlist_type, dshr_fldlist_add, dshr_fldlist_realize

Expand Down Expand Up @@ -68,7 +68,7 @@ module ice_comp_nuopc
character(*) , parameter :: nullstr = 'null'

! dice_in namelist input
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: streamfilename = nullstr ! filename to obtain stream info from
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: dataMode ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
Expand Down Expand Up @@ -307,8 +307,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize stream data type
xmlfilename = 'dice.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ICE', logunit, rc=rc)
streamfilename = 'dice.streams'//trim(inst_suffix)
#ifndef DISABLE_FoX
streamfilename = trim(streamfilename)//'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ICE', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_TraceRegionExit('dice_strdata_init')

Expand Down
11 changes: 7 additions & 4 deletions dlnd/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module lnd_comp_nuopc
use shr_mpi_mod , only : shr_mpi_bcast
use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_get_stream_domain
use dshr_strdata_mod , only : shr_strdata_init_from_xml
use dshr_strdata_mod , only : shr_strdata_init_from_config
use dshr_mod , only : dshr_model_initphase, dshr_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init
Expand Down Expand Up @@ -70,7 +70,7 @@ module lnd_comp_nuopc
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from
character(CL) :: model_createmesh_fromfile = nullstr ! full pathname to obtain mask from
character(CL) :: xmlfilename ! filename to obtain stream info from
character(CL) :: streamfilename ! filename to obtain stream info from
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
logical :: force_prognostic_true = .false. ! if true set prognostic true
character(CL) :: restfilm = nullstr ! model restart file namelist
Expand Down Expand Up @@ -287,8 +287,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
model_mask, model_frac, restart_read, rc=rc)

! Initialize stream data type
xmlfilename = 'dlnd.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'LND', logunit, rc=rc)
streamfilename = 'dlnd.streams'//trim(inst_suffix)
#ifndef DISABLE_FoX
streamfilename = trim(streamfilename)'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'LND', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_TraceRegionExit('dlnd_strdata_init')

Expand Down
11 changes: 7 additions & 4 deletions docn/ocn_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module ocn_comp_nuopc
use shr_cal_mod , only : shr_cal_ymd2date
use shr_mpi_mod , only : shr_mpi_bcast
use dshr_methods_mod , only : dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_xml
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_init_from_config
use dshr_mod , only : dshr_model_initphase, dshr_init, dshr_mesh_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock
use dshr_dfield_mod , only : dfield_type, dshr_dfield_add, dshr_dfield_copy
Expand Down Expand Up @@ -81,7 +81,7 @@ module ocn_comp_nuopc
character(*) , parameter :: nullstr = 'null'

! docn_in namelist input
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: streamfilename = nullstr ! filename to obtain stream info from
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: datamode = nullstr ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
Expand Down Expand Up @@ -329,8 +329,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize stream data type if not aqua planet
if (.not. aquaplanet) then
xmlfilename = trim(modelname)//'.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'OCN', logunit, rc=rc)
streamfilename = trim(modelname)//'.streams'//trim(inst_suffix)
#ifndef DISABLE_FoX
streamfilename = trim(streamfilename)//'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'OCN', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
call ESMF_TraceRegionExit('docn_strdata_init')
Expand Down
11 changes: 7 additions & 4 deletions drof/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module rof_comp_nuopc
use shr_mpi_mod , only : shr_mpi_bcast
use dshr_methods_mod , only : dshr_state_getfldptr, dshr_state_diagnose, chkerr, memcheck
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance, shr_strdata_get_stream_domain
use dshr_strdata_mod , only : shr_strdata_init_from_xml
use dshr_strdata_mod , only : shr_strdata_init_from_config
use dshr_mod , only : dshr_model_initphase, dshr_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock
use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init
Expand Down Expand Up @@ -61,7 +61,7 @@ module rof_comp_nuopc
character(CL) :: case_name ! case name
character(*) , parameter :: nullstr = 'null'
! drof_in namelist input
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: streamfilename = nullstr ! filename to obtain stream info from
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: dataMode = nullstr ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
Expand Down Expand Up @@ -285,8 +285,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize stream data type
xmlfilename = 'drof.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ROF', logunit, rc=rc)
streamfilename = 'drof.streams'//trim(inst_suffix)
#ifndef DISABLE_FOX
streamfilename = trim(streamfilename)//'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'ROF', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_TraceRegionExit('drof_strdata_init')

Expand Down
2 changes: 1 addition & 1 deletion dshr/dshr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module dshr_mod
#ifdef CESMCOUPLED
use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat
#endif
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_init_from_xml, SHR_STRDATA_GET_STREAM_COUNT
use dshr_strdata_mod , only : shr_strdata_type, SHR_STRDATA_GET_STREAM_COUNT
use dshr_methods_mod , only : chkerr
use pio

Expand Down
11 changes: 7 additions & 4 deletions dwav/wav_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module wav_comp_nuopc
use shr_mpi_mod , only : shr_mpi_bcast
use dshr_methods_mod , only : dshr_state_getfldptr, chkerr, memcheck, dshr_state_diagnose
use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_advance
use dshr_strdata_mod , only : shr_strdata_init_from_xml
use dshr_strdata_mod , only : shr_strdata_init_from_config
use dshr_mod , only : dshr_model_initphase, dshr_init
use dshr_mod , only : dshr_state_setscalar, dshr_set_runclock, dshr_log_clock_advance
use dshr_mod , only : dshr_restart_read, dshr_restart_write, dshr_mesh_init
Expand Down Expand Up @@ -64,7 +64,7 @@ module wav_comp_nuopc
character(*) , parameter :: nullstr = 'null'

! dwav_in namelist input
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: streamfilename = nullstr ! filename to obtain stream info from
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: dataMode = nullstr ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
Expand Down Expand Up @@ -273,8 +273,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize stream data type if not aqua planet
xmlfilename = 'dwav.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'WAV', logunit, rc=rc)
streamfilename = 'dwav.streams'//trim(inst_suffix)
#ifndef DISABLE_FoX
streamfilename = trim(streamfilename)//'.xml'
#endif
call shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, 'WAV', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_TraceRegionExit('dwav_strdata_init')

Expand Down
1 change: 0 additions & 1 deletion fox
Submodule fox deleted from 7b9488
22 changes: 15 additions & 7 deletions streams/dshr_strdata_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ module dshr_strdata_mod
use dshr_stream_mod , only : shr_stream_streamtype, shr_stream_getModelFieldList, shr_stream_getStreamFieldList
use dshr_stream_mod , only : shr_stream_taxis_cycle, shr_stream_taxis_extend, shr_stream_findBounds
use dshr_stream_mod , only : shr_stream_getCurrFile, shr_stream_setCurrFile, shr_stream_getMeshFilename
use dshr_stream_mod , only : shr_stream_init_from_xml, shr_stream_init_from_inline
use dshr_stream_mod , only : shr_stream_init_from_inline, shr_stream_init_from_esmfconfig
#ifndef DISABLE_FoX
use dshr_stream_mod , only : shr_stream_init_from_xml
#endif
use dshr_stream_mod , only : shr_stream_getnextfilename, shr_stream_getprevfilename, shr_stream_getData
use dshr_tinterp_mod , only : shr_tInterp_getCosz, shr_tInterp_getAvgCosz, shr_tInterp_getFactors
use dshr_methods_mod , only : dshr_fldbun_getfldptr, dshr_fldbun_getfieldN, dshr_fldbun_fldchk, chkerr
Expand All @@ -53,7 +56,7 @@ module dshr_strdata_mod
private

public :: shr_strdata_type
public :: shr_strdata_init_from_xml
public :: shr_strdata_init_from_config
public :: shr_strdata_init_from_inline
public :: shr_strdata_setOrbs
public :: shr_strdata_advance
Expand Down Expand Up @@ -173,11 +176,11 @@ type(ESMF_FieldBundle) function shr_strdata_get_stream_fieldbundle(sdat, ns, nam
end function shr_strdata_get_stream_fieldbundle

!===============================================================================
subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compname, logunit, rc)
subroutine shr_strdata_init_from_config(sdat, streamfilename, model_mesh, clock, compname, logunit, rc)

! input/output variables
type(shr_strdata_type) , intent(inout) :: sdat
character(len=*) , intent(in) :: xmlfilename
character(len=*) , intent(in) :: streamfilename
type(ESMF_Mesh) , intent(in) :: model_mesh
type(ESMF_Clock) , intent(in) :: clock
character(len=*) , intent(in) :: compname
Expand All @@ -187,7 +190,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn
! local variables
type(ESMF_VM) :: vm
integer :: i, localPet
character(len=*), parameter :: subname='(shr_strdata_init_from_xml)'
character(len=*), parameter :: subname='(shr_strdata_init_from_config)'
! ----------------------------------------------
rc = ESMF_SUCCESS
call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
Expand All @@ -210,8 +213,13 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn
! Initialize sdat streams (read xml file for streams)
sdat%masterproc = (localPet == master_task)

call shr_stream_init_from_xml(xmlfilename, sdat%stream, sdat%masterproc, sdat%logunit, &
#ifdef DISABLE_FoX
call shr_stream_init_from_esmfconfig(streamfilename, sdat%stream, sdat%logunit, &
sdat%pio_subsystem, sdat%io_type, sdat%io_format, rc=rc)
#else
call shr_stream_init_from_xml(streamfilename, sdat%stream, sdat%masterproc, sdat%logunit, &
sdat%pio_subsystem, sdat%io_type, sdat%io_format, trim(compname), rc=rc)
#endif

allocate(sdat%pstrm(shr_strdata_get_stream_count(sdat)))

Expand All @@ -224,7 +232,7 @@ subroutine shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compn
call shr_strdata_init(sdat, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

end subroutine shr_strdata_init_from_xml
end subroutine shr_strdata_init_from_config

!===============================================================================
subroutine shr_strdata_init_from_inline(sdat, my_task, logunit, compname, &
Expand Down
Loading

0 comments on commit 69a3a61

Please sign in to comment.