687 integer,
intent(in ) :: localpet, petcount, mycomm
688 integer,
intent(out) :: rc
692# ifdef METADATA_REPORT
693 logical :: lreport = .true.
695 logical :: lreport = .false.
697 logical :: lexist, masterpet
699 integer :: findex, i, layout, ng
702 TYPE (
yaml_svec),
allocatable :: estring(:), istring(:)
706 character (len=256) :: string
708 character (len=*),
parameter :: myfile = &
709 & __FILE__//
", ROMS_Create"
716 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_Create', &
727 &
noerror, __line__, myfile))
THEN
737 IF (
yml%has(
'standard_input.OCN_component'))
THEN
740 &
noerror, __line__, myfile))
THEN
747 IF (localpet.eq.0)
WRITE (
cplout,20) &
748 &
'standard_input.OCN_component', &
756 masterpet=localpet.eq.0
763 IF (
yml%has(
'linked_grid'))
THEN
766 &
noerror, __line__, myfile))
THEN
784 IF (.not.
allocated(
coupled))
THEN
788 IF (.not.
allocated(
models))
THEN
794 IF (.not.
allocated(
nexport))
THEN
798 IF (.not.
allocated(
nimport))
THEN
805 IF (.not.
allocated(
esmcomm))
THEN
814 IF (.not.
allocated(
inpname))
THEN
856 &
noerror, __line__, myfile))
THEN
869 IF (.not.
allocated(
models(
iroms)%ExportState))
THEN
875 IF (
yml%has(
'export_variables'))
THEN
878 &
noerror, __line__, myfile))
THEN
890 IF (
yml%has(
'export'))
THEN
899 IF (localpet.eq.0)
WRITE (
cplout,20)
'export', &
906 IF (.not.
allocated(
models(
iroms)%ExportField))
THEN
913 shortname=estring(i)%value
915 IF (findex.gt.0)
THEN
917 & export(findex)%connected
919 & export(findex)%debug_write
922 & export(findex)%add_offset
924 & export(findex)%scale
929 & export(findex)%short_name), &
930 &
noerror, __line__, myfile))
THEN
937 & export(findex)%standard_name), &
938 &
noerror, __line__, myfile))
THEN
945 & export(findex)%long_name), &
946 &
noerror, __line__, myfile))
THEN
953 & export(findex)%map_norm), &
954 &
noerror, __line__, myfile))
THEN
961 & export(findex)%map_type), &
962 &
noerror, __line__, myfile))
THEN
969 & export(findex)%destination_grid), &
970 &
noerror, __line__, myfile))
THEN
977 & export(findex)%destination_units), &
978 &
noerror, __line__, myfile))
THEN
985 & export(findex)%source_grid), &
986 &
noerror, __line__, myfile))
THEN
993 & export(findex)%source_units), &
994 &
noerror, __line__, myfile))
THEN
1001 & export(findex)%data_netcdf_vname), &
1002 &
noerror, __line__, myfile))
THEN
1003 rc=esmf_rc_copy_fail
1009 & export(findex)%data_netcdf_tname), &
1010 &
noerror, __line__, myfile))
THEN
1011 rc=esmf_rc_copy_fail
1017 SELECT CASE (
lowercase(export(findex)%source_grid))
1018 CASE (
'center_cell',
'cell_center',
'center')
1020 CASE (
'corner_cell',
'cell_corner',
'corner')
1022 CASE (
'left_right_edge',
'right_left_edge',
'edge1')
1024 CASE (
'lower_upper_edge',
'upper_lower_edge',
'edge2')
1032 SELECT CASE (
lowercase(export(findex)%map_type))
1045 CASE (
'mapnstod_consd')
1047 CASE (
'mapnstod_consf')
1055 lexist=nuopc_fielddictionaryhasentry( &
1058 IF (esmf_logfounderror(rctocheck=rc, &
1059 & msg=esmf_logerr_passthru, &
1061 & file=myfile))
THEN
1067 IF (.not.lexist)
THEN
1068 CALL nuopc_fielddictionaryaddentry( &
1070 & canonicalunits = &
1073 IF (esmf_logfounderror(rctocheck=rc, &
1074 & msg=esmf_logerr_passthru, &
1076 & file=myfile))
THEN
1081 IF (localpet.eq.0)
THEN
1082 WRITE (
cplout,30)
'export field short_name: ', &
1083 & trim(shortname), trim(
cplname)
1085 rc=esmf_rc_not_found
1086 IF (esmf_logfounderror(rctocheck=rc, &
1087 & msg=esmf_logerr_passthru, &
1089 & file=myfile))
THEN
1102 IF (
yml%has(
'import_variables'))
THEN
1105 &
noerror, __line__, myfile))
THEN
1106 rc=esmf_rc_copy_fail
1117 IF (
yml%has(
'import'))
THEN
1121 rc=esmf_rc_val_wrong
1125 rc=esmf_rc_not_found
1126 IF (localpet.eq.0)
WRITE (
cplout,20)
'import', &
1133 IF (.not.
allocated(
models(
iroms)%ImportField))
THEN
1137 IF (.not.
allocated(
models(
iroms)%ImportState))
THEN
1144 shortname=istring(i)%value
1146 IF (findex.gt.0)
THEN
1148 & import(findex)%connected
1150 & import(findex)%debug_write
1153 & import(findex)%add_offset
1155 & import(findex)%scale
1160 & import(findex)%short_name), &
1161 &
noerror, __line__, myfile))
THEN
1162 rc=esmf_rc_copy_fail
1168 & import(findex)%standard_name), &
1169 &
noerror, __line__, myfile))
THEN
1170 rc=esmf_rc_copy_fail
1176 & import(findex)%long_name), &
1177 &
noerror, __line__, myfile))
THEN
1178 rc=esmf_rc_copy_fail
1184 & import(findex)%map_norm), &
1185 &
noerror, __line__, myfile))
THEN
1186 rc=esmf_rc_copy_fail
1192 & import(findex)%map_type), &
1193 &
noerror, __line__, myfile))
THEN
1194 rc=esmf_rc_copy_fail
1200 & import(findex)%destination_grid), &
1201 &
noerror, __line__, myfile))
THEN
1202 rc=esmf_rc_copy_fail
1208 & import(findex)%destination_units), &
1209 &
noerror, __line__, myfile))
THEN
1210 rc=esmf_rc_copy_fail
1216 & import(findex)%source_grid), &
1217 &
noerror, __line__, myfile))
THEN
1218 rc=esmf_rc_copy_fail
1224 & import(findex)%source_units), &
1225 &
noerror, __line__, myfile))
THEN
1226 rc=esmf_rc_copy_fail
1232 & import(findex)%data_netcdf_vname), &
1233 &
noerror, __line__, myfile))
THEN
1234 rc=esmf_rc_copy_fail
1240 & import(findex)%data_netcdf_tname), &
1241 &
noerror, __line__, myfile))
THEN
1242 rc=esmf_rc_copy_fail
1248 SELECT CASE (
lowercase(import(findex)%destination_grid))
1249 CASE (
'center_cell',
'cell_center',
'center')
1251 CASE (
'corner_cell',
'cell_corner',
'corner')
1253 CASE (
'left_right_edge',
'right_left_edge',
'edge1')
1255 CASE (
'lower_upper_edge',
'upper_lower_edge',
'edge2')
1263 SELECT CASE (
lowercase(import(findex)%map_type))
1276 CASE (
'mapnstod_consd')
1278 CASE (
'mapnstod_consf')
1286 lexist=nuopc_fielddictionaryhasentry( &
1289 IF (esmf_logfounderror(rctocheck=rc, &
1290 & msg=esmf_logerr_passthru, &
1292 & file=myfile))
THEN
1298 IF (.not.lexist)
THEN
1299 CALL nuopc_fielddictionaryaddentry( &
1301 & canonicalunits = &
1304 IF (esmf_logfounderror(rctocheck=rc, &
1305 & msg=esmf_logerr_passthru, &
1307 & file=myfile))
THEN
1312 IF (localpet.eq.0)
THEN
1313 WRITE (
cplout,30)
'import field short_name: ', &
1314 & trim(shortname), trim(
cplname)
1316 rc=esmf_rc_not_found
1317 IF (esmf_logfounderror(rctocheck=rc, &
1318 & msg=esmf_logerr_passthru, &
1320 & file=myfile))
THEN
1333 IF (
yml%has(
'CouplingType'))
THEN
1336 &
noerror, __line__, myfile))
THEN
1337 rc=esmf_rc_copy_fail
1341 rc=esmf_rc_not_found
1342 IF (localpet.eq.0)
WRITE (
cplout,20)
'CouplingType', &
1349 IF (
yml%has(
'PETlayoutOption'))
THEN
1352 &
noerror, __line__, myfile))
THEN
1353 rc=esmf_rc_copy_fail
1358 SELECT CASE (layout)
1367 IF (
yml%has(
'CoupledSet'))
THEN
1370 &
noerror, __line__, myfile))
THEN
1371 rc=esmf_rc_copy_fail
1377 IF (
yml%has(
'ExportState'))
THEN
1380 &
noerror, __line__, myfile))
THEN
1381 rc=esmf_rc_copy_fail
1387 IF (
yml%has(
'ImportState'))
THEN
1390 &
noerror, __line__, myfile))
THEN
1391 rc=esmf_rc_copy_fail
1399 IF (
yml%has(
'DebugLevel'))
THEN
1402 &
noerror, __line__, myfile))
THEN
1403 rc=esmf_rc_copy_fail
1410 IF (
yml%has(
'TraceLevel'))
THEN
1413 &
noerror, __line__, myfile))
THEN
1414 rc=esmf_rc_copy_fail
1422 IF (
allocated(export))
deallocate (export)
1423 IF (
allocated(import))
deallocate (import)
1424 IF (
allocated(estring))
deallocate (estring)
1425 IF (
allocated(istring))
deallocate (istring)
1434 IF (localpet.eq.0)
THEN
1436 WRITE (
cplout,40) trim(esmf_version_string), &
1446 WRITE (
cplout,50)
'Coupling Input Metadata Filename = ', &
1448 WRITE (
cplout,50)
' ROMS Input Parameters Filename = ', &
1450 WRITE (
cplout,
'(a)') char(32)
1451 WRITE (
cplout,60)
' Number of nested grids = ', &
1453 WRITE (
cplout,60)
' Coupled nested grid = ', &
1456 WRITE (
cplout,70)
' Coupling flag = ', &
1458 &
', Explicit coupling method'
1460 WRITE (
cplout,70)
' Coupling flag = ', &
1462 &
', Semi-Implicit coupling method'
1464 IF (layout.eq.0)
THEN
1465 WRITE (
cplout,70)
' PETs layout option = ', &
1468 ELSE IF (layout.eq.1)
THEN
1469 WRITE (
cplout,70)
' PETs layout option = ', &
1473 WRITE (
cplout,
'(a)') char(32)
1474 WRITE (
cplout,60)
' Coupling debugging level flag = ', &
1476 WRITE (
cplout,60)
' Execution tracing level flag = ', &
1480 WRITE (
cplout,80)
'ROMS IMPORT Fields Metadata:'
1483 & trim(
models(
iroms)%ImportField(i)%short_name), &
1484 & trim(
models(
iroms)%ImportField(i)%standard_name), &
1495 WRITE (
cplout,80)
'ROMS EXPORT Fields Metadata:'
1498 & trim(
models(
iroms)%ExportField(i)%short_name), &
1499 & trim(
models(
iroms)%ExportField(i)%standard_name), &
1512 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_Create', &
1517 10
FORMAT (/,
' ROMS_CREATE - Unable to create YAML object for', &
1518 &
' ROMS/CMEPS configuration metadata file: ',/,15x,a,/, &
1519 & 15x,
'Default file is located in source directory.')
1520 20
FORMAT (/,
" ROMS_CREATE - Unable to find key: '",a,
"'", &
1521 &
' ROMS/CMEPS configuration metadata file: ',/,15x,a,/, &
1522 & /,15x,
'YAML file: ',a)
1523 30
FORMAT (/,
' ROMS_CREATE - cannot find metadata for', &
1524 & 1x,a,
'''',a,
'''.',/,15x, &
1525 &
'Add entry to metadata file: ',a)
1526 40
FORMAT (80(
'-'),/, &
1527 &
' Earth System Models Coupling: ESMF/NUOPC Library,', &
1528 &
' Version ',a,/,31x,a,/, &
1530 & /,1x,
'GIT Root URL : ',a, &
1531 & /,1x,
'GIT Revision : ',a, &
1532 & /,1x,
'Operating System : ',a, &
1533 & /,1x,
'CPU Hardware : ',a, &
1534 & /,1x,
'Compiler System : ',a, &
1535 & /,1x,
'Compiler Command : ',a, &
1536 & /,1x,
'Compiler Flags : ',a, &
1537 & /,1x,
'MPI Communicator : ',i0,2x,
'PET size = ',i0, &
1541 70
FORMAT (1x,a,i0,a)
1542 80
FORMAT (/,a,/, 27(
'='),/,/,
'Short Name', &
1543 & t15,
'Standard Name', t74,
'G', t77,
'R', t80,
'C', t83,
'W', &
1544 & t87,
'add_offset', t99,
'scale_factor',/, 111(
'-'))
1545 90
FORMAT (a, t15,a, t74,i1, t77,i1, t80,l1, t83,l1, &
1546 & t86,1p,e12.5, t100,1p,e12.5)
1547 100
FORMAT (/,
' G: Grid cell location, 1=Center,', &
1551 & /,
' R: Regridding method, 1=bilin,', &
1557 &
' 7=nStoD-consD,', &
1558 &
' 8=nStoD-consF', &
1559 & /,
' C: Connected to coupler, F=derived from other,', &
1560 &
' T=exchanged/regridded', &
1561 & /,
' W: Field write to NetCDF, F=false, T=true', &
1562 &
' (used if DebugLevel > 2)'/)
1568 & ImportState, ExportState, &
1582 integer,
intent(out) :: rc
1584 TYPE (esmf_gridcomp) :: model
1585 TYPE (esmf_state) :: importstate
1586 TYPE (esmf_state) :: exportstate
1587 TYPE (esmf_clock) :: clock
1591 logical :: masterpet, ispresent, isset
1595 integer :: mycomm, petcount, localpet
1597 TYPE (
couplingfield),
allocatable :: romsexport(:), romsimport(:)
1598 TYPE (esmf_vm) :: vm
1601# ifdef ADD_NESTED_STATE
1602 character (len=100) ::
coupledset, statelabel
1605 character (len=240) :: cfgvalue
1606 character (len=160) :: message
1608 character (len=*),
parameter :: myfile = &
1609 & __FILE__//
", ROMS_SetInitializeP1"
1616 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_SetInitializeP1', &
1627 CALL esmf_gridcompget (model, &
1630 IF (esmf_logfounderror(rctocheck=rc, &
1631 & msg=esmf_logerr_passthru, &
1633 & file=myfile))
THEN
1637 CALL esmf_vmget (vm, &
1638 & localpet=localpet, &
1639 & petcount=petcount, &
1640 & mpicommunicator=mycomm, &
1642 IF (esmf_logfounderror(rctocheck=rc, &
1643 & msg=esmf_logerr_passthru, &
1645 & file=myfile))
THEN
1648 masterpet=localpet.eq.0
1682 CALL nuopc_compattributeget (model, &
1683 & name=
'CouplingConfig', &
1685 & ispresent=ispresent, &
1688 IF (esmf_logfounderror(rctocheck=rc, &
1689 & msg=esmf_logerr_passthru, &
1691 & file=myfile))
THEN
1695 IF (ispresent.and.isset)
THEN
1697 message=
'CouplingConfig = '//trim(
cplname)
1698 CALL esmf_logwrite (trim(message), esmf_logmsg_info)
1700 message=
'CouplingConfig needs to be provided: '// &
1701 &
'please check the top level ESMF config file.'
1702 CALL esmf_logseterror (esmf_failure, rctoreturn=rc, &
1703 & msg=trim(message))
1710 CALL nuopc_compattributeget (model, &
1711 & name=
'ScalarFieldName', &
1713 & ispresent=ispresent, &
1716 IF (esmf_logfounderror(rctocheck=rc, &
1717 & msg=esmf_logerr_passthru, &
1719 & file=myfile))
THEN
1723 IF (ispresent.and.isset)
THEN
1728 WRITE (message,
'(a)')
'ScalarFieldName = '// &
1730 CALL esmf_logwrite(trim(message), esmf_logmsg_info)
1732 CALL nuopc_compattributeget(model, &
1733 & name=
'ScalarFieldCount', &
1735 & ispresent=ispresent, &
1738 IF (esmf_logfounderror(rctocheck=rc, &
1739 & msg=esmf_logerr_passthru, &
1741 & file=myfile))
THEN
1745 IF (ispresent.and.isset)
THEN
1750 WRITE(message,
'(a,i0)')
'ScalarFieldCount = ', &
1752 CALL esmf_logwrite(trim(message), esmf_logmsg_info)
1754 CALL nuopc_compattributeget(model, &
1755 & name=
'ScalarFieldIdxGridNX', &
1757 & ispresent=ispresent, &
1760 IF (esmf_logfounderror(rctocheck=rc, &
1761 & msg=esmf_logerr_passthru, &
1763 & file=myfile))
THEN
1767 IF (ispresent.and.isset)
THEN
1772 WRITE(message,
'(a,i0)')
'ScalarFieldIdxGridNX = ', &
1774 CALL esmf_logwrite (trim(message), esmf_logmsg_info)
1776 CALL nuopc_compattributeget(model, &
1777 & name=
'ScalarFieldIdxGridNY', &
1779 & ispresent=ispresent, &
1782 IF (esmf_logfounderror(rctocheck=rc, &
1783 & msg=esmf_logerr_passthru, &
1785 & file=myfile))
THEN
1789 IF (ispresent.and.isset)
THEN
1794 WRITE (message,
'(a,i0)')
'ScalarFieldIdxGridNY = ', &
1796 CALL esmf_logwrite(trim(message), esmf_logmsg_info)
1804 IF (esmf_logfounderror(rctocheck=rc, &
1805 & msg=esmf_logerr_passthru, &
1807 & file=myfile))
THEN
1815# ifdef ADD_NESTED_STATE
1825 CALL nuopc_addnestedstate (importstate, &
1827 & nestedstatename=trim(statelabel),&
1829 & importstate(ng), &
1831 IF (esmf_logfounderror(rctocheck=rc, &
1832 & msg=esmf_logerr_passthru, &
1834 & file=myfile))
THEN
1837 IF (localpet.eq.0)
THEN
1838 WRITE (
cplout,10)
'ROMS adding Import Nested State: ', &
1839 & trim(statelabel), ng
1846 shortname =
models(
iroms)%ImportField(i)%short_name
1847 IF (localpet.eq.0)
THEN
1848 WRITE (
cplout,20)
'Advertising Import Field: ', &
1851 CALL nuopc_advertise (
models(
iroms)%ImportState(ng), &
1853 & name=trim(shortname), &
1855 IF (esmf_logfounderror(rctocheck=rc, &
1856 & msg=esmf_logerr_passthru, &
1858 & file=myfile))
THEN
1864 IF (trim(shortname).eq.
'LWrad')
THEN
1865 rc=esmf_rc_not_valid
1866 IF (localpet.eq.0)
THEN
1867 WRITE (
cplout,30) trim(shortname),
'LONGWAVE_OUT', &
1868 &
'downward longwave radiation: dLWrad', &
1871 IF (esmf_logfounderror(rctocheck=rc, &
1872 & msg=esmf_logerr_passthru, &
1874 & file=myfile))
THEN
1892 IF (localpet.eq.0)
THEN
1893 WRITE (
cplout,10)
'ROMS Import STATE: ', ng
1898 shortname =
models(
iroms)%ImportField(i)%short_name
1899 IF (localpet.eq.0)
THEN
1900 WRITE (
cplout,20)
'Advertising Import Field: ', &
1903 CALL nuopc_advertise (
models(
iroms)%ImportState(ng), &
1905 & name=trim(shortname), &
1907 IF (esmf_logfounderror(rctocheck=rc, &
1908 & msg=esmf_logerr_passthru, &
1910 & file=myfile))
THEN
1916 IF (trim(shortname).eq.
'LWrad')
THEN
1917 rc=esmf_rc_not_valid
1918 IF (localpet.eq.0)
THEN
1919 WRITE (
cplout,30) trim(shortname),
'LONGWAVE_OUT', &
1920 &
'downward longwave radiation: dLWrad', &
1923 IF (esmf_logfounderror(rctocheck=rc, &
1924 & msg=esmf_logerr_passthru, &
1926 & file=myfile))
THEN
1939# ifdef ADD_NESTED_STATE
1949 CALL nuopc_addnestedstate (exportstate, &
1951 & nestedstatename=trim(statelabel),&
1953 & exportstate(ng), &
1955 IF (esmf_logfounderror(rctocheck=rc, &
1956 & msg=esmf_logerr_passthru, &
1958 & file=myfile))
THEN
1961 IF (localpet.eq.0)
THEN
1962 WRITE (
cplout,10)
'ROMS adding Export Nested State: ', &
1963 & trim(statelabel), ng
1970 shortname =
models(
iroms)%ExportField(i)%short_name
1971 IF (localpet.eq.0)
THEN
1972 WRITE (
cplout,20)
'Advertising Export Field: ', &
1975 CALL nuopc_advertise (
models(
iroms)%ExportState(ng), &
1977 & name=trim(shortname), &
1979 IF (esmf_logfounderror(rctocheck=rc, &
1980 & msg=esmf_logerr_passthru, &
1982 & file=myfile))
THEN
1998 IF (localpet.eq.0)
THEN
1999 WRITE (
cplout,10)
'ROMS Export STATE: ', ng
2004 shortname =
models(
iroms)%ExportField(i)%short_name
2005 IF (localpet.eq.0)
THEN
2006 WRITE (
cplout,20)
'Advertising Export Field: ', &
2009 CALL nuopc_advertise (
models(
iroms)%ExportState(ng), &
2011 & name=trim(shortname), &
2013 IF (esmf_logfounderror(rctocheck=rc, &
2014 & msg=esmf_logerr_passthru, &
2016 & file=myfile))
THEN
2024 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_SetInitializeP1', &
2029# ifdef ADD_NESTED_STATE
2030 10
FORMAT (/,a,a,
', ng = ',i0,/,31(
'='),/)
2032 10
FORMAT (/,a,
'ng = ',i0,/,17(
'='),/)
2034 20
FORMAT (2x,a,
"'",a,
"'",t45,a)
2036 30
FORMAT (/,
' ROMS_SetInitializeP1 - incorrect field to process: ', &
2037 & a,/,24x,
'when activating option: ',a,/,24x, &
2038 &
'use instead ',a,/,24x,
'or deactivate option: ',a,/)
3112 integer,
intent(in) :: ng, tile
3113 integer,
intent(out) :: rc
3115 TYPE (esmf_gridcomp),
intent(inout) :: model
3119 integer :: mytile, gtype, i, ivar, j, node
3120 integer :: istr, iend, jstr, jend
3121 integer :: istrr, iendr, jstrr, jendr
3122 integer :: localde, localdecount
3123 integer :: staggeredgelwidth(2)
3124 integer :: staggeredgeuwidth(2)
3126 integer,
allocatable :: deblocklist(:,:,:)
3127 integer (i4b),
pointer :: ptrm(:,:) => null()
3129 real (
dp),
pointer :: ptra(:,:) => null()
3130 real (
dp),
pointer :: ptrx(:,:) => null()
3131 real (
dp),
pointer :: ptry(:,:) => null()
3133 character (len=*),
parameter :: myfile = &
3134 & __FILE__//
", ROMS_SetGridArrays"
3136 TYPE (esmf_distgrid) :: distgrid
3137 TYPE (esmf_staggerloc) :: staggerloc
3144 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_SetGridArrays', &
3155 istrr=
bounds(ng)%IstrR(tile)
3156 iendr=
bounds(ng)%IendR(tile)
3157 jstrr=
bounds(ng)%JstrR(tile)
3158 jendr=
bounds(ng)%JendR(tile)
3160 istr=
bounds(ng)%Istr(tile)
3161 iend=
bounds(ng)%Iend(tile)
3162 jstr=
bounds(ng)%Jstr(tile)
3163 jend=
bounds(ng)%Jend(tile)
3190 IF (.not.
allocated(deblocklist))
THEN
3194 deblocklist(1,1,mytile+1)=
bounds(ng)%Istr(mytile)
3195 deblocklist(1,2,mytile+1)=
bounds(ng)%Iend(mytile)
3196 deblocklist(2,1,mytile+1)=
bounds(ng)%Jstr(mytile)
3197 deblocklist(2,2,mytile+1)=
bounds(ng)%Jend(mytile)
3207 distgrid=esmf_distgridcreate(minindex=(/ 1, 1 /), &
3208 & maxindex=(/
lm(ng),
mm(ng) /), &
3209 & deblocklist=deblocklist, &
3211 IF (esmf_logfounderror(rctocheck=rc, &
3212 & msg=esmf_logerr_passthru, &
3214 & file=myfile))
THEN
3224 WRITE (
cplout,20) mytile-1, deblocklist(1,1,mytile), &
3225 & deblocklist(1,2,mytile), &
3226 & deblocklist(2,1,mytile), &
3227 & deblocklist(2,2,mytile)
3230 IF (
allocated(deblocklist))
deallocate (deblocklist)
3254 models(
iroms)%grid(ng)=esmf_gridcreate(distgrid=distgrid, &
3255 & gridedgelwidth=(/2,2/), &
3256 & gridedgeuwidth=(/2,2/), &
3257 & indexflag=esmf_index_global, &
3260 IF (esmf_logfounderror(rctocheck=rc, &
3261 & msg=esmf_logerr_passthru, &
3263 & file=myfile))
THEN
3272 & localdecount=localdecount, &
3274 IF (esmf_logfounderror(rctocheck=rc, &
3275 & msg=esmf_logerr_passthru, &
3277 & file=myfile))
THEN
3283 mesh_loop :
DO ivar=1,ubound(
models(
iroms)%mesh, dim=1)
3289 staggerloc=esmf_staggerloc_center
3290 staggeredgelwidth=(/1,1/)
3291 staggeredgeuwidth=(/1,1/)
3293 staggerloc=esmf_staggerloc_corner
3294 staggeredgelwidth=(/1,1/)
3295 staggeredgeuwidth=(/2,2/)
3297 staggerloc=esmf_staggerloc_edge1
3298 staggeredgelwidth=(/1,1/)
3299 staggeredgeuwidth=(/2,1/)
3301 staggerloc=esmf_staggerloc_edge2
3302 staggeredgelwidth=(/1,1/)
3303 staggeredgeuwidth=(/1,2/)
3310 & staggerloc=staggerloc, &
3311 & staggeredgelwidth=staggeredgelwidth, &
3312 & staggeredgeuwidth=staggeredgeuwidth, &
3314 IF (esmf_logfounderror(rctocheck=rc, &
3315 & msg=esmf_logerr_passthru, &
3317 & file=myfile))
THEN
3326 & staggerloc=staggerloc, &
3327 & itemflag=esmf_griditem_mask, &
3329 IF (esmf_logfounderror(rctocheck=rc, &
3330 & msg=esmf_logerr_passthru, &
3332 & file=myfile))
THEN
3342 & staggerloc=staggerloc, &
3343 & itemflag=esmf_griditem_area, &
3345 IF (esmf_logfounderror(rctocheck=rc, &
3346 & msg=esmf_logerr_passthru, &
3348 & file=myfile))
THEN
3355 de_loop :
DO localde=0,localdecount-1
3358 & localde=localde, &
3359 & staggerloc=staggerloc, &
3362 IF (esmf_logfounderror(rctocheck=rc, &
3363 & msg=esmf_logerr_passthru, &
3365 & file=myfile))
THEN
3371 & localde=localde, &
3372 & staggerloc=staggerloc, &
3375 IF (esmf_logfounderror(rctocheck=rc, &
3376 & msg=esmf_logerr_passthru, &
3378 & file=myfile))
THEN
3383 & localde=localde, &
3384 & staggerloc=staggerloc, &
3385 & itemflag=esmf_griditem_mask, &
3388 IF (esmf_logfounderror(rctocheck=rc, &
3389 & msg=esmf_logerr_passthru, &
3391 & file=myfile))
THEN
3396 & localde=localde, &
3397 & staggerloc=staggerloc, &
3398 & itemflag=esmf_griditem_area, &
3401 IF (esmf_logfounderror(rctocheck=rc, &
3402 & msg=esmf_logerr_passthru, &
3404 & file=myfile))
THEN
3415 ptrx(i,j)=
grid(ng)%lonr(i,j)
3416 ptry(i,j)=
grid(ng)%latr(i,j)
3418 ptrm(i,j)=int(
grid(ng)%rmask(i,j))
3422 ptra(i,j)=
grid(ng)%om_r(i,j)*
grid(ng)%on_r(i,j)
3429 ptrx(i,j)=
grid(ng)%lonp(i,j)
3430 ptry(i,j)=
grid(ng)%latp(i,j)
3432 ptrm(i,j)=int(
grid(ng)%pmask(i,j))
3436 ptra(i,j)=
grid(ng)%om_p(i,j)*
grid(ng)%on_p(i,j)
3441 IF (tile.lt.
ntilei(ng))
THEN
3442 ptrx(:,jstr-1)=2.0_dp*ptrx(:,jstr)-ptrx(:,jstr+1)
3443 ptry(:,jstr-1)=2.0_dp*ptry(:,jstr)-ptry(:,jstr+1)
3444 ptrm(:,jstr-1)=ptrm(:,jstr)
3445 ptra(:,jstr-1)=ptra(:,jstr)
3449 IF (mod(tile,
ntilei(ng)).eq.0)
THEN
3450 ptrx(istr-1,:)=2.0_dp*ptrx(istr,:)-ptrx(istr+1,:)
3451 ptry(istr-1,:)=2.0_dp*ptry(istr,:)-ptry(istr+1,:)
3452 ptrm(istr-1,:)=ptrm(istr,:)
3453 ptra(istr-1,:)=ptra(istr,:)
3458 ptrx(:,jend+2)=2.0_dp*ptrx(:,jend+1)-ptrx(:,jend)
3459 ptry(:,jend+2)=2.0_dp*ptry(:,jend+1)-ptry(:,jend)
3460 ptrm(:,jend+2)=ptrm(:,jend+1)
3461 ptra(:,jend+2)=ptra(:,jend+1)
3465 IF (mod(tile+1,
ntilei(ng)).eq.0)
THEN
3466 ptrx(iend+2,:)=2.0_dp*ptrx(iend+1,:)-ptrx(iend,:)
3467 ptry(iend+2,:)=2.0_dp*ptry(iend+1,:)-ptry(iend,:)
3468 ptrm(iend+2,:)=ptrm(iend+1,:)
3469 ptra(iend+2,:)=ptra(iend+1,:)
3475 ptrx(i,j)=
grid(ng)%lonu(i,j)
3476 ptry(i,j)=
grid(ng)%latu(i,j)
3478 ptrm(i,j)=int(
grid(ng)%umask(i,j))
3482 ptra(i,j)=
grid(ng)%om_u(i,j)*
grid(ng)%on_u(i,j)
3487 IF (mod(tile,
ntilei(ng)).eq.0)
THEN
3488 ptrx(istr-1,:)=2.0_dp*ptrx(istr,:)-ptrx(istr+1,:)
3489 ptry(istr-1,:)=2.0_dp*ptry(istr,:)-ptry(istr+1,:)
3490 ptrm(istr-1,:)=ptrm(istr,:)
3491 ptra(istr-1,:)=ptra(istr,:)
3495 IF (mod(tile+1,
ntilei(ng)).eq.0)
THEN
3496 ptrx(iend+2,:)=2.0_dp*ptrx(iend+1,:)-ptrx(iend,:)
3497 ptry(iend+2,:)=2.0_dp*ptry(iend+1,:)-ptry(iend,:)
3498 ptrm(iend+2,:)=ptrm(iend+1,:)
3499 ptra(iend+2,:)=ptra(iend+1,:)
3505 ptrx(i,j)=
grid(ng)%lonv(i,j)
3506 ptry(i,j)=
grid(ng)%latv(i,j)
3508 ptrm(i,j)=int(
grid(ng)%vmask(i,j))
3512 ptra(i,j)=
grid(ng)%om_v(i,j)*
grid(ng)%on_v(i,j)
3517 IF (tile.lt.
ntilei(ng))
THEN
3518 ptrx(:,jstr-1)=2.0_dp*ptrx(:,jstr)-ptrx(:,jstr+1)
3519 ptry(:,jstr-1)=2.0_dp*ptry(:,jstr)-ptry(:,jstr+1)
3520 ptrm(:,jstr-1)=ptrm(:,jstr)
3521 ptra(:,jstr-1)=ptra(:,jstr)
3526 ptrx(:,jend+2)=2.0_dp*ptrx(:,jend+1)-ptrx(:,jend)
3527 ptry(:,jend+2)=2.0_dp*ptry(:,jend+1)-ptry(:,jend)
3528 ptrm(:,jend+2)=ptrm(:,jend+1)
3529 ptra(:,jend+2)=ptra(:,jend+1)
3535 IF (
associated(ptrx) )
nullify (ptrx)
3536 IF (
associated(ptry) )
nullify (ptry)
3537 IF (
associated(ptrm) )
nullify (ptrm)
3538 IF (
associated(ptra) )
nullify (ptra)
3546 & filename=
"roms_"// &
3549 & staggerloc=staggerloc, &
3551 IF (esmf_logfounderror(rctocheck=rc, &
3552 & msg=esmf_logerr_passthru, &
3554 & file=myfile))
THEN
3562 CALL esmf_gridcompset (model, &
3565 IF (esmf_logfounderror(rctocheck=rc, &
3566 & msg=esmf_logerr_passthru, &
3568 & file=myfile))
THEN
3573 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_SetGridArrays', &
3579 10
FORMAT (/,
'ROMS Domain Decomposition:',/,25(
'='),/, &
3580 /,2x,
'ROMS_DistGrid - Grid = ',i2.2,
',',3x,
'Mesh = ',a, &
3581 &
',',3x,
'Partition = ',i0,
' x ',i0)
3582 20
FORMAT (18x,
'node = ',i0,t32,
'Istr = ',i0,t45,
'Iend = ',i0, &
3583 & t58,
'Jstr = ',i0,t71,
'Jend = ',i0)
3599 integer,
intent(in) :: ng, tile
3600 integer,
intent(out) :: rc
3602 TYPE (esmf_gridcomp) :: model
3607 integer :: localde, localdecount, localpet
3608 integer :: exportcount, importcount
3610 real (
dp),
dimension(:,:),
pointer :: ptr2d => null()
3612 character (len=10) :: attlist(1)
3614 character (len=*),
parameter :: myfile = &
3615 & __FILE__//
", ROMS_SetStates"
3617 character (ESMF_MAXSTR),
allocatable :: exportnamelist(:)
3618 character (ESMF_MAXSTR),
allocatable :: importnamelist(:)
3620 TYPE (esmf_arrayspec) :: arrayspec2d
3621 TYPE (esmf_field) :: field, field_scalar
3622 TYPE (esmf_staggerloc) :: staggerloc
3623 TYPE (esmf_vm) :: vm
3630 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_SetStates', &
3642 CALL esmf_gridcompget (model, &
3643 & localpet=localpet, &
3646 IF (esmf_logfounderror(rctocheck=rc, &
3647 & msg=esmf_logerr_passthru, &
3649 & file=myfile))
THEN
3658 & localdecount=localdecount, &
3660 IF (esmf_logfounderror(rctocheck=rc, &
3661 & msg=esmf_logerr_passthru, &
3663 & file=myfile))
THEN
3671 CALL esmf_arrayspecset (arrayspec2d, &
3672 & typekind=esmf_typekind_r8, &
3675 IF (esmf_logfounderror(rctocheck=rc, &
3676 & msg=esmf_logerr_passthru, &
3678 & file=myfile))
THEN
3690 CALL esmf_stateget (
models(
iroms)%ExportState(ng), &
3691 & itemcount=exportcount, &
3693 IF (esmf_logfounderror(rctocheck=rc, &
3694 & msg=esmf_logerr_passthru, &
3696 & file=myfile))
THEN
3702 IF (.not.
allocated(exportnamelist))
THEN
3703 allocate ( exportnamelist(exportcount) )
3705 CALL esmf_stateget (
models(
iroms)%ExportState(ng), &
3706 & itemnamelist=exportnamelist, &
3708 IF (esmf_logfounderror(rctocheck=rc, &
3709 & msg=esmf_logerr_passthru, &
3711 & file=myfile))
THEN
3717 DO ifld=1,exportcount
3720 IF (nuopc_isconnected(
models(
iroms)%ExportState(ng), &
3721 & fieldname=trim(exportnamelist(ifld)), &
3726 IF (trim(exportnamelist(ifld)).eq. &
3735 IF (esmf_logfounderror(rctocheck=rc, &
3736 & msg=esmf_logerr_passthru, &
3738 & file=myfile))
THEN
3745 & (/
lm(ng)+2,
mm(ng)+2 /), &
3749 IF (esmf_logfounderror(rctocheck=rc, &
3750 & msg=esmf_logerr_passthru, &
3752 & file=myfile))
THEN
3764 staggerloc=esmf_staggerloc_center
3766 staggerloc=esmf_staggerloc_corner
3768 staggerloc=esmf_staggerloc_edge1
3770 staggerloc=esmf_staggerloc_edge2
3777 & indexflag=esmf_index_global, &
3778 & staggerloc=staggerloc, &
3779 & name=trim(exportnamelist(ifld)), &
3781 IF (esmf_logfounderror(rctocheck=rc, &
3782 & msg=esmf_logerr_passthru, &
3784 & file=myfile))
THEN
3791 DO localde=0,localdecount-1
3795 CALL esmf_fieldget (field, &
3796 & localde=localde, &
3797 & farrayptr=ptr2d, &
3799 IF (esmf_logfounderror(rctocheck=rc, &
3800 & msg=esmf_logerr_passthru, &
3802 & file=myfile))
THEN
3813 IF (
associated(ptr2d) )
nullify (ptr2d)
3820 CALL nuopc_realize (
models(
iroms)%ExportState(ng), &
3823 IF (esmf_logfounderror(rctocheck=rc, &
3824 & msg=esmf_logerr_passthru, &
3826 & file=myfile))
THEN
3834 IF (localpet.eq.0)
THEN
3835 WRITE (
cplout,10) trim(exportnamelist(ifld)), &
3836 &
'Export State: ', &
3839 CALL esmf_stateremove (
models(
iroms)%ExportState(ng), &
3840 & (/ trim(exportnamelist(ifld)) /), &
3842 IF (esmf_logfounderror(rctocheck=rc, &
3843 & msg=esmf_logerr_passthru, &
3845 & file=myfile))
THEN
3854 IF (
allocated(exportnamelist) )
deallocate (exportnamelist)
3866 CALL esmf_stateget (
models(
iroms)%ImportState(ng), &
3867 & itemcount=importcount, &
3869 IF (esmf_logfounderror(rctocheck=rc, &
3870 & msg=esmf_logerr_passthru, &
3872 & file=myfile))
THEN
3878 IF (.not.
allocated(importnamelist))
THEN
3879 allocate (importnamelist(importcount))
3881 CALL esmf_stateget (
models(
iroms)%ImportState(ng), &
3882 & itemnamelist=importnamelist, &
3884 IF (esmf_logfounderror(rctocheck=rc, &
3885 & msg=esmf_logerr_passthru, &
3887 & file=myfile))
THEN
3893 DO ifld=1,importcount
3896 IF (nuopc_isconnected(
models(
iroms)%ImportState(ng), &
3897 & fieldname=trim(importnamelist(ifld)), &
3904 staggerloc=esmf_staggerloc_center
3906 staggerloc=esmf_staggerloc_corner
3908 staggerloc=esmf_staggerloc_edge1
3910 staggerloc=esmf_staggerloc_edge2
3918 & indexflag=esmf_index_global, &
3919 & staggerloc=staggerloc, &
3920 & name=trim(importnamelist(ifld)), &
3922 IF (esmf_logfounderror(rctocheck=rc, &
3923 & msg=esmf_logerr_passthru, &
3925 & file=myfile))
THEN
3929# ifdef TIME_INTERP_NOT
3934 CALL esmf_attributeadd (field, &
3935 & convention=
'ESMF', &
3936 & purpose=
'General', &
3938 IF (esmf_logfounderror(rctocheck=rc, &
3939 & msg=esmf_logerr_passthru, &
3941 & file=myfile))
THEN
3945 attlist(1)=
'TimeInterp'
3946 CALL esmf_attributeadd (field, &
3947 & convention=
'CustomConvention', &
3948 & purpose=
'General', &
3950 & attrlist=attlist, &
3951 & nestconvention=
'ESMF', &
3952 & nestpurpose=
'General', &
3954 IF (esmf_logfounderror(rctocheck=rc, &
3955 & msg=esmf_logerr_passthru, &
3957 & file=myfile))
THEN
3965 DO localde=0,localdecount-1
3969 CALL esmf_fieldget (field, &
3970 & localde=localde, &
3971 & farrayptr=ptr2d, &
3973 IF (esmf_logfounderror(rctocheck=rc, &
3974 & msg=esmf_logerr_passthru, &
3976 & file=myfile))
THEN
3987 IF (
associated(ptr2d))
nullify (ptr2d)
3992 CALL nuopc_realize (
models(
iroms)%ImportState(ng), &
3995 IF (esmf_logfounderror(rctocheck=rc, &
3996 & msg=esmf_logerr_passthru, &
3998 & file=myfile))
THEN
4005 IF (localpet.eq.0)
THEN
4006 WRITE (
cplout,10) trim(importnamelist(ifld)), &
4007 &
'Import State: ', &
4010 CALL esmf_stateremove (
models(
iroms)%ImportState(ng), &
4011 & (/ trim(importnamelist(ifld)) /), &
4013 IF (esmf_logfounderror(rctocheck=rc, &
4014 & msg=esmf_logerr_passthru, &
4016 & file=myfile))
THEN
4024 IF (
allocated(importnamelist))
deallocate (importnamelist)
4029 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_SetStates', &
4034 10
FORMAT (1x,
'ROMS_SetStates - Removing field ''',a,
''' from ',a, &
4035 &
'''',a,
'''',/,18x,
'because it is not connected.')
4359 integer,
intent(in) :: ng
4360 integer,
intent(out) :: rc
4362 TYPE (esmf_gridcomp) :: model
4366 logical :: loadit, ispresent
4367 logical :: got_stress(2), got_wind(2)
4368# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
4369 logical :: got_rhoair, got_wstar, got_wind_sbl(2)
4372 integer :: istr, iend, jstr, jend
4373 integer :: istrr, iendr, jstrr, jendr
4374 integer :: lbi, ubi, lbj, ubj
4375 integer :: importcount, tindex
4376 integer :: localde, localdecount, localpet, tile
4377 integer :: year, month, day, hour, minutes, seconds, sn, sd
4378 integer :: gtype, id, ifield, ifld, i, is, j
4381 integer,
save :: record = 0
4384 real (
dp),
parameter :: eps = 1.0e-10_dp
4386 real (
dp) :: timeindays, time_current, tmin, tmax, tstr, tend
4388 real (
dp) :: mytimeindays
4390 real (
dp) :: fseconds, romsclocktime
4391 real (
dp) :: mytintrp(2), myvtime(2)
4393 real (
dp) :: myfmax(2), myfmin(2), fmin(2), fmax(2), fval
4394 real (
dp) :: add_offset, romsscale, scale, cff1, cff2, cff3
4395 real (
dp) :: freshwaterscale, stressscale, tracerfluxscale
4396# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
4397 real (
dp) :: urel, vrel, wmag, wrel
4399 real (
dp) :: attvalues(14)
4401 real (
dp),
pointer :: ptr2d(:,:) => null()
4403# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
4404 real (
dp),
allocatable :: rhoair(:,:), wstar(:,:)
4405 real (
dp),
allocatable :: uwrk(:,:), vwrk(:,:)
4406 real (
dp),
allocatable :: xwind(:,:), ywind(:,:)
4408 real (
dp),
allocatable :: ustress(:,:), vstress(:,:)
4409 real (
dp),
allocatable :: uwind(:,:), vwind(:,:)
4411 character (len=22) :: mydate(2)
4413 character (len=22) :: mydatestring(1,1,1)
4415 character (len=22) :: time_currentstring
4416 character (len=40) :: attname
4418 character (len=*),
parameter :: myfile = &
4419 & __FILE__//
", ROMS_Import"
4421 character (ESMF_MAXSTR) :: cname, ofile
4422 character (ESMF_MAXSTR),
allocatable :: importnamelist(:)
4424 TYPE (esmf_attpack) :: attpack
4425 TYPE (esmf_clock) :: clock
4426 TYPE (esmf_field) :: field
4427 TYPE (esmf_time) :: currenttime
4428 TYPE (esmf_vm) :: vm
4440 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_Import', &
4450 CALL esmf_gridcompget (model, &
4452 & localpet=localpet, &
4456 IF (esmf_logfounderror(rctocheck=rc, &
4457 & msg=esmf_logerr_passthru, &
4459 & file=myfile))
THEN
4468 & localdecount=localdecount, &
4470 IF (esmf_logfounderror(rctocheck=rc, &
4471 & msg=esmf_logerr_passthru, &
4473 & file=myfile))
THEN
4486 istrr=
bounds(ng)%IstrR(tile)
4487 iendr=
bounds(ng)%IendR(tile)
4488 jstrr=
bounds(ng)%JstrR(tile)
4489 jendr=
bounds(ng)%JendR(tile)
4491 istr=
bounds(ng)%Istr(tile)
4492 iend=
bounds(ng)%Iend(tile)
4493 jstr=
bounds(ng)%Jstr(tile)
4494 jend=
bounds(ng)%Jend(tile)
4500 CALL esmf_clockget (clock, &
4501 & currtime=currenttime, &
4503 IF (esmf_logfounderror(rctocheck=rc, &
4504 & msg=esmf_logerr_passthru, &
4506 & file=myfile))
THEN
4510 CALL esmf_timeget (currenttime, &
4520 IF (esmf_logfounderror(rctocheck=rc, &
4521 & msg=esmf_logerr_passthru, &
4523 & file=myfile))
THEN
4527 CALL esmf_timeget (currenttime, &
4528 & s_r8=time_current, &
4529 & timestring=time_currentstring, &
4531 IF (esmf_logfounderror(rctocheck=rc, &
4532 & msg=esmf_logerr_passthru, &
4534 & file=myfile))
THEN
4537 timeindays=time_current/86400.0_dp
4538 is=index(time_currentstring,
'T')
4539 IF (is.gt.0) time_currentstring(is:is)=
' '
4547 fseconds=real(seconds,
dp)+real(sn,
dp)/real(sd,
dp)
4548 CALL roms_clock (year, month, day, hour, minutes, fseconds, &
4555 CALL esmf_stateget (
models(
iroms)%ImportState(ng), &
4556 & itemcount=importcount, &
4558 IF (esmf_logfounderror(rctocheck=rc, &
4559 & msg=esmf_logerr_passthru, &
4561 & file=myfile))
THEN
4565 IF (.not.
allocated(importnamelist))
THEN
4566 allocate ( importnamelist(importcount) )
4568 CALL esmf_stateget (
models(
iroms)%ImportState(ng), &
4569 & itemnamelist=importnamelist, &
4571 IF (esmf_logfounderror(rctocheck=rc, &
4572 & msg=esmf_logerr_passthru, &
4574 & file=myfile))
THEN
4596 got_stress(1:2)=.false.
4597 got_wind(1:2)=.false.
4598# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
4601 got_wind_sbl(1:2)=.false.
4606 fld_loop :
DO ifld=1,importcount
4611 CALL esmf_stateget (
models(
iroms)%ImportState(ng), &
4612 & trim(importnamelist(ifld)), &
4615 IF (esmf_logfounderror(rctocheck=rc, &
4616 & msg=esmf_logerr_passthru, &
4618 & file=myfile))
THEN
4635 & start=(/
iroms,id,record/), &
4639 rc=esmf_rc_file_read
4646 & start=(/1,
iroms,id,record/), &
4647 & total=(/22,1,1,1/))
4650 rc=esmf_rc_file_read
4654 & mydatestring(1,1,1)
4657 &
rclock%DateNumber, mytimeindays, &
4658 & start=(/
iroms,id,record/), &
4662 rc=esmf_rc_file_read
4669 & start=(/
iroms,id,record/), &
4673 rc=esmf_rc_file_read
4680 & start=(/
iroms,id,record/), &
4684 rc=esmf_rc_file_read
4691 & start=(/
iroms,id,record/), &
4695 rc=esmf_rc_file_read
4702 & start=(/
iroms,id,record/), &
4706 rc=esmf_rc_file_read
4712 & start=(/
iroms,id,record/), &
4716 rc=esmf_rc_file_read
4723 & start=(/
iroms,id,record/), &
4727 rc=esmf_rc_file_read
4736 de_loop :
DO localde=0,localdecount-1
4737 CALL esmf_fieldget (field, &
4738 & localde=localde, &
4739 & farrayptr=ptr2d, &
4741 IF (esmf_logfounderror(rctocheck=rc, &
4742 & msg=esmf_logerr_passthru, &
4744 & file=myfile))
THEN
4748# ifdef TIME_INTERP_NOT_WORKING
4752 CALL esmf_attributegetattpack (field, &
4753 &
'CustomConvention', &
4756 & attpack=attpack, &
4757 & ispresent=ispresent, &
4759 IF (esmf_logfounderror(rctocheck=rc, &
4760 & msg=esmf_logerr_passthru, &
4762 & file=myfile))
THEN
4768 CALL esmf_attributeget (field, &
4769 & name=
'TimeInterp', &
4770 & valuelist=attvalues, &
4771 & attpack=attpack, &
4772 & ispresent=ispresent, &
4774 IF (esmf_logfounderror(rctocheck=rc, &
4775 & msg=esmf_logerr_passthru, &
4777 & file=myfile))
THEN
4796 add_offset =
models(
iroms)%ImportField(id)%add_offset
4803 mytintrp(1)=
models(
iroms)%ImportField(id)%Tintrp(1)
4804 mytintrp(2)=
models(
iroms)%ImportField(id)%Tintrp(2)
4805 myvtime(1) =
models(
iroms)%ImportField(id)%Vtime(1)
4806 myvtime(2) =
models(
iroms)%ImportField(id)%Vtime(2)
4807 mydate(1) =
models(
iroms)%ImportField(id)%DateString(1)
4808 mydate(2) =
models(
iroms)%ImportField(id)%DateString(2)
4814 freshwaterscale=1.0_dp/
rho0
4815 stressscale=1.0_dp/
rho0
4816 tracerfluxscale=1.0_dp/(
rho0*
cp)
4818 fval=ptr2d(istrr,jstrr)
4824 SELECT CASE (trim(adjustl(importnamelist(ifld))))
4826# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
4830 CASE (
'psfc',
'Pair',
'Pmsl')
4834 tindex=3-
iinfo(8,ifield,ng)
4837 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
4838 fval=scale*ptr2d(i,j)+add_offset
4842 myfmin(1)=min(myfmin(1),ptr2d(i,j))
4843 myfmax(1)=max(myfmax(1),ptr2d(i,j))
4844 myfmin(2)=min(myfmin(2),fval)
4845 myfmax(2)=max(myfmax(2),fval)
4847 forces(ng)%PairG(i,j,tindex)=fval
4849 forces(ng)%Pair(i,j)=fval
4854 IF (localde.eq.localdecount-1)
THEN
4857 & lbi, ubi, lbj, ubj, &
4861 & lbi, ubi, lbj, ubj, &
4868# if defined BULK_FLUXES || defined ECOSIM || \
4869 (defined shortwave && defined ana_srflux && defined albedo)
4873 CASE (
'tsfc',
'Tair')
4877 tindex=3-
iinfo(8,ifield,ng)
4880 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
4881 fval=scale*ptr2d(i,j)+add_offset
4885 myfmin(1)=min(myfmin(1),ptr2d(i,j))
4886 myfmax(1)=max(myfmax(1),ptr2d(i,j))
4887 myfmin(2)=min(myfmin(2),fval)
4888 myfmax(2)=max(myfmax(2),fval)
4890 forces(ng)%TairG(i,j,tindex)=fval
4892 forces(ng)%Tair(i,j)=fval
4897 IF (localde.eq.localdecount-1)
THEN
4900 & lbi, ubi, lbj, ubj, &
4904 & lbi, ubi, lbj, ubj, &
4911# if defined BULK_FLUXES || defined ECOSIM
4921 tindex=3-
iinfo(8,ifield,ng)
4924 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
4925 fval=scale*ptr2d(i,j)+add_offset
4929 myfmin(1)=min(myfmin(1),ptr2d(i,j))
4930 myfmax(1)=max(myfmax(1),ptr2d(i,j))
4931 myfmin(2)=min(myfmin(2),fval)
4932 myfmax(2)=max(myfmax(2),fval)
4934 forces(ng)%HairG(i,j,tindex)=fval
4936 forces(ng)%Hair(i,j)=fval
4941 IF (localde.eq.localdecount-1)
THEN
4944 & lbi, ubi, lbj, ubj, &
4948 & lbi, ubi, lbj, ubj, &
4955# if defined BULK_FLUXES
4959 CASE (
'Hair',
'qsfc')
4963 tindex=3-
iinfo(8,ifield,ng)
4966 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
4967 fval=scale*ptr2d(i,j)+add_offset
4971 myfmin(1)=min(myfmin(1),ptr2d(i,j))
4972 myfmax(1)=max(myfmax(1),ptr2d(i,j))
4973 myfmin(2)=min(myfmin(2),fval)
4974 myfmax(2)=max(myfmax(2),fval)
4976 forces(ng)%HairG(i,j,tindex)=fval
4978 forces(ng)%Hair(i,j)=fval
4983 IF (localde.eq.localdecount-1)
THEN
4986 & lbi, ubi, lbj, ubj, &
4990 & lbi, ubi, lbj, ubj, &
4997# if defined BULK_FLUXES
5001 CASE (
'lwrd',
'LWrad')
5002 romsscale=tracerfluxscale
5005 tindex=3-
iinfo(8,ifield,ng)
5008 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5009 fval=scale*ptr2d(i,j)+add_offset
5013 myfmin(1)=min(myfmin(1),fval)
5014 myfmax(1)=max(myfmax(1),fval)
5016 myfmin(2)=min(myfmin(2),fval)
5017 myfmax(2)=max(myfmax(2),fval)
5019 forces(ng)%lrflxG(i,j,tindex)=fval
5021 forces(ng)%lrflx(i,j)=fval
5026 IF (localde.eq.localdecount-1)
THEN
5029 & lbi, ubi, lbj, ubj, &
5033 & lbi, ubi, lbj, ubj, &
5040# if defined BULK_FLUXES && defined LONGWAVE_OUT
5045 CASE (
'dlwr',
'dLWrad',
'lwrad_down')
5046 romsscale=tracerfluxscale
5049 tindex=3-
iinfo(8,ifield,ng)
5052 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5053 fval=scale*ptr2d(i,j)+add_offset
5057 myfmin(1)=min(myfmin(1),fval)
5058 myfmax(1)=max(myfmax(1),fval)
5060 myfmin(2)=min(myfmin(2),fval)
5061 myfmax(2)=max(myfmax(2),fval)
5063 forces(ng)%lrflxG(i,j,tindex)=fval
5065 forces(ng)%lrflx(i,j)=fval
5070 IF (localde.eq.localdecount-1)
THEN
5073 & lbi, ubi, lbj, ubj, &
5077 & lbi, ubi, lbj, ubj, &
5084# if defined BULK_FLUXES
5088 CASE (
'prec',
'rain')
5092 tindex=3-
iinfo(8,ifield,ng)
5095 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5096 fval=scale*ptr2d(i,j)+add_offset
5100 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5101 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5102 myfmin(2)=min(myfmin(2),fval)
5103 myfmax(2)=max(myfmax(2),fval)
5105 forces(ng)%rainG(i,j,tindex)=fval
5107 forces(ng)%rain(i,j)=fval
5112 IF (localde.eq.localdecount-1)
THEN
5115 & lbi, ubi, lbj, ubj, &
5119 & lbi, ubi, lbj, ubj, &
5126# if defined BULK_FLUXES || defined ECOSIM
5131 CASE (
'wndu',
'Uwind')
5132 IF (.not.
allocated(uwind))
THEN
5133 allocate ( uwind(lbi:ubi,lbj:ubj) )
5140 tindex=3-
iinfo(8,ifield,ng)
5143 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5144 fval=scale*ptr2d(i,j)+add_offset
5148 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5149 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5150 myfmin(2)=min(myfmin(2),fval)
5151 myfmax(2)=max(myfmax(2),fval)
5153 forces(ng)%UwindG(i,j,tindex)=fval
5160 IF (localde.eq.localdecount-1)
THEN
5163 & lbi, ubi, lbj, ubj, &
5167 & lbi, ubi, lbj, ubj, &
5174# if defined BULK_FLUXES || defined ECOSIM
5179 CASE (
'wndv',
'Vwind')
5180 IF (.not.
allocated(vwind))
THEN
5181 allocate ( vwind(lbi:ubi,lbj:ubj) )
5188 tindex=3-
iinfo(8,ifield,ng)
5191 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5192 fval=scale*ptr2d(i,j)+add_offset
5196 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5197 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5198 myfmin(2)=min(myfmin(2),fval)
5199 myfmax(2)=max(myfmax(2),fval)
5201 forces(ng)%VwindG(i,j,tindex)=fval
5208 IF (localde.eq.localdecount-1)
THEN
5211 & lbi, ubi, lbj, ubj, &
5215 & lbi, ubi, lbj, ubj, &
5222# if defined SHORTWAVE
5226 CASE (
'swrd',
'swrad',
'SWrad',
'SWrad_daily')
5227 romsscale=tracerfluxscale
5230 tindex=3-
iinfo(8,ifield,ng)
5233 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5234 fval=scale*ptr2d(i,j)+add_offset
5238 myfmin(1)=min(myfmin(1),fval)
5239 myfmax(1)=max(myfmax(1),fval)
5241 myfmin(2)=min(myfmin(2),fval)
5242 myfmax(2)=max(myfmax(2),fval)
5244 forces(ng)%srflxG(i,j,tindex)=fval
5246 forces(ng)%srflx(i,j)=fval
5251 IF (localde.eq.localdecount-1)
THEN
5254 & lbi, ubi, lbj, ubj, &
5258 & lbi, ubi, lbj, ubj, &
5265# if !defined BULK_FLUXES
5271 CASE (
'lwr',
'LWrad')
5272 romsscale=tracerfluxscale
5275 tindex=3-
iinfo(8,ifield,ng)
5278 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5279 fval=scale*ptr2d(i,j)+add_offset
5283 myfmin(1)=min(myfmin(1),fval)
5284 myfmax(1)=max(myfmax(1),fval)
5286 myfmin(2)=min(myfmin(2),fval)
5287 myfmax(2)=max(myfmax(2),fval)
5288 forces(ng)%lrflx(i,j)=fval
5296 CASE (
'dlwr',
'dLWrad',
'lwrad_down')
5297 romsscale=tracerfluxscale
5300 tindex=3-
iinfo(8,ifield,ng)
5303 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5304 fval=scale*ptr2d(i,j)+add_offset
5308 myfmin(1)=min(myfmin(1),fval)
5309 myfmax(1)=max(myfmax(1),fval)
5311 myfmin(2)=min(myfmin(2),fval)
5312 myfmax(2)=max(myfmax(2),fval)
5313 forces(ng)%lrflx(i,j)=fval
5321 CASE (
'latent',
'LHfx')
5322 romsscale=tracerfluxscale
5326 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5327 fval=scale*ptr2d(i,j)+add_offset
5331 myfmin(1)=min(myfmin(1),fval)
5332 myfmax(1)=max(myfmax(1),fval)
5334 myfmin(2)=min(myfmin(2),fval)
5335 myfmax(2)=max(myfmax(2),fval)
5336 forces(ng)%lhflx(i,j)=fval
5344 CASE (
'sensible',
'SHfx')
5345 romsscale=tracerfluxscale
5349 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5350 fval=scale*ptr2d(i,j)+add_offset
5354 myfmin(1)=min(myfmin(1),fval)
5355 myfmax(1)=max(myfmax(1),fval)
5357 myfmin(2)=min(myfmin(2),fval)
5358 myfmax(2)=max(myfmax(2),fval)
5359 forces(ng)%shflx(i,j)=fval
5365 CASE (
'nflx',
'shflux')
5366 romsscale=tracerfluxscale
5369 tindex=3-
iinfo(8,ifield,ng)
5372 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5373 fval=scale*ptr2d(i,j)+add_offset
5377 myfmin(1)=min(myfmin(1),fval)
5378 myfmax(1)=max(myfmax(1),fval)
5380 myfmin(2)=min(myfmin(2),fval)
5381 myfmax(2)=max(myfmax(2),fval)
5390 IF (localde.eq.localdecount-1)
THEN
5393 & lbi, ubi, lbj, ubj, &
5397 & lbi, ubi, lbj, ubj, &
5404# if !defined BULK_FLUXES && defined SALINITY
5408 CASE (
'sflx',
'swflux')
5409 romsscale=freshwaterscale
5412 tindex=3-
iinfo(8,ifield,ng)
5415 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5416 fval=scale*ptr2d(i,j)+add_offset
5420 myfmin(1)=min(myfmin(1),fval)
5421 myfmax(1)=max(myfmax(1),fval)
5423 myfmin(2)=min(myfmin(2),fval)
5424 myfmax(2)=max(myfmax(2),fval)
5433 IF (localde.eq.localdecount-1)
THEN
5436 & lbi, ubi, lbj, ubj, &
5440 & lbi, ubi, lbj, ubj, &
5447# if !defined BULK_FLUXES
5452 CASE (
'taux',
'sustr')
5453 IF (.not.
allocated(ustress))
THEN
5454 allocate ( ustress(lbi:ubi,lbj:ubj) )
5457 got_stress(1)=.true.
5458 romsscale=stressscale
5461 tindex=3-
iinfo(8,ifield,ng)
5464 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5465 fval=scale*ptr2d(i,j)+add_offset
5469 myfmin(1)=min(myfmin(1),fval)
5470 myfmax(1)=max(myfmax(1),fval)
5472 myfmin(2)=min(myfmin(2),fval)
5473 myfmax(2)=max(myfmax(2),fval)
5475 forces(ng)%sustrG(i,j,tindex)=fval
5481 IF (localde.eq.localdecount-1)
THEN
5484 & lbi, ubi, lbj, ubj, &
5488 & lbi, ubi, lbj, ubj, &
5494# if !defined BULK_FLUXES
5499 CASE (
'tauy',
'svstr')
5500 IF (.not.
allocated(vstress))
THEN
5501 allocate ( vstress(lbi:ubi,lbj:ubj) )
5504 got_stress(2)=.true.
5505 romsscale=stressscale
5508 tindex=3-
iinfo(8,ifield,ng)
5511 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5512 fval=scale*ptr2d(i,j)+add_offset
5516 myfmin(1)=min(myfmin(1),fval)
5517 myfmax(1)=max(myfmax(1),fval)
5519 myfmin(2)=min(myfmin(2),fval)
5520 myfmax(2)=max(myfmax(2),fval)
5522 forces(ng)%svstrG(i,j,tindex)=fval
5528 IF (localde.eq.localdecount-1)
THEN
5531 & lbi, ubi, lbj, ubj, &
5535 & lbi, ubi, lbj, ubj, &
5541# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
5546 IF (.not.
allocated(rhoair))
THEN
5547 allocate ( rhoair(lbi:ubi,lbj:ubj) )
5554 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5555 fval=scale*ptr2d(i,j)+add_offset
5559 myfmin(1)=min(myfmin(1),fval)
5560 myfmax(1)=max(myfmax(1),fval)
5562 myfmin(2)=min(myfmin(2),fval)
5563 myfmax(2)=max(myfmax(2),fval)
5567 IF (localde.eq.localdecount-1)
THEN
5570 & lbi, ubi, lbj, ubj, &
5574 & lbi, ubi, lbj, ubj, &
5584 IF (.not.
allocated(xwind))
THEN
5585 allocate ( xwind(lbi:ubi,lbj:ubj) )
5588 got_wind_sbl(1)=.true.
5592 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5593 fval=scale*ptr2d(i,j)+add_offset
5597 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5598 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5600 myfmin(2)=min(myfmin(2),fval)
5601 myfmax(2)=max(myfmax(2),fval)
5605 IF (localde.eq.localdecount-1)
THEN
5608 & lbi, ubi, lbj, ubj, &
5612 & lbi, ubi, lbj, ubj, &
5622 IF (.not.
allocated(ywind))
THEN
5623 allocate ( ywind(lbi:ubi,lbj:ubj) )
5626 got_wind_sbl(2)=.true.
5630 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5631 fval=scale*ptr2d(i,j)+add_offset
5635 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5636 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5638 myfmin(2)=min(myfmin(2),fval)
5639 myfmax(2)=max(myfmax(2),fval)
5643 IF (localde.eq.localdecount-1)
THEN
5646 & lbi, ubi, lbj, ubj, &
5650 & lbi, ubi, lbj, ubj, &
5660 IF (.not.
allocated(wstar))
THEN
5661 allocate ( wstar(lbi:ubi,lbj:ubj) )
5668 IF (abs(ptr2d(i,j)).lt.
tol_dp)
THEN
5669 fval=scale*ptr2d(i,j)+add_offset
5673 myfmin(1)=min(myfmin(1),ptr2d(i,j))
5674 myfmax(1)=max(myfmax(1),ptr2d(i,j))
5676 myfmin(2)=min(myfmin(2),fval)
5677 myfmax(2)=max(myfmax(2),fval)
5681 IF (localde.eq.localdecount-1)
THEN
5684 & lbi, ubi, lbj, ubj, &
5688 & lbi, ubi, lbj, ubj, &
5698 IF (localpet.eq.0)
THEN
5699 WRITE (
cplout,10) trim(importnamelist(ifld)), &
5700 & trim(time_currentstring), &
5706 rc=esmf_rc_not_found
5714 WRITE (
cplout,20) localpet, localde, &
5715 & lbound(ptr2d,dim=1), ubound(ptr2d,dim=1), &
5716 & lbound(ptr2d,dim=2), ubound(ptr2d,dim=2), &
5717 & istrr, iendr, jstrr, jendr
5723 IF (
associated(ptr2d))
nullify (ptr2d)
5728 CALL esmf_vmallreduce (vm, &
5729 & senddata=myfmin, &
5732 & reduceflag=esmf_reduce_min, &
5734 IF (esmf_logfounderror(rctocheck=rc, &
5735 & msg=esmf_logerr_passthru, &
5737 & file=myfile))
THEN
5741 CALL esmf_vmallreduce (vm, &
5742 & senddata=myfmax, &
5745 & reduceflag=esmf_reduce_max, &
5747 IF (esmf_logfounderror(rctocheck=rc, &
5748 & msg=esmf_logerr_passthru, &
5750 & file=myfile))
THEN
5756 IF ((
debuglevel.ge.0).and.(localpet.eq.0))
THEN
5757 WRITE (
cplout,30) trim(importnamelist(ifld)), &
5759 & trim(mydate(tindex)), ng, &
5760 & fmin(1), fmax(1), tindex
5762 & trim(time_currentstring), ng, &
5765 IF (romsscale.ne.1.0_dp)
THEN
5766 WRITE (
cplout,40) fmin(2), fmax(2), &
5767 &
' romsScale = ', romsscale
5768 ELSE IF (add_offset.ne.0.0_dp)
THEN
5769 WRITE (
cplout,40) fmin(2), fmax(2), &
5770 &
' AddOffset = ', add_offset
5780 linfo(1,ifield,ng)=.true.
5781 linfo(3,ifield,ng)=.false.
5782 iinfo(1,ifield,ng)=gtype
5783 iinfo(8,ifield,ng)=tindex
5784 finfo(1,ifield,ng)=tmin
5785 finfo(2,ifield,ng)=tmax
5786 finfo(3,ifield,ng)=tstr
5787 finfo(4,ifield,ng)=tend
5788 finfo(8,ifield,ng)=fmin(1)
5789 finfo(9,ifield,ng)=fmax(1)
5790 vtime(tindex,ifield,ng)=myvtime(tindex)
5791 tintrp(tindex,ifield,ng)=mytintrp(tindex)*86400.0_dp
5799 WRITE (ofile,50) ng, trim(importnamelist(ifld)), &
5800 & year, month, day, hour, minutes, seconds
5801 CALL esmf_fieldwrite (field, &
5803 & overwrite=.true., &
5805 IF (esmf_logfounderror(rctocheck=rc, &
5806 & msg=esmf_logerr_passthru, &
5808 & file=myfile))
THEN
5815# if defined BULK_FLUXES || defined ECOSIM
5819 IF (got_wind(1).and.got_wind(2))
THEN
5821 & lbi, ubi, lbj, ubj, &
5828# if !defined BULK_FLUXES
5833 IF (got_stress(1).and.got_stress(2))
THEN
5835 & lbi, ubi, lbj, ubj, &
5836 & ustress, vstress, &
5838 deallocate (ustress)
5839 deallocate (vstress)
5842# if defined WIND_MINUS_CURRENT && !defined BULK_FLUXES
5861 IF (got_rhoair.and.got_wstar.and. &
5862 & got_wind_sbl(1).and.got_wind_sbl(2))
THEN
5863 IF (.not.
allocated(uwrk))
THEN
5864 allocate ( uwrk(lbi:ubi,lbj:ubj) )
5867 IF (.not.
allocated(vwrk))
THEN
5868 allocate ( vwrk(lbi:ubi,lbj:ubj) )
5873 & lbi, ubi, lbj, ubj, &
5880 romsscale=stressscale
5881 urel=xwind(i,j)-uwrk(i,j)
5882 vrel=ywind(i,j)-vwrk(i,j)
5883 wmag=sqrt(xwind(i,j)*xwind(i,j)+ &
5884 & ywind(i,j)*ywind(i,j))
5885 wrel=sqrt(urel*urel+vrel*vrel)
5886 cff1=romsscale*rhoair(i,j)
5887 cff2=wstar(i,j)*wstar(i,j)/(wmag*wmag+eps)
5891 myfmin(1)=min(myfmin(1),uwrk(i,j))
5892 myfmin(2)=min(myfmin(2),vwrk(i,j))
5893 myfmax(1)=max(myfmax(1),uwrk(i,j))
5894 myfmax(2)=max(myfmax(2),vwrk(i,j))
5903 & lbi, ubi, lbj, ubj, &
5913 CALL esmf_vmallreduce (vm, &
5914 & senddata=myfmin, &
5917 & reduceflag=esmf_reduce_min, &
5919 IF (esmf_logfounderror(rctocheck=rc, &
5920 & msg=esmf_logerr_passthru, &
5922 & file=myfile))
THEN
5926 CALL esmf_vmallreduce (vm, &
5927 & senddata=myfmax, &
5930 & reduceflag=esmf_reduce_max, &
5932 IF (esmf_logfounderror(rctocheck=rc, &
5933 & msg=esmf_logerr_passthru, &
5935 & file=myfile))
THEN
5939 IF (localpet.eq.0)
THEN
5940 WRITE (
cplout,60)
'sustr', &
5941 & trim(time_currentstring), ng, &
5942 & fmin(1)/stressscale, &
5943 & fmax(1)/stressscale
5944 WRITE (
cplout,40) fmin(1), fmax(1), &
5945 &
' romsScale = ', stressscale
5947 WRITE (
cplout,60)
'svstr', &
5948 & trim(time_currentstring), ng, &
5949 & fmin(2)/stressscale, &
5950 & fmax(2)/stressscale
5951 WRITE (
cplout,40) fmin(2), fmax(2), &
5952 &
' romsScale = ', stressscale
5960 IF (
allocated(importnamelist))
deallocate (importnamelist)
5964 IF (importcount.gt.0)
THEN
5969 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_Import', &
5975 10
FORMAT (/,3x,
' ROMS_Import - unable to find option to import: ', &
5976 & a,t72,a,/,18x,
'check ''Import(roms)'' in input script: ', &
5978 20
FORMAT (18x,
'PET/DE [',i3.3,
'/',i2.2,
'], Pointer Size: ',4i8, &
5979 & /,36x,
'Tiling Range: ',4i8)
5980 30
FORMAT (3x,
' ROMS_Import - ESMF: importing field ''',a,
'''', &
5981 & t72,a,2x,
'Grid ',i2.2, &
5983 & /,19x,
'(InpMin = ', 1p,e15.8,0p,
' InpMax = ',1p,e15.8,0p, &
5984 &
' SnapshotIndex = ',i1,
')')
5986 & /,19x,
'(InpMin = ', 1p,e15.8,0p,
' InpMax = ',1p,e15.8,0p, &
5989 40
FORMAT (19x,
'(OutMin = ', 1p,e15.8,0p,
' OutMax = ',1p,e15.8,0p, &
5990 & 1x,a,1p,e15.8,0p,
')')
5991 50
FORMAT (
'roms_',i2.2,
'_import_',a,
'_',i4.4,2(
'-',i2.2),
'_', &
5992 & i2.2,2(
'.',i2.2),
'.nc')
5993 60
FORMAT (3x,
' ROMS_Import - ESMF: computing field ''',a,
'''', &
5994 & t72,a,2x,
'Grid ',i2.2, &
5995 & /,19x,
'(InpMin = ', 1p,e15.8,0p,
' InpMax = ',1p,e15.8,0p, &
6011 integer,
intent(in) :: ng
6012 integer,
intent(out) :: rc
6014 TYPE (esmf_gridcomp) :: model
6018 logical :: get_barotropic
6019 logical :: get_surfacecurrent
6021 integer :: istr, iend, jstr, jend
6022 integer :: istrr, iendr, jstrr, jendr
6023 integer :: lbi, ubi, lbj, ubj
6024 integer :: exportcount
6025 integer :: localde, localdecount, localpet, tile
6026 integer :: year, month, day, hour, minutes, seconds, sn, sd
6027 integer :: ifld, i, is, j
6029 real (
dp) :: fmin(1), fmax(1), fval, myfmin(1), myfmax(1)
6031 real (
dp),
pointer :: ptr2d(:,:) => null()
6033 real (
dp),
allocatable :: ubar(:,:), vbar(:,:)
6034 real (
dp),
allocatable :: usur(:,:), vsur(:,:)
6036 character (len=22) :: time_currentstring
6038 character (len=:),
allocatable :: fldname
6040 character (len=*),
parameter :: myfile = &
6041 & __FILE__//
", ROMS_Export"
6043 character (ESMF_MAXSTR) :: cname, ofile
6044 character (ESMF_MAXSTR),
allocatable :: exportnamelist(:)
6046 TYPE (esmf_field) :: field
6047 TYPE (esmf_time) :: currenttime
6048 TYPE (esmf_vm) :: vm
6055 WRITE (
trac,
'(a,a,i0)')
'==> Entering ROMS_Export', &
6065 CALL esmf_gridcompget (model, &
6066 & localpet=localpet, &
6070 IF (esmf_logfounderror(rctocheck=rc, &
6071 & msg=esmf_logerr_passthru, &
6073 & file=myfile))
THEN
6082 & localdecount=localdecount, &
6084 IF (esmf_logfounderror(rctocheck=rc, &
6085 & msg=esmf_logerr_passthru, &
6087 & file=myfile))
THEN
6100 istrr=
bounds(ng)%IstrR(tile)
6101 iendr=
bounds(ng)%IendR(tile)
6102 jstrr=
bounds(ng)%JstrR(tile)
6103 jendr=
bounds(ng)%JendR(tile)
6105 istr=
bounds(ng)%Istr(tile)
6106 iend=
bounds(ng)%Iend(tile)
6107 jstr=
bounds(ng)%Jstr(tile)
6108 jend=
bounds(ng)%Jend(tile)
6115 & currtime=currenttime, &
6117 IF (esmf_logfounderror(rctocheck=rc, &
6118 & msg=esmf_logerr_passthru, &
6120 & file=myfile))
THEN
6124 CALL esmf_timeget (currenttime, &
6133 & timestring=time_currentstring, &
6135 IF (esmf_logfounderror(rctocheck=rc, &
6136 & msg=esmf_logerr_passthru, &
6138 & file=myfile))
THEN
6141 is=index(time_currentstring,
'T')
6142 IF (is.gt.0) time_currentstring(is:is)=
' '
6148 CALL esmf_stateget (
models(
iroms)%ExportState(ng), &
6149 & itemcount=exportcount, &
6151 IF (esmf_logfounderror(rctocheck=rc, &
6152 & msg=esmf_logerr_passthru, &
6154 & file=myfile))
THEN
6158 IF (.not.
allocated(exportnamelist))
THEN
6159 allocate ( exportnamelist(exportcount) )
6162 CALL esmf_stateget (
models(
iroms)%ExportState(ng), &
6163 & itemnamelist=exportnamelist, &
6165 IF (esmf_logfounderror(rctocheck=rc, &
6166 & msg=esmf_logerr_passthru, &
6168 & file=myfile))
THEN
6176 get_barotropic=.true.
6177 get_surfacecurrent=.true.
6179 fld_loop :
DO ifld=1,exportcount
6183 CALL esmf_stateget (
models(
iroms)%ExportState(ng), &
6184 & trim(exportnamelist(ifld)), &
6187 IF (esmf_logfounderror(rctocheck=rc, &
6188 & msg=esmf_logerr_passthru, &
6190 & file=myfile))
THEN
6203 de_loop :
DO localde=0,localdecount-1
6204 CALL esmf_fieldget (field, &
6205 & localde=localde, &
6206 & farrayptr=ptr2d, &
6208 IF (esmf_logfounderror(rctocheck=rc, &
6209 & msg=esmf_logerr_passthru, &
6211 & file=myfile))
THEN
6224 SELECT CASE (trim(adjustl(exportnamelist(ifld))))
6227# if defined EXCLUDE_SPONGE && \
6228 (defined data_coupling &&
6241# if defined EXCLUDE_SPONGE && \
6242 (defined data_coupling &&
6244 &
mixing(ng)%diff_factor(i,j).gt.1.0_dp)
THEN
6249 IF (
grid(ng)%rmask(i,j).gt.0.0_r8)
THEN
6250 myfmin(1)=min(myfmin(1),fval)
6251 myfmax(1)=max(myfmax(1),fval)
6254 myfmin(1)=min(myfmin(1),fval)
6255 myfmax(1)=max(myfmax(1),fval)
6261 IF (
grid(ng)%rmask(i,j).gt.0.0_r8)
THEN
6262 myfmin(1)=min(myfmin(1),fval)
6263 myfmax(1)=max(myfmax(1),fval)
6266 myfmin(1)=min(myfmin(1),fval)
6267 myfmax(1)=max(myfmax(1),fval)
6283 IF (
grid(ng)%rmask(i,j).gt.0.0_r8)
THEN
6284 myfmin(1)=min(myfmin(1),fval)
6285 myfmax(1)=max(myfmax(1),fval)
6288 myfmin(1)=min(myfmin(1),fval)
6289 myfmax(1)=max(myfmax(1),fval)
6298 CASE (
'Ubar',
'Vbar')
6300 & exportnamelist(ifld)), &
6301 &
noerror, __line__, myfile))
THEN
6302 rc=esmf_rc_not_found
6306 IF (get_barotropic)
THEN
6307 get_barotropic=.false.
6308 IF (.not.
allocated(ubar))
THEN
6309 allocate ( ubar(lbi:ubi,lbj:ubj) )
6312 IF (.not.
allocated(vbar))
THEN
6313 allocate ( vbar(lbi:ubi,lbj:ubj) )
6317 & lbi, ubi, lbj, ubj, &
6323 IF (fldname.eq.
'Ubar')
THEN
6327 myfmin(1)=min(myfmin(1),fval)
6328 myfmax(1)=max(myfmax(1),fval)
6337 myfmin(1)=min(myfmin(1),fval)
6338 myfmax(1)=max(myfmax(1),fval)
6347 CASE (
'Usur',
'Vsur')
6349 & exportnamelist(ifld)), &
6350 &
noerror, __line__, myfile))
THEN
6351 rc=esmf_rc_not_found
6355 IF (get_surfacecurrent)
THEN
6356 get_surfacecurrent=.false.
6357 IF (.not.
allocated(ubar))
THEN
6358 allocate ( usur(lbi:ubi,lbj:ubj) )
6361 IF (.not.
allocated(vbar))
THEN
6362 allocate ( vsur(lbi:ubi,lbj:ubj) )
6366 & lbi, ubi, lbj, ubj, &
6372 IF (fldname.eq.
'Usur')
THEN
6376 myfmin(1)=min(myfmin(1),fval)
6377 myfmax(1)=max(myfmax(1),fval)
6386 myfmin(1)=min(myfmin(1),fval)
6387 myfmax(1)=max(myfmax(1),fval)
6401 fval=
grid(ng)%h(i,j)
6402 myfmin(1)=min(myfmin(1),fval)
6403 myfmax(1)=max(myfmax(1),fval)
6412 CASE (
'mask_rho',
'rmask',
'msk')
6417 IF (
grid(ng)%rmask(i,j).gt.0.0_r8)
THEN
6419 IF (
grid(ng)%rmask(i,j).ne. &
6420 &
grid(ng)%rmask_wet(i,j))
THEN
6421 ptr2d(i,j)=
grid(ng)%rmask_wet(i,j)
6423 ptr2d(i,j)=
grid(ng)%rmask(i,j)
6426 ptr2d(i,j)=
grid(ng)%rmask(i,j)
6428 myfmin(1)=min(myfmin(1),ptr2d(i,j))
6429 myfmax(1)=max(myfmax(1),ptr2d(i,j))
6438 IF (localpet.eq.0)
THEN
6439 WRITE (
cplout,10) trim(adjustl(exportnamelist(ifld))), &
6442 rc=esmf_rc_not_found
6443 IF (esmf_logfounderror(rctocheck=rc, &
6444 & msg=esmf_logerr_passthru, &
6446 & file=myfile))
THEN
6454 IF (
associated(ptr2d))
nullify (ptr2d)
6459 CALL esmf_vmallreduce (vm, &
6460 & senddata=myfmin, &
6463 & reduceflag=esmf_reduce_min, &
6465 IF (esmf_logfounderror(rctocheck=rc, &
6466 & msg=esmf_logerr_passthru, &
6468 & file=myfile))
THEN
6472 CALL esmf_vmallreduce (vm, &
6473 & senddata=myfmax, &
6476 & reduceflag=esmf_reduce_max, &
6478 IF (esmf_logfounderror(rctocheck=rc, &
6479 & msg=esmf_logerr_passthru, &
6481 & file=myfile))
THEN
6485 IF (localpet.eq.0)
THEN
6486 WRITE (
cplout,20) trim(exportnamelist(ifld)), &
6487 & trim(time_currentstring), ng, &
6494 &
models(
iroms)%ExportField(ifld)%debug_write)
THEN
6495 WRITE (ofile,30) ng, trim(exportnamelist(ifld)), &
6496 year, month, day, hour, minutes, seconds
6497 CALL esmf_fieldwrite (field, &
6499 & overwrite=.true., &
6501 IF (esmf_logfounderror(rctocheck=rc, &
6502 & msg=esmf_logerr_passthru, &
6504 & file=myfile))
THEN
6512 IF (
allocated(exportnamelist))
deallocate (exportnamelist)
6516 IF (exportcount.gt.0)
THEN
6521 WRITE (
trac,
'(a,a,i0)')
'<== Exiting ROMS_Export', &
6527 10
FORMAT (/,3x,
' ROMS_Export - unable to find option to export: ', &
6528 & a,/,18x,
'check ''Export(roms)'' in input YAML: ',a)
6529 20
FORMAT (3x,
' ROMS_Export - ESMF: exporting field ''',a,
'''', &
6530 & t72,a,2x,
'Grid ',i2.2,/, &
6531 & 18x,
'(OutMin = ', 1p,e15.8,0p,
' OutMax = ',1p,e15.8,0p, &
6533 30
FORMAT (
'roms_',i2.2,
'_export_',a,
'_',i4.4,2(
'-',i2.2),
'_', &
6534 & i2.2,2(
'.',i2.2),
'.nc')