diff --git a/CMakeLists.txt b/CMakeLists.txt index 83b5d25..fb5f4f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,3 +4,7 @@ esma_add_library (${this} SRCS GEOS_OceanGridComp.F90 SUBCOMPONENTS MOM6_GEOSPlug MOM_GEOS5PlugMod GEOSdatasea_GridComp DEPENDENCIES GEOSdatasea_GridComp MAPL esmf) + +mapl_acg (${this} GEOS_Ocean_StateSpecs.rc + IMPORT_SPECS EXPORT_SPECS INTERNAL_SPECS + GET_POINTERS DECLARE_POINTERS) diff --git a/GEOS_OceanGridComp.F90 b/GEOS_OceanGridComp.F90 index 0a4bdf4..9b4f9ba 100644 --- a/GEOS_OceanGridComp.F90 +++ b/GEOS_OceanGridComp.F90 @@ -1,5 +1,3 @@ -!$Id$ - #include "MAPL_Generic.h" module GEOS_OceanGridCompMod @@ -20,13 +18,13 @@ module GEOS_OceanGridCompMod public SetServices - character(len=ESMF_MAXSTR) :: OCEAN_NAME - integer :: DO_DATASEA - real :: OrphanDepth + character(len=ESMF_MAXSTR) :: OCEAN_NAME + integer :: DO_DATASEA + real :: OrphanDepth ! !DESCRIPTION: ! -! {\tt GuestOcean\_GridComp} is a light-weight gridded component that serves an +! {\tt GEOS\_OceanGridComp} is a light-weight gridded component that serves an ! interface to ocean/data\_ocean components. ! !EOP @@ -43,12 +41,11 @@ module GEOS_OceanGridCompMod integer :: OCNd logical :: DUAL_OCEAN - contains !BOP -! !IROUTINE: SetServices -- Sets ESMF services for GuestOcean +! !IROUTINE: SetServices -- Sets ESMF services for Ocean ! !INTERFACE: @@ -64,8 +61,6 @@ subroutine SetServices ( GC, RC ) ! as well as allocating our instance of a generic state and putting it in the ! gridded component (GC). Here we override all three methods and declare ! the specs for the Imports and Export States (no MAPL controlled Internal State). -! GuestOcean state variables (the bulletin board and the time) are kept -! in the GuestOcean's Private Internal state. ! !EOP @@ -73,55 +68,48 @@ subroutine SetServices ( GC, RC ) ! ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Local vars type (MAPL_MetaComp), pointer :: MAPL type (ESMF_Config) :: CF - integer :: iDUAL_OCEAN + integer :: iDUAL_OCEAN character(len=ESMF_MAXSTR) :: charbuf_ character(len=ESMF_MAXSTR) :: sharedObj + __Iam__('SetServices') + ! Begin... ! Get my name and set-up traceback handle ! --------------------------------------- - Iam = 'SetServices' - call ESMF_GridCompGet( GC, NAME=COMP_NAME, CONFIG=CF, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // Iam - + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//Iam ! Set the state variable specs. ! ----------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) ! Get constants from CF ! --------------------- - call MAPL_GetResource ( MAPL, DO_DATASEA, Label="USE_DATASEA:" , DEFAULT=1, RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetResource ( MAPL, OrphanDepth, Label="OGCM_TOP_LAYER:" , DEFAULT=10.0, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetResource (MAPL, DO_DATASEA, Label="USE_DATASEA:" , DEFAULT=1, _RC) + call MAPL_GetResource (MAPL, OrphanDepth, Label="OGCM_TOP_LAYER:" , DEFAULT=10.0, _RC) if(DO_DATASEA/=0) then OCEAN_NAME="DATASEA" - OCN = MAPL_AddChild(GC, NAME=OCEAN_NAME, SS=DataSeaSetServices, RC=STATUS) - VERIFY_(STATUS) + OCN = MAPL_AddChild(GC, NAME=OCEAN_NAME, SS=DataSeaSetServices, _RC) else - call MAPL_GetResource ( MAPL, OCEAN_NAME, Label="OCEAN_NAME:", DEFAULT="MOM", __RC__ ) + call MAPL_GetResource ( MAPL, OCEAN_NAME, Label="OCEAN_NAME:", DEFAULT="MOM", _RC) select case (trim(OCEAN_NAME)) case ("MOM") - call MAPL_GetResource ( MAPL, sharedObj, Label="MOM_GEOS5PLUGMOD:", DEFAULT="libMOM_GEOS5PlugMod.so", __RC__ ) - OCN = MAPL_AddChild(OCEAN_NAME,'setservices_', parentGC=GC, sharedObj=sharedObj, __RC__) + call MAPL_GetResource ( MAPL, sharedObj, Label="MOM_GEOS5PLUGMOD:", DEFAULT="libMOM_GEOS5PlugMod.so", _RC) + OCN = MAPL_AddChild(OCEAN_NAME,'setservices_', parentGC=GC, sharedObj=sharedObj, _RC) case ("MOM6") - call MAPL_GetResource ( MAPL, sharedObj, Label="MOM6_GEOSPLUG:", DEFAULT="libMOM6_GEOSPlug.so", __RC__ ) - OCN = MAPL_AddChild(OCEAN_NAME,'setservices_', parentGC=GC, sharedObj=sharedObj, __RC__) + call MAPL_GetResource ( MAPL, sharedObj, Label="MOM6_GEOSPLUG:", DEFAULT="libMOM6_GEOSPlug.so", _RC) + OCN = MAPL_AddChild(OCEAN_NAME,'setservices_', parentGC=GC, sharedObj=sharedObj, _RC) case default charbuf_ = "OCEAN_NAME: " // trim(OCEAN_NAME) // " is not implemented, ABORT!" call WRITE_PARALLEL(charbuf_) @@ -129,13 +117,12 @@ subroutine SetServices ( GC, RC ) end select endif - call MAPL_GetResource(MAPL, iDUAL_OCEAN, 'DUAL_OCEAN:', default=0, __RC__ ) + call MAPL_GetResource(MAPL, iDUAL_OCEAN, 'DUAL_OCEAN:', default=0, _RC) DUAL_OCEAN = iDUAL_OCEAN /= 0 OCNd = 0 if (dual_ocean) then - OCNd = MAPL_AddChild(GC, NAME="DATASEA", SS=DataSeaSetServices, RC=STATUS) - VERIFY_(STATUS) + OCNd = MAPL_AddChild(GC, NAME="DATASEA", SS=DataSeaSetServices, _RC) endif ! Set the state variable specs. @@ -143,233 +130,14 @@ subroutine SetServices ( GC, RC ) !BOS -! !IMPORT STATE: +! !Import state: +#include "GEOS_Ocean_Import___.h" - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FROCEAN', & - LONG_NAME = 'fraction_of_gridbox_covered_by_ocean',& - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUX', & - LONG_NAME = 'Agrid_eastward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) +! !Export state: +#include "GEOS_Ocean_Export___.h" - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUY', & - LONG_NAME = 'Agrid_northward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVR', & - LONG_NAME = 'net_downward_penetrating_direct_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAR', & - LONG_NAME = 'net_downward_penetrating_direct_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVF', & - LONG_NAME = 'net_downward_penetrating_diffuse_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAF', & - LONG_NAME = 'net_downward_penetrating_diffuse_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'net_surface_downwelling_nir_beam_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DRNIR' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'net_surface_downwelling_nir_diffuse_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DFNIR' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SWHEAT', & - LONG_NAME = 'solar_heating_rate', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'river_discharge_at_ocean_points',& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'DISCHARGE' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - if (trim(OCEAN_NAME) == "MOM") then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TR', & - LONG_NAME = 'tracer_mixing_ratios', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_BundleItem, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TRFLUX', & - LONG_NAME = 'surface_fluxes_of_tracers', & - UNITS = 'X', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - DATATYPE = MAPL_BundleItem, & - RC=STATUS ) - VERIFY_(STATUS) - endif - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'surface_net_downward_longwave_flux',& - UNITS = 'W m-2', & - SHORT_NAME = 'LWFLX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'upward_sensible_heat_flux' ,& - UNITS = 'W m-2', & - SHORT_NAME = 'SHFLX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'evaporation' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'QFLUX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'ocean_snowfall' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'SNOW' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'ocean_rainfall' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'RAIN' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FRESH', & - LONG_NAME = 'fresh_water_flux_due_to_ice_dynamics', & - UNITS = 'kg m-2 s-1' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FSALT', & - LONG_NAME = 'salt_flux_due_to_ice_dynamics', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FHOCN', & - LONG_NAME = 'heat_flux_due_to_ice_dynamics', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PEN_OCN', & - LONG_NAME = 'penetrated_shortwave_flux_at_the_bottom_of_first_ocean_model_layer', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - if (dual_ocean) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FRACICEd', & - LONG_NAME = 'fractional_cover_of_seaice', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - endif - -! ! Need to have this internal state to fill in orphan points: - - call MAPL_AddInternalSpec(GC, & - SHORT_NAME = 'TS_FOUND', & - LONG_NAME = 'foundation_temperature_for_interface_layer',& - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - FRIENDLYTO = trim(COMP_NAME), & - DEFAULT = 280.0, & - RC=STATUS ) - VERIFY_(STATUS) +! !Internal state: +#include "GEOS_Ocean_Internal___.h" !ALT Note the FRACICE from datasea is inhereted (in AMIP or dual_ocean) @@ -384,222 +152,25 @@ subroutine SetServices ( GC, RC ) RC=STATUS ) VERIFY_(STATUS) +! Exports of (a) child - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SS_FOUND', & - LONG_NAME = 'foundation_salinity_for_interface_layer',& - UNITS = 'PSU', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'FRZMLT', & - LONG_NAME = 'freeze_melt_potential', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - -! Diagnostics exports - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TAUX', & - LONG_NAME = 'Agrid_eastward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TAUY', & - LONG_NAME = 'Agrid_northward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SWHEAT', & - LONG_NAME = 'solar_heating_rate', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'RFLUX', & - LONG_NAME = 'downward_radiative_heat_flux_at_ocean_bottom',& - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - LONG_NAME = 'river_discharge_at_ocean_points',& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'DISCHARGE' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'FROCEAN', & - LONG_NAME = 'fraction_of_gridbox_covered_by_ocean',& - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - LONG_NAME = 'surface_net_downward_longwave_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'LWFLX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - LONG_NAME = 'surface_net_downward_shortwave_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'SWFLX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - LONG_NAME = 'upward_sensible_heat_flux' ,& - UNITS = 'W m-2', & - SHORT_NAME = 'SHFLX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - LONG_NAME = 'evaporation' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'QFLUX' ,& - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SFLX', & - LONG_NAME = 'salt_flux_due_to_ice_dynamics', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'RAIN', & - LONG_NAME = 'ocean_rainfall',& - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SNOW', & - LONG_NAME = 'ocean_snowfall',& - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'PEN_OCN', & - LONG_NAME = 'penetrated_shortwave_flux_at_the_bottom_of_first_ocean_model_layer',& - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - -! Exports of child - - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'TW', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'SW', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'UW', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'VW', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'TW', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'SW', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'UW', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'VW', CHILD_ID = OCN, _RC) if(DO_DATASEA==0) then - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'DH', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'UWB', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'VWB', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - if (trim(OCEAN_NAME) == "MOM") then - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'SSH', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - endif - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'SLV', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'DH', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'UWB', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'VWB', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'SLV', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'T', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'S', CHILD_ID = OCN, _RC) + if (trim(OCEAN_NAME) == "MOM") then - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'PBO', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'SSH', CHILD_ID = OCN, _RC) + call MAPL_AddExportSpec (GC, SHORT_NAME = 'PBO', CHILD_ID = OCN, _RC) endif - - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'T', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec ( GC , & - SHORT_NAME = 'S', & - CHILD_ID = OCN, & - RC=STATUS ) - VERIFY_(STATUS) end if !EOS @@ -610,55 +181,42 @@ subroutine SetServices ( GC, RC ) 'PENUVR','PENPAR','PENUVF','PENPAF', 'DRNIR', 'DFNIR', & 'DISCHARGE', 'LWFLX', 'SHFLX', 'QFLUX', 'RAIN', 'SNOW', & 'SFLX','SWHEAT'], & ! do not terminate import of PEN_OCN since it is not used in the `plug' - CHILD=OCN, RC=STATUS ) - VERIFY_(STATUS) + CHILD=OCN, _RC) end if ! Set the Initialize, Run, Finalize entry points ! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, RC=status) - VERIFY_(STATUS) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, _RC) ! phase 1 - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=status) - VERIFY_(STATUS) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, _RC) ! phase 2 - this is only used in the predictor part of the replay for dual ocean if (DUAL_OCEAN) then - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=status) - VERIFY_(STATUS) - end if + call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, _RC) + endif ! terminate child's import for a temperature correction - we will fill it here, if we run in dual_ocean mode, otherwise nobody needs this variable if(DUAL_OCEAN) then call MAPL_TerminateImport ( GC, & - SHORT_NAME = (/'DEL_TEMP'/), & - CHILD = OCN, & - RC=STATUS ) - VERIFY_(STATUS) + SHORT_NAME = (/'DEL_TEMP'/), & + CHILD = OCN, & + _RC) endif - -!============================================================================= -! Generic SetServices--This creates the generic state and calls SetServices for children -!--------------------------------------------------------------------------------------- - - call MAPL_GenericSetServices ( GC, RC=STATUS ) - VERIFY_(STATUS) - ! Set the Profiling timers ! ------------------------ - call MAPL_TimerAdd(GC, name="INITIALIZE" ,RC=STATUS) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="RUN" ,RC=STATUS) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="--ModRun" ,RC=STATUS) - VERIFY_(STATUS) + call MAPL_TimerAdd(GC, name="INITIALIZE" , _RC) + call MAPL_TimerAdd(GC, name="RUN" , _RC) + call MAPL_TimerAdd(GC, name="--ModRun" , _RC) -! All Done -!--------- +! Generic SetServices--This creates the generic state and calls SetServices for children +!--------------------------------------------------------------------------------------- + + call MAPL_GenericSetServices (GC, _RC ) RETURN_(ESMF_SUCCESS) + end subroutine SetServices ! ----------------------------------------------------------------- @@ -683,8 +241,6 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Local derived type aliases @@ -708,21 +264,20 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) !============================================================================= + __Iam__('Initialize') + ! Begin... ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- - Iam = "Initialize" - call ESMF_GridCompGet( GC, NAME=COMP_NAME, grid=GRID, RC=status ) - VERIFY_(STATUS) - Iam = trim(comp_name) // trim(Iam) + call ESMF_GridCompGet( GC, NAME=COMP_NAME, grid=GRID, _RC ) + Iam = trim(COMP_NAME)//'::'//'Initialize' ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, State, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, State, _RC) ! Profilers !---------- @@ -733,19 +288,12 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Get info from the Generic state !-------------------------------- - call MAPL_Get(STATE, & - GIM = GIM, & - GEX = GEX, & - RC=STATUS ) - VERIFY_(STATUS) - + call MAPL_Get(STATE, GIM=GIM, GEX=GEX, _RC) ! Allocate the private state... !------------------------------ - allocate( PrivateSTATE , stat=STATUS ) - VERIFY_(STATUS) - + allocate( PrivateSTATE, __STAT__) wrap%ptr => PrivateState ! And put it in the GC @@ -756,67 +304,53 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Initialize the PrivateState. First the time... !----------------------------------------------- - call MAPL_GetResource(STATE,DT, Label="RUN_DT:", RC=STATUS) ! Get AGCM Heartbeat - VERIFY_(status) - call MAPL_GetResource(STATE,DT, Label="OCEAN_DT:", DEFAULT=DT, RC=STATUS) ! set Default OCEAN_DT to AGCM Heartbeat - VERIFY_(status) - - CALL ESMF_TimeIntervalSet(timeStep, S=NINT(DT), RC=status) - VERIFY_(status) + call MAPL_GetResource(STATE,DT, Label="RUN_DT:", _RC) ! Get AGCM Heartbeat + call MAPL_GetResource(STATE,DT, Label="OCEAN_DT:", DEFAULT=DT, _RC) ! set Default OCEAN_DT to AGCM Heartbeat - call ESMF_ClockGet(CLOCK, currTIME=currTime, RC=STATUS) - VERIFY_(STATUS) + CALL ESMF_TimeIntervalSet(timeStep, S=NINT(DT), _RC) + call ESMF_ClockGet(CLOCK, currTIME=currTime, _RC) !ALT: check with Max about moving the clock 1 step forward PrivateState%clock = ESMF_ClockCreate(NAME = TRIM(OCEAN_NAME)//"Clock", & - timeStep=timeStep, startTime=currTime, rc=status) - VERIFY_(status) - + timeStep=timeStep, startTime=currTime, _RC) ! Initialize the Ocean Model. ! ! This verifies the Grid and the Time against the private restarts. ! -! Verifying that the GuestOcean grid and decomposition match those +! Verifying that the Ocean grid and decomposition match those ! inherited by the component. This is simply asserting that the ! local im, jm, and lm are the same and making sure its internal ! communication is consistent with the VM in the host's grid, probably -! by initializing the guests's internal communication with the +! by initializing the ocean's internal communication with the ! communicator that comes from the VM in the Grid's Layout. ! ! Note thet tha bulletin board states , GIM(:) and GEX(:), have been created and -! populated with nodata fields. The ESMF arrays will be filled later. +! populated with no data fields. The ESMF arrays will be filled later. !----------------------------------------------------------------------- ! Get sizes from my internal state !--------------------------------- - call MAPL_Get(STATE, & - IM=IM, & - JM=JM, & - LM=LM, & - RC=STATUS) - VERIFY_(STATUS) + call MAPL_Get(STATE, IM=IM, JM=JM, LM=LM, _RC) ! Once we know we have a valid ESMF grid, we can call MAPL_GenericInitialize. ! This will allow us to use the built-in checkpoint/restart for our states. !---------------------------------------------------------------------------- - call MAPL_TimerOff(STATE,"TOTAL" ) - call MAPL_GenericInitialize( GC, IMPORT, EXPORT, CLOCK, RC=status ) - VERIFY_(STATUS) - call MAPL_TimerOn (STATE,"TOTAL" ) + call MAPL_GenericInitialize( GC, IMPORT, EXPORT, CLOCK, _RC ) + call MAPL_TimerOn(STATE,"TOTAL" ) if(DO_DATASEA==0) then - call MAPL_GetPointer(EXPORT, MASKO, 'MASKO' , alloc=.true.,__RC__) + call MAPL_GetPointer(EXPORT, MASKO, 'MASKO' , alloc=.true., _RC) select case (trim(OCEAN_NAME)) case ("MOM") - call MAPL_GetPointer(GEX(OCN), MASK3D, 'MOM_3D_MASK', __RC__) + call MAPL_GetPointer(GEX(OCN), MASK3D, 'MOM_3D_MASK', _RC) MASK => MASK3D(:,:,1) case ("MOM6") - call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', __RC__) + call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', _RC) end select if(associated(MASKO)) MASKO = MASK end if @@ -824,8 +358,6 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) call MAPL_TimerOff(STATE,"TOTAL" ) call MAPL_TimerOff(STATE,"INITIALIZE") -! All Done -!--------- RETURN_(ESMF_SUCCESS) end subroutine Initialize @@ -838,22 +370,20 @@ end subroutine Initialize ! !INTERFACE: - subroutine Run ( gc, import, export, clock, rc ) + subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! !ARGUMENTS: - type(ESMF_GridComp), intent(INOUT) :: gc ! Gridded component - type(ESMF_State), intent(INOUT) :: import ! Import state - type(ESMF_State), intent(INOUT) :: export ! Export state - type(ESMF_Clock), intent(INOUT) :: clock ! The supervisor clock - integer, optional, intent( OUT) :: rc ! Error code: + type(ESMF_GridComp), intent(INOUT) :: GC ! Gridded component + type(ESMF_State), intent(INOUT) :: IMPORT ! Import state + type(ESMF_State), intent(INOUT) :: EXPORT ! Export state + type(ESMF_Clock), intent(INOUT) :: CLOCK ! The supervisor clock + integer, optional, intent( OUT) :: RC ! Error code: !EOP ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Local derived type aliases @@ -913,7 +443,6 @@ subroutine Run ( gc, import, export, clock, rc ) real, pointer :: SFLXe(:,:) real, pointer :: PEN_OCNe(:,:) - ! Pointers to imports of child real, pointer :: TAUX(:,:) @@ -964,24 +493,25 @@ subroutine Run ( gc, import, export, clock, rc ) integer :: ID integer :: PHASE integer, allocatable :: PREDICTOR_CHLD(:) - real, pointer :: FR(:,:) => null() - real, pointer :: FRI(:,:,:) => null() + real, pointer :: FR(:,:) => null() + real, pointer :: FRI(:,:,:) => null() character(len=ESMF_MAXSTR) :: replayMode + __Iam__('Run') + ! Get the component's name and set-up traceback handle. ! ----------------------------------------------------- - Iam = "Run" - call ESMF_GridCompGet( gc, NAME=comp_name, currentPhase=PHASE, RC=status ) - VERIFY_(status) + call ESMF_GridCompGet( gc, NAME=COMP_NAME, currentPhase=PHASE, _RC) + Iam = trim(COMP_NAME)//'::'//'Run' + if (PHASE >= 10) PHASE = PHASE - 10 ! to be replaced by MAPL get_phase - Iam = trim(comp_name) // Iam + Iam = trim(COMP_NAME) // Iam ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, STATE, RC=status) - VERIFY_(status) + call MAPL_GetObjectFromGC ( GC, STATE, _RC) ! Profilers !---------- @@ -991,26 +521,24 @@ subroutine Run ( gc, import, export, clock, rc ) ! Get child's import ad export to use as a bulletin board !-------------------------------------------------------- - call MAPL_Get(STATE, & - GCS = GCS, & - GIM = GIM, & - GEX = GEX, & - LONS = LONS, & - LATS = LATS, & - IM = IM, & - JM = JM, & - LM = LM, & - RC=STATUS ) - VERIFY_(STATUS) + call MAPL_Get(STATE, & + GCS = GCS, & + GIM = GIM, & + GEX = GEX, & + LONS = LONS, & + LATS = LATS, & + IM = IM, & + JM = JM, & + LM = LM, & + _RC) ! Check the clocks to set set-up the "run-to" time !------------------------------------------------- - call ESMF_ClockGet( CLOCK, currTime=endTime, RC=STATUS) - VERIFY_(status) + call ESMF_ClockGet( CLOCK, currTime=endTime, _RC) -! Get GuestModel's private internal state +! Get ocean model's private internal state !--------------------------------- CALL ESMF_UserCompGetInternalState( GC, TRIM(OCEAN_NAME)//'_internal_state', WRAP, STATUS ) @@ -1018,23 +546,17 @@ subroutine Run ( gc, import, export, clock, rc ) PrivateSTATE => WRAP%PTR - call ESMF_ClockGet( PrivateState%CLOCK, currTime=myTime, RC=STATUS) - VERIFY_(status) + call ESMF_ClockGet( PrivateState%CLOCK, currTime=myTime, _RC) if (myTime > EndTime) then - call ESMF_ClockSet(PrivateState%Clock,direction=ESMF_DIRECTION_REVERSE,rc=status) - VERIFY_(status) + call ESMF_ClockSet(PrivateState%Clock,direction=ESMF_DIRECTION_REVERSE, _RC) do - call ESMF_ClockAdvance(PrivateState%Clock,rc=status) - VERIFY_(status) - call ESMF_ClockGet(PrivateState%Clock,currTime=ct,rc=status) - VERIFY_(status) + call ESMF_ClockAdvance(PrivateState%Clock, _RC) + call ESMF_ClockGet(PrivateState%Clock,currTime=ct, _RC) if (ct==endTime) exit enddo - call ESMF_ClockSet(PrivateState%Clock,direction=ESMF_DIRECTION_FORWARD,rc=status) - VERIFY_(status) - call ESMF_ClockGet( PrivateState%CLOCK, currTime=myTime, RC=STATUS) - VERIFY_(status) + call ESMF_ClockSet(PrivateState%Clock, direction=ESMF_DIRECTION_FORWARD, _RC) + call ESMF_ClockGet(PrivateState%CLOCK, currTime=myTime, _RC) end if if( MyTime <= EndTime ) then ! Time to run @@ -1044,113 +566,111 @@ subroutine Run ( gc, import, export, clock, rc ) if(DO_DATASEA==0) then select case(trim(OCEAN_NAME)) case ("MOM") - call MAPL_GetPointer(GEX(OCN), MASK3D, 'MOM_3D_MASK', __RC__) + call MAPL_GetPointer(GEX(OCN), MASK3D, 'MOM_3D_MASK', _RC) MASK => MASK3D(:,:,1) case ("MOM6") - call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', __RC__) + call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', _RC) end select else - allocate(MASK3D(IM,JM,LM), STAT=STATUS); VERIFY_(STATUS) + allocate(MASK3D(IM,JM,LM), __STAT__) MASK3D=1.0 - allocate(MASK(IM,JM), STAT=STATUS); VERIFY_(STATUS) + allocate(MASK(IM,JM), __STAT__) MASK=1.0 end if ! Get ocean time step and misc. parameters !----------------------------------------- - call MAPL_GetResource(STATE,DT, Label="RUN_DT:", RC=STATUS) ! Get AGCM Heartbeat - VERIFY_(status) - call MAPL_GetResource(STATE,DT, Label="OCEAN_DT:", DEFAULT=DT, RC=STATUS) ! set Default OCEAN_DT to AGCM Heartbeat - VERIFY_(status) + call MAPL_GetResource(STATE,DT, Label="RUN_DT:", _RC) ! Get AGCM Heartbeat + call MAPL_GetResource(STATE,DT, Label="OCEAN_DT:", DEFAULT=DT, _RC) ! set Default OCEAN_DT to AGCM Heartbeat ! Get pointers to imports !-------------------------------------------------------------------------------- - call MAPL_GetPointer(IMPORT, FROCEAN, 'FROCEAN', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, TAUXi, 'TAUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, TAUYi, 'TAUY' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, PENUVRi, 'PENUVR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, PENPARi, 'PENPAR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, PENUVFi, 'PENUVF' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, PENPAFi, 'PENPAF' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, DRNIRi, 'DRNIR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, DFNIRi, 'DFNIR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, HEATi, 'SWHEAT' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, DISCHARGEi, 'DISCHARGE' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, LWFLXi, 'LWFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, SHFLXi, 'SHFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, QFLUXi, 'QFLUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, SNOWi, 'SNOW' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, RAINi, 'RAIN' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, FHOCN, 'FHOCN' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, FRESH, 'FRESH' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, FSALT, 'FSALT' , RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(IMPORT, FROCEAN, 'FROCEAN', _RC) + call MAPL_GetPointer(IMPORT, TAUXi, 'TAUX' , _RC) + call MAPL_GetPointer(IMPORT, TAUYi, 'TAUY' , _RC) + call MAPL_GetPointer(IMPORT, PENUVRi, 'PENUVR' , _RC) + call MAPL_GetPointer(IMPORT, PENPARi, 'PENPAR' , _RC) + call MAPL_GetPointer(IMPORT, PENUVFi, 'PENUVF' , _RC) + call MAPL_GetPointer(IMPORT, PENPAFi, 'PENPAF' , _RC) + call MAPL_GetPointer(IMPORT, DRNIRi, 'DRNIR' , _RC) + call MAPL_GetPointer(IMPORT, DFNIRi, 'DFNIR' , _RC) + call MAPL_GetPointer(IMPORT, HEATi, 'SWHEAT', _RC) + call MAPL_GetPointer(IMPORT, DISCHARGEi, 'DISCHARGE', _RC) + call MAPL_GetPointer(IMPORT, LWFLXi, 'LWFLX' , _RC) + call MAPL_GetPointer(IMPORT, SHFLXi, 'SHFLX' , _RC) + call MAPL_GetPointer(IMPORT, QFLUXi, 'QFLUX' , _RC) + call MAPL_GetPointer(IMPORT, SNOWi, 'SNOW' , _RC) + call MAPL_GetPointer(IMPORT, RAINi, 'RAIN' , _RC) + call MAPL_GetPointer(IMPORT, FHOCN, 'FHOCN' , _RC) + call MAPL_GetPointer(IMPORT, FRESH, 'FRESH' , _RC) + call MAPL_GetPointer(IMPORT, FSALT, 'FSALT' , _RC) ! Get pointers from ImExState !---------------------------- if(DO_DATASEA==0) then - call MAPL_GetPointer(GIM(OCN), TAUX, 'TAUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), TAUY, 'TAUY' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), PENUVR, 'PENUVR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), PENPAR, 'PENPAR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), PENUVF, 'PENUVF' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), PENPAF, 'PENPAF' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), DRNIR, 'DRNIR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), DFNIR, 'DFNIR' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), HEAT, 'SWHEAT', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), DISCHARGE, 'DISCHARGE' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), LWFLX, 'LWFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), SHFLX, 'SHFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), QFLUX, 'QFLUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), RAIN, 'RAIN' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), SNOW, 'SNOW' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCN), SFLX, 'SFLX' , RC=STATUS); VERIFY_(STATUS) ! and do not add import of PEN_OCN here since it is not used in the `plug' + call MAPL_GetPointer(GIM(OCN), TAUX, 'TAUX' , _RC) + call MAPL_GetPointer(GIM(OCN), TAUY, 'TAUY' , _RC) + call MAPL_GetPointer(GIM(OCN), PENUVR, 'PENUVR' , _RC) + call MAPL_GetPointer(GIM(OCN), PENPAR, 'PENPAR' , _RC) + call MAPL_GetPointer(GIM(OCN), PENUVF, 'PENUVF' , _RC) + call MAPL_GetPointer(GIM(OCN), PENPAF, 'PENPAF' , _RC) + call MAPL_GetPointer(GIM(OCN), DRNIR, 'DRNIR' , _RC) + call MAPL_GetPointer(GIM(OCN), DFNIR, 'DFNIR' , _RC) + call MAPL_GetPointer(GIM(OCN), HEAT, 'SWHEAT', _RC) + call MAPL_GetPointer(GIM(OCN), DISCHARGE, 'DISCHARGE', _RC) + call MAPL_GetPointer(GIM(OCN), LWFLX, 'LWFLX' , _RC) + call MAPL_GetPointer(GIM(OCN), SHFLX, 'SHFLX' , _RC) + call MAPL_GetPointer(GIM(OCN), QFLUX, 'QFLUX' , _RC) + call MAPL_GetPointer(GIM(OCN), RAIN, 'RAIN' , _RC) + call MAPL_GetPointer(GIM(OCN), SNOW, 'SNOW' , _RC) + call MAPL_GetPointer(GIM(OCN), SFLX, 'SFLX' , _RC) ! and do not add import of PEN_OCN here since it is not used in the `plug' end if - call MAPL_GetPointer(IMPORT, PEN_OCN, 'PEN_OCN',RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(IMPORT, PEN_OCN, 'PEN_OCN', _RC) - call MAPL_GetPointer(GEX(OCN), TW, 'TW' , alloc=.true., RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(GEX(OCN), SW, 'SW' , alloc=.true., RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(GEX(OCN), TW, 'TW' , alloc=.true., _RC) + call MAPL_GetPointer(GEX(OCN), SW, 'SW' , alloc=.true., _RC) if (dual_ocean) then - call MAPL_GetPointer(GEX(OCNd), TWd, 'TW' , alloc=.true., RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(IMPORT, FId, 'FRACICEd' , RC=STATUS); VERIFY_(STATUS) - end if + call MAPL_GetPointer(GEX(OCNd), TWd, 'TW' , alloc=.true., _RC) + call MAPL_GetPointer(IMPORT, FId, 'FRACICEd' , _RC) + endif if(DO_DATASEA==0) then - call MAPL_GetPointer(GEX(OCN), FRZMLT, 'FRZMLT' , alloc=.true., RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(GEX(OCN), FRZMLT, 'FRZMLT', alloc=.true., _RC) end if ! Get pointers to exports !-------------------------------------------------------- - call MAPL_GetPointer(EXPORT, TS_FOUND,'TS_FOUND', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SS_FOUND,'SS_FOUND', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, FRZMLTe,'FRZMLT', RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(EXPORT, TS_FOUND,'TS_FOUND', _RC) + call MAPL_GetPointer(EXPORT, SS_FOUND,'SS_FOUND', _RC) + call MAPL_GetPointer(EXPORT, FRZMLTe, 'FRZMLT', _RC) ! Diagnostics exports !--------------------------------------------------------- - call MAPL_GetPointer(EXPORT, RFLUX, 'RFLUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, FROCEANe,'FROCEAN', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, TAUXe, 'TAUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, TAUYe, 'TAUY' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, HEATe, 'SWHEAT' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, DISCHARGEe, 'DISCHARGE' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, LWFLXe, 'LWFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SWFLXe, 'SWFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SHFLXe, 'SHFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, QFLUXe, 'QFLUX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, RAINe, 'RAIN' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SNOWe, 'SNOW' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SFLXe, 'SFLX' , RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, PEN_OCNe,'PEN_OCN', RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(EXPORT, RFLUX, 'RFLUX' , _RC) + call MAPL_GetPointer(EXPORT, FROCEANe, 'FROCEAN', _RC) + call MAPL_GetPointer(EXPORT, TAUXe, 'TAUX' , _RC) + call MAPL_GetPointer(EXPORT, TAUYe, 'TAUY' , _RC) + call MAPL_GetPointer(EXPORT, HEATe, 'SWHEAT' , _RC) + call MAPL_GetPointer(EXPORT, DISCHARGEe, 'DISCHARGE', _RC) + call MAPL_GetPointer(EXPORT, LWFLXe, 'LWFLX' , _RC) + call MAPL_GetPointer(EXPORT, SWFLXe, 'SWFLX' , _RC) + call MAPL_GetPointer(EXPORT, SHFLXe, 'SHFLX' , _RC) + call MAPL_GetPointer(EXPORT, QFLUXe, 'QFLUX' , _RC) + call MAPL_GetPointer(EXPORT, RAINe, 'RAIN' , _RC) + call MAPL_GetPointer(EXPORT, SNOWe, 'SNOW' , _RC) + call MAPL_GetPointer(EXPORT, SFLXe, 'SFLX' , _RC) + call MAPL_GetPointer(EXPORT, PEN_OCNe, 'PEN_OCN', _RC) if(associated(FROCEANe)) FROCEANe = FROCEAN ! Allocate space for temporary arrays !------------------------------------ - allocate(WGHT(IM,JM), STAT=STATUS); VERIFY_(STATUS) + allocate(WGHT(IM,JM), __STAT__) ! Weight for ocean grid !---------------------- @@ -1164,26 +684,25 @@ subroutine Run ( gc, import, export, clock, rc ) if(DO_DATASEA==0) then ! Copy imports into ImEx variables !--------------------------------- - PENUVR = PENUVRi * WGHT - PENPAR = PENPARi * WGHT - PENUVF = PENUVFi * WGHT - PENPAF = PENPAFi * WGHT - DRNIR = DRNIRi * WGHT - DFNIR = DFNIRi * WGHT + PENUVR = PENUVRi * WGHT + PENPAR = PENPARi * WGHT + PENUVF = PENUVFi * WGHT + PENPAF = PENPAFi * WGHT + DRNIR = DRNIRi * WGHT + DFNIR = DFNIRi * WGHT DISCHARGE = DISCHARGEi * WGHT - LWFLX = LWFLXi * WGHT - QFLUX = QFLUXi * WGHT - SHFLX = (SHFLXi- FHOCN) * WGHT - RAIN = (RAINi+FRESH) * WGHT - SNOW = SNOWi * WGHT - SFLX = FSALT * WGHT + LWFLX = LWFLXi * WGHT + QFLUX = QFLUXi * WGHT + SHFLX = (SHFLXi-FHOCN) * WGHT + RAIN = (RAINi+FRESH) * WGHT + SNOW = SNOWi * WGHT + SFLX = FSALT * WGHT ! This stress forces the ocean, combined with sea ice bottom stress later !------------------------------------------------------------------------ TAUX = TAUXi * WGHT TAUY = TAUYi * WGHT - ! Prepare radiative heating for ocean !------------------------------------ @@ -1227,52 +746,42 @@ subroutine Run ( gc, import, export, clock, rc ) call MAPL_TimerOn (STATE,"--ModRun") if (.not. DUAL_OCEAN) then - call MAPL_GenericRunChildren(GC, IMPORT, EXPORT, PrivateState%CLOCK, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GenericRunChildren(GC, IMPORT, EXPORT, PrivateState%CLOCK, _RC) else if (PHASE == 1) then ! corrector call ESMF_GridCompRun( GCS(OCNd), importState=GIM(OCNd), & - exportState=GEX(OCNd), clock=CLOCK, phase=1, userRC=STATUS) - VERIFY_(STATUS) - call MAPL_GenericRunCouplers( STATE, CHILD=OCNd, CLOCK=CLOCK, RC=STATUS ) + exportState=GEX(OCNd), clock=CLOCK, phase=1, userRC=STATUS) VERIFY_(STATUS) + call MAPL_GenericRunCouplers( STATE, CHILD=OCNd, CLOCK=CLOCK, _RC ) call ESMF_GridCompRun( GCS(OCN), importState=GIM(OCN), & exportState=GEX(OCN), clock=CLOCK, phase=1, userRC=STATUS) VERIFY_(STATUS) - call MAPL_GenericRunCouplers( STATE, CHILD=OCN, CLOCK=CLOCK, RC=STATUS ) + call MAPL_GenericRunCouplers( STATE, CHILD=OCN, CLOCK=CLOCK, _RC ) VERIFY_(STATUS) else ! predictor call ESMF_GridCompRun( GCS(OCNd), importState=GIM(OCNd), & exportState=GEX(OCNd), clock=CLOCK, phase=1, userRC=STATUS) VERIFY_(STATUS) - call MAPL_GenericRunCouplers( STATE, CHILD=OCNd, CLOCK=CLOCK, RC=STATUS ) - VERIFY_(STATUS) + call MAPL_GenericRunCouplers( STATE, CHILD=OCNd, CLOCK=CLOCK, _RC ) end if end if if (DUAL_OCEAN .and. PHASE == 1) then ! calculate temperature correction to send back to MOM - call MAPL_GetPointer(GIM(OCN), DEL_TEMP, 'DEL_TEMP', RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(GIM(OCNd), FI , 'FRACICE' , RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetPointer(GIM(OCN), DEL_TEMP, 'DEL_TEMP', _RC) + call MAPL_GetPointer(GIM(OCNd), FI , 'FRACICE' , _RC) - call MAPL_GetResource(STATE,TAU_SST, Label="TAU_SST:", default=432000.0 ,RC=STATUS) - VERIFY_(status) - - call MAPL_GetResource(STATE,TAU_SST_UNDER_ICE, Label="TAU_SST_UNDER_ICE:", default=86400.0 ,RC=STATUS) - VERIFY_(status) + call MAPL_GetResource(STATE,TAU_SST, Label="TAU_SST:", default=432000.0, _RC) + call MAPL_GetResource(STATE,TAU_SST_UNDER_ICE, Label="TAU_SST_UNDER_ICE:", default=86400.0 , _RC) ! we should have valid pointers to TW and TWd by now DEL_TEMP = 0.0 ! we do not want uninitiazed variables where(MASK > 0.0 .and. FI < 0.05) - ! what about relaxation DEL_TEMP = (TWd - TW)*DT/(DT+TAU_SST) - end where where(MASK > 0.0 .and. FI >= 0.05 .and. FId > FI) @@ -1295,13 +804,10 @@ subroutine Run ( gc, import, export, clock, rc ) ! Bump the time in the internal state !------------------------------------ - call ESMF_ClockAdvance( PrivateState%clock, rc=status) - VERIFY_(status) - call ESMF_ClockGet ( PrivateState%clock, currTime= myTime , rc=status) - VERIFY_(status) + call ESMF_ClockAdvance( PrivateState%clock, _RC) + call ESMF_ClockGet ( PrivateState%clock, currTime= myTime , _RC) NUM = NUM + 1 - end do if(associated(SS_FOUND)) then @@ -1323,8 +829,7 @@ subroutine Run ( gc, import, export, clock, rc ) if (DUAL_OCEAN) then !ALT we might not have FI yet, so let get it again - call MAPL_GetPointer(GIM(OCNd), FI , 'FRACICE' , RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetPointer(GIM(OCNd), FI , 'FRACICE' , _RC) where(WGHT > 0.0) where(FI < 0.05) TS_FOUND = TWd @@ -1345,18 +850,19 @@ subroutine Run ( gc, import, export, clock, rc ) where(wght>0.0) TS_FOUND=TS_FOUND+ & - DT*(LWFLXi+(PENUVR+PENPAR+PENUVF+PENPAF+DRNIR+DFNIR - PEN_OCN)-SHFLXi-QFLUXi*MAPL_ALHL-MAPL_ALHF*SNOWi+FHOCN)/(OrphanDepth*MAPL_RHO_SEAWATER*MAPL_CAPWTR) ! explicit update in time + DT*(LWFLXi+(PENUVR+PENPAR+PENUVF+PENPAF+DRNIR+DFNIR -& + PEN_OCN)-SHFLXi-QFLUXi*MAPL_ALHL-MAPL_ALHF*SNOWi+& + FHOCN)/(OrphanDepth*MAPL_RHO_SEAWATER*MAPL_CAPWTR) ! explicit update in time FRZMLTe = (Tfreeze - TS_FOUND) * (MAPL_RHO_SEAWATER*MAPL_CAPWTR*OrphanDepth)/DT TS_FOUND=max(TS_FOUND, Tfreeze) end where - end if - deallocate(WGHT, STAT=STATUS); VERIFY_(STATUS) + deallocate(WGHT, __STAT__) if(DO_DATASEA/=0) then - deallocate(MASK3D, STAT=STATUS); VERIFY_(STATUS) - deallocate(MASK, STAT=STATUS); VERIFY_(STATUS) + deallocate(MASK3D, __STAT__) + deallocate(MASK, __STAT__) end if end if ! Time to run diff --git a/GEOS_Ocean_StateSpecs.rc b/GEOS_Ocean_StateSpecs.rc new file mode 100644 index 0000000..625ec29 --- /dev/null +++ b/GEOS_Ocean_StateSpecs.rc @@ -0,0 +1,64 @@ +schema_version: 2.0.0 +component: Ocean + +category: IMPORT +#--------------------------------------------------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#--------------------------------------------------------------------------------------------------------------------- +NAME | UNITS | DIMS | VLOC | COND | DATATYPE | LONG_NAME +#--------------------------------------------------------------------------------------------------------------------- +FROCEAN | 1 | xy | N | | | fraction_of_gridbox_covered_by_ocean +TAUX | N m-2 | xy | N | | | Agrid_eastward_stress_on_ocean +TAUY | N m-2 | xy | N | | | Agrid_northward_stress_on_ocean +PENUVR | W m-2 | xy | N | | | net_downward_penetrating_direct_UV_flux +PENPAR | W m-2 | xy | N | | | net_downward_penetrating_direct_PAR_flux +PENUVF | W m-2 | xy | N | | | net_downward_penetrating_diffuse_UV_flux +PENPAF | W m-2 | xy | N | | | net_downward_penetrating_diffuse_PAR_flux +DRNIR | W m-2 | xy | N | | | net_surface_downwelling_nir_beam_flux +DFNIR | W m-2 | xy | N | | | net_surface_downwelling_nir_diffuse_flux +SWHEAT | W m-2 | xyz | C | | | solar_heating_rate +DISCHARGE | kg m-2 s-1 | xy | N | | | river_discharge_at_ocean_points +TR | 1 | xyz | C | trim(OCEAN_NAME) == 'MOM' | MAPL_BundleItem | tracer_mixing_ratios +TRFLUX | X | xy | N | trim(OCEAN_NAME) == 'MOM' | MAPL_BundleItem | surface_fluxes_of_tracers +LWFLX | W m-2 | xy | N | | | surface_net_downward_longwave_flux +SHFLX | W m-2 | xy | N | | | upward_sensible_heat_flux +QFLUX | kg m-2 s-1 | xy | N | | | evaporation +SNOW | kg m-2 s-1 | xy | N | | | ocean_snowfall +RAIN | kg m-2 s-1 | xy | N | | | ocean_rainfall +FRESH | kg m-2 s-1 | xy | N | | | fresh_water_flux_due_to_ice_dynamics +FSALT | kg m-2 s-1 | xy | N | | | salt_flux_due_to_ice_dynamics +FHOCN | W m-2 | xy | N | | | heat_flux_due_to_ice_dynamics +PEN_OCN | W m-2 | xy | N | | | penetrated_shortwave_flux_at_the_bottom_of_first_ocean_model_layer +FRACICEd | 1 | xy | N | dual_ocean | | fractional_cover_of_seaice + +category: INTERNAL +#--------------------------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#--------------------------------------------------------------------------------------------- +NAME | UNITS | DIMS | VLOC | FRIENDLYTO | DEFAULT | LONG_NAME +#--------------------------------------------------------------------------------------------- +TS_FOUND | K | xy | N | trim(COMP_NAME) | 280.0 | foundation_temperature_for_interface_layer + +category: EXPORT +#--------------------------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#--------------------------------------------------------------------------------------------- +NAME | UNITS | DIMS | VLOC | LONG_NAME +#--------------------------------------------------------------------------------------------- +#MASKO | 1 | xy | N | ocean_mask +SS_FOUND | PSU | xy | N | foundation_salinity_for_interface_layer +FRZMLT | W m-2 | xy | N | freeze_melt_potential +TAUX | N m-2 | xy | N | Agrid_eastward_stress_on_ocean +TAUY | N m-2 | xy | N | Agrid_northward_stress_on_ocean +SWHEAT | W m-2 | xyz | C | solar_heating_rate +RFLUX | W m-2 | xy | N | downward_radiative_heat_flux_at_ocean_bottom +DISCHARGE | kg m-2 s-1 | xy | N | river_discharge_at_ocean_points +FROCEAN | 1 | xy | N | fraction_of_gridbox_covered_by_ocean +LWFLX | W m-2 | xy | N | surface_net_downward_longwave_flux +SWFLX | W m-2 | xy | N | surface_net_downward_shortwave_flux +SHFLX | W m-2 | xy | N | upward_sensible_heat_flux +QFLUX | kg m-2 s-1 | xy | N | evaporation +SFLX | kg m-2 s-1 | xy | N | salt_flux_due_to_ice_dynamics +RAIN | kg m-2 s-1 | xy | N | ocean_rainfall +SNOW | kg m-2 s-1 | xy | N | ocean_snowfall +PEN_OCN | W m-2 | xy | N | penetrated_shortwave_flux_at_the_bottom_of_first_ocean_model_layer diff --git a/GEOSdatasea_GridComp/CMakeLists.txt b/GEOSdatasea_GridComp/CMakeLists.txt index 279a006..49424ed 100644 --- a/GEOSdatasea_GridComp/CMakeLists.txt +++ b/GEOSdatasea_GridComp/CMakeLists.txt @@ -1,3 +1,7 @@ esma_set_this () esma_add_library (${this} SRCS GEOS_DataSeaGridComp.F90 DEPENDENCIES MAPL esmf NetCDF::NetCDF_Fortran) + +mapl_acg (${this} GEOS_DataSea_StateSpecs.rc + IMPORT_SPECS EXPORT_SPECS INTERNAL_SPECS + GET_POINTERS DECLARE_POINTERS) diff --git a/GEOSdatasea_GridComp/GEOS_DataSeaGridComp.F90 b/GEOSdatasea_GridComp/GEOS_DataSeaGridComp.F90 index 0962105..9d19913 100644 --- a/GEOSdatasea_GridComp/GEOS_DataSeaGridComp.F90 +++ b/GEOSdatasea_GridComp/GEOS_DataSeaGridComp.F90 @@ -1,5 +1,3 @@ -! $Id$ - #include "MAPL_Generic.h" !============================================================================= @@ -68,40 +66,34 @@ subroutine SetServices ( GC, RC ) ! ! ErrLog Variables - - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Local derived type aliases - type (MAPL_MetaComp ), pointer :: MAPL => null() !============================================================================= + __Iam__('SetServices') + +!**************************************************************************** ! Begin... ! Get my name and set-up traceback handle ! --------------------------------------- - Iam = "SetServices" - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // Iam + Iam = trim(comp_name)//'::'//'SetServices' -! Set the Run entry point -! ----------------------- +! Set the Initialize, Run, Finalize entry points +! ---------------------------------------------- - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GridCompSetEntryPoint (GC, ESMF_Method_Run, Run, _RC) - call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) - call MAPL_GetResource (MAPL, ocean_extData, Label="OCEAN_EXT_DATA:", DEFAULT=.FALSE., __RC__ ) ! .TRUE. or .FALSE. + call MAPL_GetResource (MAPL, ocean_extData, Label="OCEAN_EXT_DATA:", DEFAULT=.FALSE., _RC ) ! .TRUE. or .FALSE. ! This new SSS data feature will be ExtData based ONLY; No SSS data would set sss=30, as it was done with binary SST data - call MAPL_GetResource (MAPL, ocean_sssData, Label="OCEAN_SSS_DATA:", DEFAULT=.FALSE., __RC__ ) ! .TRUE. or .FALSE. + call MAPL_GetResource (MAPL, ocean_sssData, Label="OCEAN_SSS_DATA:", DEFAULT=.FALSE., _RC ) ! .TRUE. or .FALSE. ! Set the state variable specs. ! ----------------------------- @@ -109,87 +101,20 @@ subroutine SetServices ( GC, RC ) !BOS ! !Import state: -! None. Its only job is to simply export: SST, SSS, US, VS +#include "GEOS_DataSea_Import___.h" ! !Export state: - - if (ocean_extData) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'DATA_SST', & - LONG_NAME = 'sea_surface_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, RC=STATUS) - endif - - if (ocean_sssData) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'DATA_SSS', & - LONG_NAME = 'sea_surface_salinity', & - UNITS = 'PSU', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, RC=STATUS) - endif - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UW', & - LONG_NAME = 'zonal_velocity_of_surface_water', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VW', & - LONG_NAME = 'meridional_velocity_of_surface_water',& - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TW', & - LONG_NAME = 'foundation_temperature_for_interface_layer',& - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SW', & - LONG_NAME = 'foundation_salinity_for_interface_layer',& - UNITS = 'PSU', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - -! import - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'FRACICE', & - LONG_NAME = 'fractional_cover_of_seaice', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) +#include "GEOS_DataSea_Export___.h" !EOS - call MAPL_TimerAdd(GC, name="RUN" ,RC=STATUS) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="-UPDATE" ,RC=STATUS) - VERIFY_(STATUS) + call MAPL_TimerAdd(GC, name="RUN" ,_RC) + call MAPL_TimerAdd(GC, name="-UPDATE" ,_RC) ! Set generic init and final methods ! ---------------------------------- - call MAPL_GenericSetServices ( GC, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GenericSetServices ( GC, _RC) RETURN_(ESMF_SUCCESS) @@ -221,8 +146,6 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals @@ -245,36 +168,24 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) real, pointer, dimension(:,:) :: TNEW => null() real, pointer, dimension(:,:) :: F1 => null() -! pointers to export - - real, pointer, dimension(:,:) :: UW - real, pointer, dimension(:,:) :: VW - real, pointer, dimension(:,:) :: TW - real, pointer, dimension(:,:) :: SW - -! pointers to import +! Pointers to imports and exports +#include "GEOS_DataSea_DeclarePointer___.h" - real, pointer, dimension(:,:) :: FI - - real, pointer, dimension(:,:) :: data_sst => null() - real, pointer, dimension(:,:) :: data_sss => null() + __Iam__('Run') +!**************************************************************************** ! Begin... -!---------- ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- - Iam = "Run" - call ESMF_GridCompGet( GC, name=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // Iam + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//Iam ! Get my internal MAPL_Generic state !---------------------------------- - call MAPL_GetObjectFromGC(GC, MAPL, STATUS) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC(GC, MAPL, _RC) ! Start Total timer !------------------ @@ -282,28 +193,14 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) call MAPL_TimerOn(MAPL,"TOTAL") call MAPL_TimerOn(MAPL,"RUN" ) -! Pointers to Imports -!-------------------- - call MAPL_GetPointer(IMPORT, FI , 'FRACICE' , RC=STATUS) - VERIFY_(STATUS) - -! Pointers to Exports -!--------------------- - - call MAPL_GetPointer(EXPORT, UW , 'UW' , RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, VW , 'VW' , RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, TW , 'TW' , RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SW , 'SW' , RC=STATUS) - VERIFY_(STATUS) +! Get pointers to imports and exports +!------------------------------------ +#include "GEOS_DataSea_GetPointer___.h" ! Set current time and calendar !------------------------------ - call ESMF_ClockGet(CLOCK, currTime=CurrentTime, RC=STATUS) - VERIFY_(STATUS) + call ESMF_ClockGet(CLOCK, currTime=CurrentTime, _RC) if (.not. ocean_extData) then ! Get the SST bcs file name from the resource file @@ -315,28 +212,23 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! In atmospheric forecast mode we do not have future SST and SSS !-------------------------------------------------------------- - call MAPL_GetResource(MAPL,IFCST,LABEL="IS_FCST:",default=0, RC=STATUS) - VERIFY_(STATUS) - - call MAPL_GetResource(MAPL,adjSST,LABEL="SST_ADJ_UND_ICE:",default=0, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetResource(MAPL,IFCST, LABEL="IS_FCST:", default=0, _RC) + call MAPL_GetResource(MAPL,adjSST,LABEL="SST_ADJ_UND_ICE:",default=0, _RC) FCST = IFCST==1 - call MAPL_Get(MAPL, IM=IM, JM=JM, RC=STATUS) - VERIFY_(STATUS) + call MAPL_Get(MAPL, IM=IM, JM=JM, _RC) ! SST is usually Reynolds/OSTIA SST or bulk SST !------------------------------------------------ - allocate(SST(IM,JM), stat=STATUS) - VERIFY_(STATUS) + allocate(SST(IM,JM), __STAT__) ! SSS is usually bulk SSS !------------------------- if (ocean_sssData) then - allocate(SSS(IM, JM), stat=STATUS); VERIFY_(STATUS) + allocate(SSS(IM, JM), __STAT__) endif ! Update data @@ -348,16 +240,14 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) !------------------------------ if (ocean_extData) then - call MAPL_GetPointer(import, data_sst, 'DATA_SST', __RC__) sst = data_sst ! netcdf variable if (ocean_sssData) then ! and bulk SSS (from retrieval) - call MAPL_GetPointer(import, data_sss, 'DATA_SSS', __RC__) SSS = data_sss ! netcdf variable endif else ! binary - call MAPL_ReadForcing(MAPL,'SST',DATASeaFILE, CURRENTTIME, sst, INIT_ONLY=FCST, __RC__) + call MAPL_ReadForcing(MAPL,'SST',DATASeaFILE, CURRENTTIME, sst, INIT_ONLY=FCST, _RC) endif call MAPL_TimerOff(MAPL,"-UPDATE" ) @@ -372,23 +262,17 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) if (adjSST == 1) then SST = max(SST, TICE) - SST = (1.-FI)*SST+FI*TICE + SST = (1.-FRACICE)*SST+FRACICE*TICE endif if (adjSST == 2) then - call MAPL_GetResource(MAPL,CTB , LABEL="CTB:" , default=1.0e-4, RC=STATUS) - VERIFY_(STATUS) - - call MAPL_GetResource(MAPL,RUN_DT , LABEL="RUN_DT:" , RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetResource(MAPL,DT , LABEL="DT:" , default=RUN_DT, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetResource(MAPL,CTB , LABEL="CTB:" , default=1.0e-4, _RC) + call MAPL_GetResource(MAPL,RUN_DT , LABEL="RUN_DT:", _RC) + call MAPL_GetResource(MAPL,DT , LABEL="DT:" , default=RUN_DT, _RC) - allocate(TNEW(size(TW,1),size(TW,2)), stat=STATUS) - VERIFY_(STATUS) - allocate(F1 (size(TW,1),size(TW,2)), stat=STATUS) - VERIFY_(STATUS) + allocate(TNEW(size(TW,1),size(TW,2)), __STAT__) + allocate(F1 (size(TW,1),size(TW,2)), __STAT__) TNEW=0.0 F1 =0.0 @@ -396,18 +280,18 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ! SST below freezing point is set to freezing temperature TNEW = max( SST,TICE) - where(FI == 1.0) + where(FRACICE == 1.0) ! ! if fraction of ice is 1, set SST to freezing temperature TNEW = TICE elsewhere - F1=FI*CTB/(2.0*(1.0-FI)) + F1=FRACICE*CTB/(2.0*(1.0-FRACICE)) TNEW=(TNEW+TICE*F1*DT)/(1.0+F1*DT) end where SST = TNEW - deallocate( TNEW) - deallocate( F1) + deallocate( TNEW, __STAT__) + deallocate( F1, __STAT__) endif if(associated(TW)) then @@ -425,9 +309,9 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Clean-up !--------- - deallocate(SST, STAT=STATUS); VERIFY_(STATUS) + deallocate(SST, __STAT__) if (ocean_sssData) then - deallocate(SSS, STAT=STATUS); VERIFY_(STATUS) + deallocate(SSS, __STAT__) endif ! All done diff --git a/GEOSdatasea_GridComp/GEOS_DataSea_StateSpecs.rc b/GEOSdatasea_GridComp/GEOS_DataSea_StateSpecs.rc new file mode 100644 index 0000000..5c0710c --- /dev/null +++ b/GEOSdatasea_GridComp/GEOS_DataSea_StateSpecs.rc @@ -0,0 +1,62 @@ +schema_version: 2.0.0 +component: DataSea + +category: IMPORT +#---------------------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#---------------------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | COND | LONG NAME +#---------------------------------------------------------------------------------------- + FRACICE | 1 | xy | N | | fractional_cover_of_seaice + DATA_SST | K | xy | N | ocean_extData | sea_surface_temperature + DATA_SSS | PSU | xy | N | ocean_sssData | sea_surface_salinity + +category: EXPORT +#---------------------------------------------------------------------------------------- +# VARIABLE | DIMENSIONS | Additional Metadata +#---------------------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | LONG NAME +#---------------------------------------------------------------------------------------- + UW | m s-1 | xy | N | zonal_velocity_of_surface_water + VW | m s-1 | xy | N | meridional_velocity_of_surface_water + TW | K | xy | N | foundation_temperature_for_interface_layer + SW | PSU | xy | N | foundation_salinity_for_interface_layer + +category: INTERNAL +#---------------------------------------------------------------------------------------- +# VARIABLE | DIMENSION | Additional Metadata +#---------------------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | UNGRIDDED | RESTART | ADD2EXPORT | FRIENDLYTO | LONG NAME +#---------------------------------------------------------------------------------------- + + + +#******************************************************** +# +# Legend +# +#------------------------------------------------------------------ +# Column label | MAPL keyword/interpretation | Default +#--------------|--------------------------------------------------- +# NAME | short_name | +# UNITS | units | +# DIMS | dims | +# VLOC | VLocation | MAPL_VLocationNone +# LONG NAME | long_name | +# COND | if () then | .FALSE. +# NUM_SUBTILES | num_subtiles +# ... +#------------------------------------------------------------------ +# +#-------------------------------------------- +# Entry alias | Column | MAPL keyword/interpretation +#--------------|----------------------------- +# xyz | DIMS | MAPL_HorzVert +# xy | DIMS | MAPL_HorzOnly +# z | DIMS | MAPL_VertOnly (plus ungridded) +# C | VLOC | MAPL_VlocationCenter +# E | VLOC | MAPL_VlocationEdge +# N | VLOC | MAPL_VlocationNone +#-------------------------------------------- + + diff --git a/MOM6_GEOSPlug/CMakeLists.txt b/MOM6_GEOSPlug/CMakeLists.txt index 50827a9..a1e27af 100644 --- a/MOM6_GEOSPlug/CMakeLists.txt +++ b/MOM6_GEOSPlug/CMakeLists.txt @@ -25,3 +25,7 @@ install( DESTINATION etc/MOM6 USE_SOURCE_PERMISSIONS ) + +mapl_acg (${this} MOM6_GEOSPlug_StateSpecs.rc + IMPORT_SPECS EXPORT_SPECS INTERNAL_SPECS + GET_POINTERS DECLARE_POINTERS) diff --git a/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 b/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 index 554bf56..05ca1d5 100644 --- a/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 +++ b/MOM6_GEOSPlug/MOM6_GEOSPlug.F90 @@ -1,11 +1,8 @@ -! $Id$ - #include "MAPL_Generic.h" -! GEOS default real kind - -#define G5KIND 4 -#define REAL_ real(kind=G5KIND) +! GEOS default real kind +#define GeosKind 4 +#define REAL_ real(kind=GeosKind) module MOM6_GEOSPlugMod @@ -111,447 +108,54 @@ subroutine SetServices ( GC, RC ) ! respective SetServices. !EOP - !============================================================================= ! ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals - !============================================================================= + __Iam__('SetServices') + ! Begin... ! Get my name and set-up traceback handle ! --------------------------------------- - Iam = 'SetServices' - call ESMF_GridCompGet( GC, NAME=COMP_NAME, RC=STATUS ) - VERIFY_(STATUS) - Iam = trim(COMP_NAME) // Iam - -!BOS - -! !IMPORT STATE: - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUX', & - LONG_NAME = 'Agrid_eastward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUY', & - LONG_NAME = 'Agrid_northward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PS', & - LONG_NAME = 'Surface Atmospheric Pressure', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PICE', & - LONG_NAME = 'pressure due to ice weight', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SWHEAT', & - LONG_NAME = 'solar_heating_rate', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC , & - LONG_NAME = 'surface_net_downward_longwave_flux',& - UNITS = 'W m-2' , & - SHORT_NAME = 'LWFLX' , & - DIMS = MAPL_DimsHorzOnly , & - VLOCATION = MAPL_VLocationNone , & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'upward_sensible_heat_flux' ,& - UNITS = 'W m-2' ,& - SHORT_NAME = 'SHFLX' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'evaporation' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'QFLUX' , & - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'RAIN', & - LONG_NAME = 'ocean_rainfall', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SNOW', & - LONG_NAME = 'ocean_snowfall', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SFLX', & - LONG_NAME = 'salt_flux_from_sea_ice_to_ocean', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVR', & - LONG_NAME = 'net_downward_penetrating_direct_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAR', & - LONG_NAME = 'net_downward_penetrating_direct_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVF', & - LONG_NAME = 'net_downward_penetrating_diffuse_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAF', & - LONG_NAME = 'net_downward_penetrating_diffuse_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC , & - LONG_NAME = 'net_surface_downwelling_nir_beam_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DRNIR' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC , & - LONG_NAME = 'net_surface_downwelling_nir_diffuse_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DFNIR' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'river_discharge_at_ocean_points',& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'DISCHARGE' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'AICE', & - LONG_NAME = 'ice_concentration_of_grid_cell', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUXBOT', & - LONG_NAME = 'eastward_stress_at_base_of_ice_Agrid', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUYBOT', & - LONG_NAME = 'northward_stress_at_base_of_ice_Agrid', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - -! !EXPORT STATE: - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UW', & - LONG_NAME = 'surface_Agrid_eastward_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VW', & - LONG_NAME = 'surface_Agrid_northward_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UWB', & - LONG_NAME = 'surface_Bgrid_X_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VWB', & - LONG_NAME = 'surface_Bgrid_Y_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TW', & - LONG_NAME = 'surface_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SW', & - LONG_NAME = 'surface_salinity', & - UNITS = 'psu', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'MOM_2D_MASK', & - LONG_NAME = 'MOM_ocean_mask_at_t-points', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'MOM_ocean_area_at_t-points', & - UNITS = 'm+2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SLV', & - LONG_NAME = 'sea_level_with_ice_loading_and_invBaro', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'FRAZIL', & - LONG_NAME = 'heating_from_frazil_formation', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//'SetServices' - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'MELT_POT', & - LONG_NAME = 'heat_that_can_be_used_to_melt_sea_ice', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'FRZMLT', & - LONG_NAME = 'freeze_melt_potential', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DUM1', & - LONG_NAME = 'dummy_export1', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DUM2', & - LONG_NAME = 'dummy_export2', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - -! !Diagnostic exports -!Get rid of following 3D exports - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'U', & - LONG_NAME = 'eastward_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'V', & - LONG_NAME = 'northward_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DH', & - LONG_NAME = 'layer_thickness', & - UNITS = 'm OR kg m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) +! Set the Initialize, Run, Finalize entry points +! ---------------------------------------------- - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DEPTH', & - LONG_NAME = 'layer_depth', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_Method_Initialize, Initialize, _RC) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_Method_Run, Run, _RC) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_Method_Finalize, Finalize, _RC) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_Method_WriteRestart, Record, _RC) - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'T', & - LONG_NAME = 'potential_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) +!BOS - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'S', & - LONG_NAME = 'salinity', & - UNITS = 'psu', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) +! !Import state: +#include "MOM6_GEOSPlug_Import___.h" - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SWFRAC', & - LONG_NAME = 'shortwave_fractional_decay', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) +! !Export state: +#include "MOM6_GEOSPlug_Export___.h" !EOS -! Set the Initialize, Run, Finalize entry points -! ---------------------------------------------- - - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, RC=status) - VERIFY_(STATUS) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=status) - VERIFY_(STATUS) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize, RC=status) - VERIFY_(STATUS) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_WRITERESTART, Record, RC=status) - VERIFY_(STATUS) - ! Set the Profiling timers ! ------------------------ - call MAPL_TimerAdd(GC, name="INITIALIZE" ,RC=STATUS) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="RUN" ,RC=STATUS) - VERIFY_(STATUS) - call MAPL_TimerAdd(GC, name="FINALIZE" ,RC=STATUS) - VERIFY_(STATUS) + call MAPL_TimerAdd(GC, name="INITIALIZE" , _RC) + call MAPL_TimerAdd(GC, name="RUN" , _RC) + call MAPL_TimerAdd(GC, name="FINALIZE" , _RC) ! Generic SetServices ! ------------------- - call MAPL_GenericSetServices ( GC, RC=STATUS ) - VERIFY_(STATUS) - -! All done -! -------- + call MAPL_GenericSetServices ( GC, _RC ) RETURN_(ESMF_SUCCESS) @@ -577,14 +181,10 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) !EOP -! ErrLog Variables - - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME - ! Locals + character(len=ESMF_MAXSTR) :: COMP_NAME + integer :: counts(7) integer :: Comm integer :: isc,iec,jsc,jec @@ -621,32 +221,29 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) REAL_, pointer :: TW (:,:) => null() REAL_, pointer :: SW (:,:) => null() REAL_, pointer :: AREA(:,:) => null() - REAL_, pointer :: MASK(:,:) => null() + REAL_, pointer :: MOM_2D_MASK(:,:) => null() + REAL_, pointer :: SLV(:,:) => null() real, allocatable :: Tmp2(:,:) - REAL_, pointer, dimension(:, :) :: sea_lev => null() - integer :: DT_OCEAN character(len=7) :: wind_stagger ! 'AGRID' or 'BGRID' or 'CGRID' integer ::iwind_stagger ! AGRID or BGRID or CGRID : integer values + __Iam__('Initialize') + ! Begin... ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- - Iam = "Initialize" - call ESMF_GridCompGet( gc, NAME=comp_name, RC=status ) - VERIFY_(STATUS) - Iam = trim(comp_name) // trim(Iam) - + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//'Initialize' ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) ! Profilers !---------- @@ -657,46 +254,39 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Get the grid, configuration !---------------------------- - call ESMF_GridCompGet( GC, grid=Grid, RC=status ) - VERIFY_(STATUS) + call ESMF_GridCompGet( GC, grid=Grid, _RC) ! Get the layout from the grid !----------------------------- - call ESMF_VMGetCurrent(VM, rc=STATUS) - VERIFY_(STATUS) + call ESMF_VMGetCurrent(VM, _RC) ! Set the time for MOM !--------------------- - call ESMF_ClockGet(CLOCK, currTIME=MyTime, TimeStep=TINT, RC=STATUS) - VERIFY_(STATUS) + call ESMF_ClockGet(CLOCK, currTIME=MyTime, TimeStep=TINT, _RC) call ESMF_TimeGet (MyTime, & YY=YEAR, MM=MONTH, DD=DAY, & H=HR, M =MN, S =SC, & - RC=STATUS ) - VERIFY_(STATUS) + _RC) - CALL ESMF_TimeIntervalGet(TINT, S=DT_OCEAN, RC=status) - VERIFY_(status) + CALL ESMF_TimeIntervalGet(TINT, S=DT_OCEAN, _RC) ! Allocate this instance of the internal state and wrap ! ----------------------------------------------------- - allocate ( MOM_MAPL_internal_state, stat=status ) - VERIFY_(STATUS) + allocate ( MOM_MAPL_internal_state, __STAT__) wrap%ptr => MOM_MAPL_internal_state ! Save pointer to the wrapped internal state in the GC ! ---------------------------------------------------- - call ESMF_UserCompSetInternalState ( GC, 'MOM_MAPL_state', WRAP, STATUS ) - VERIFY_(STATUS) + call ESMF_UserCompSetInternalState ( GC, 'MOM_MAPL_state', WRAP, _RC) - allocate ( Boundary, stat=STATUS); VERIFY_(STATUS) - allocate ( Ocean, stat=STATUS); VERIFY_(STATUS) + allocate ( Boundary, __STAT__) + allocate ( Ocean, __STAT__) MOM_MAPL_internal_state%Ice_ocean_boundary => Boundary MOM_MAPL_internal_state%Ocean => Ocean @@ -704,8 +294,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! FMS initialization using the communicator from the VM !------------------------------------------------------ - call ESMF_VMGet(VM, mpiCommunicator=Comm, rc=STATUS) - VERIFY_(STATUS) + call ESMF_VMGet(VM, mpiCommunicator=Comm, _RC) call fms_init(Comm) @@ -715,7 +304,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) call constants_init call field_manager_init call set_calendar_type ( JULIAN) - call diag_manager_init !SA: could pass time_init, not available before (MOM5) + call diag_manager_init !SA: could pass time_init, not available before (MOM5) DT = set_time (DT_OCEAN, 0) Time = set_date (YEAR,MONTH,DAY,HR,MN,SC) @@ -724,8 +313,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! to make sure it matches what is expected here !---------------------------------------------------- - call MAPL_GetResource( MAPL, wind_stagger, Label="ocean_wind_stagger:", DEFAULT="AGRID", RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetResource( MAPL, wind_stagger, Label="ocean_wind_stagger:", DEFAULT="AGRID", _RC) if ( trim(wind_stagger) == "AGRID") then iwind_stagger = AGRID @@ -771,8 +359,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Check local sizes of horizontal dimensions !-------------------------------------------- - call MAPL_GridGet(GRID, localCellCountPerDim=counts, RC=status) - VERIFY_(STATUS) + call MAPL_GridGet(GRID, localCellCountPerDim=counts, _RC) IM=iec-isc+1 JM=jec-jsc+1 @@ -822,8 +409,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) Boundary% p (g_isd:g_ied,g_jsd:g_jed), & Boundary% mi (g_isd:g_ied,g_jsd:g_jed), & Boundary% ice_rigidity (g_isd:g_ied,g_jsd:g_jed), & - stat=STATUS ) - VERIFY_(STATUS) + __STAT__) ! Clear the fluxes we will not be using !-------------------------------------- @@ -861,50 +447,44 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Generic initialize ! ------------------ - call MAPL_GenericInitialize( GC, IMPORT, EXPORT, CLOCK, RC=status ) - VERIFY_(STATUS) + call MAPL_GenericInitialize( GC, IMPORT, EXPORT, CLOCK, _RC ) ! Make sure exports neede by the parent prior to our run call are initialized !---------------------------------------------------------------------------- - call MAPL_GetPointer(EXPORT, MASK, 'MOM_2D_MASK', alloc=.true., RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, TW, 'TW' , alloc=.true., RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, SW, 'SW' , alloc=.true., RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, AREA, 'AREA', alloc=.true., RC=STATUS) - VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, sea_lev, 'SLV', alloc=.true., RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetPointer(EXPORT, MOM_2D_MASK, 'MOM_2D_MASK', alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, TW, 'TW' , alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, SW, 'SW' , alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, AREA, 'AREA', alloc=.true., _RC) + call MAPL_GetPointer(EXPORT, SLV, 'SLV', alloc=.true., _RC) ! Get the 2-D MOM data !--------------------- - allocate(Tmp2(IM,JM), stat=status); VERIFY_(STATUS) + allocate(Tmp2(IM,JM), __STAT__) call ocean_model_data_get(Ocean_State, Ocean, 'mask', Tmp2, isc, jsc) - MASK = real(Tmp2, kind=G5KIND) + MOM_2D_MASK = real(Tmp2, kind=GeosKind) call ocean_model_data_get(Ocean_State, Ocean, 't_surf', Tmp2, g_isc, g_jsc) ! this comes to us in deg C - where(MASK(:,:) > 0.0) - TW = real(Tmp2, kind=G5KIND) + MAPL_TICE ! because C to K was subtracted in MOM + where(MOM_2D_MASK(:,:) > 0.0) + TW = real(Tmp2, kind=GeosKind) + MAPL_TICE ! because C to K was subtracted in MOM elsewhere TW = MAPL_UNDEF end where call ocean_model_data_get(Ocean_State, Ocean, 's_surf', Tmp2, g_isc, g_jsc) ! comes to us in PSU - where(MASK(:,:) > 0.0) - SW = real(Tmp2, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + SW = real(Tmp2, kind=GeosKind) elsewhere SW = MAPL_UNDEF end where if(associated(area)) then call ocean_model_data_get(Ocean_State, Ocean, 'area', Tmp2, isc, jsc) - AREA = real(Tmp2, kind=G5KIND) + AREA = real(Tmp2, kind=GeosKind) end if - deallocate(Tmp2) + deallocate(Tmp2, __STAT__) ! All Done !--------- @@ -935,8 +515,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals with ESMF and MAPL types @@ -955,8 +533,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! type(ocean_grid_type), pointer :: Ocean_grid => null() -! Required exports - +!#include "MOM6_GEOSPlug_DeclarePointer___.h" ! Because these are "real(kind=GeosKind)" not using ACG. +! Exports REAL_, pointer :: TW (:,:) => null() REAL_, pointer :: SW (:,:) => null() REAL_, pointer :: UW (:,:) => null() @@ -967,12 +545,9 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) REAL_, pointer :: FRAZIL(:,:) => null() REAL_, pointer :: MELT_POT(:,:) => null() REAL_, pointer :: FRZMLT(:,:) => null() - REAL_, pointer :: MASK (:,:) => null() + REAL_, pointer :: MOM_2D_MASK (:,:) => null() REAL_, pointer :: AREA (:,:) => null() -! Optional Exports -! none - ! Imports REAL_, pointer :: TAUX(:,:) => null() REAL_, pointer :: TAUY(:,:) => null() @@ -1017,33 +592,29 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) real :: pice_scaling = 1.0 integer :: DT_OCEAN - REAL_, pointer, dimension(:,:) :: LATS => null() REAL_, pointer, dimension(:,:) :: LONS => null() + __Iam__('Run') + ! Begin !------ ! Get the component name and set-up traceback handle. ! ----------------------------------------------------- - Iam = "Run" - call ESMF_GridCompGet( gc, NAME=comp_name, RC=status ) - VERIFY_(status) - Iam = trim(comp_name) // Iam + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//Iam ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, RC=status) - VERIFY_(STATUS) - + call MAPL_GetObjectFromGC( GC, MAPL, _RC) call MAPL_Get(MAPL, & INTERNAL_ESMF_STATE = INTERNAL, & LATS = LATS , & LONS = LONS , & - RC=STATUS ) - VERIFY_(STATUS) + _RC) ! Profilers !---------- @@ -1054,7 +625,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Get the Plug private internal state !-------------------------------------- - CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS ) + CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS) VERIFY_(STATUS) MOM_MAPL_internal_state => WRAP%PTR @@ -1084,13 +655,14 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Temporaries with MOM default reals !----------------------------------- - allocate(U(IM,JM ), stat=STATUS); VERIFY_(STATUS) - allocate(V(IM,JM ), stat=STATUS); VERIFY_(STATUS) - allocate(cos_rot(IM,JM), stat=STATUS); VERIFY_(STATUS) - allocate(sin_rot(IM,JM), stat=STATUS); VERIFY_(STATUS) + allocate(U(IM,JM ), __STAT__) + allocate(V(IM,JM ), __STAT__) + allocate(cos_rot(IM,JM), __STAT__) + allocate(sin_rot(IM,JM), __STAT__) -! Get IMPORT pointers -!-------------------- +! Get pointers to imports and exports +!------------------------------------ +!#include "MOM6_GEOSPlug_GetPointer___.h" ! Because connectivities across MOM5 and MOM6 are messy, do these manually :( call MAPL_GetPointer(IMPORT, TAUX, 'TAUX' , RC=STATUS); VERIFY_(STATUS) call MAPL_GetPointer(IMPORT, TAUY, 'TAUY' , RC=STATUS); VERIFY_(STATUS) @@ -1128,16 +700,14 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) call MAPL_GetPointer(EXPORT, MELT_POT,'MELT_POT', alloc=.true., RC=STATUS); VERIFY_(STATUS) call MAPL_GetPointer(EXPORT, FRZMLT, 'FRZMLT', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetPointer(EXPORT, MASK, 'MOM_2D_MASK', RC=STATUS); VERIFY_(STATUS) + call MAPL_GetPointer(EXPORT, MOM_2D_MASK, 'MOM_2D_MASK', RC=STATUS); VERIFY_(STATUS) call MAPL_GetPointer(EXPORT, AREA, 'AREA', RC=STATUS); VERIFY_(STATUS) - call MAPL_GetResource(MAPL, pice_scaling, Label = "MOM_PICE_SCALING:", default = 1.0, rc = status); VERIFY_(status) - ! Fill in ocean boundary fluxes/forces !------------------------------------- - call MAPL_GetResource( MAPL, pres_loading, Label="pres_loading:", DEFAULT="NO", RC=STATUS) - VERIFY_(STATUS) + call MAPL_GetResource(MAPL, pice_scaling, Label="MOM_PICE_SCALING:", DEFAULT= 1.0, _RC) + call MAPL_GetResource(MAPL, pres_loading, Label="pres_loading:", DEFAULT="NO", _RC) ! NOTE: PICE that is available here is all = 0. This should be made realistic, for now it is from MOM5 legacy ! Need to study with zero pressure loading (CTL: as now), exp1 ( with PS only), exp2 (with PS and PICE), exp3 (PICE only). @@ -1187,17 +757,14 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! Set the time for MOM !--------------------- - call ESMF_ClockGet(CLOCK, currTIME=MyTime, TimeStep=TINT, RC=STATUS) - VERIFY_(STATUS) + call ESMF_ClockGet(CLOCK, currTIME=MyTime, TimeStep=TINT, _RC) call ESMF_TimeGet (MyTime, & YY=YEAR, MM=MONTH, DD=DAY, & H=HR, M =MN, S =SC, & - RC=STATUS ) - VERIFY_(STATUS) + _RC) - CALL ESMF_TimeIntervalGet(TINT, S=DT_OCEAN, RC=status) - VERIFY_(status) + CALL ESMF_TimeIntervalGet(TINT, S=DT_OCEAN, _RC) DT = set_time (DT_OCEAN, 0) Time = set_date (YEAR,MONTH,DAY,HR,MN,SC) @@ -1207,7 +774,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! set following to non-zero only if the coupled model becomes unstable ! (inconsistent atmosphere or bad restart! or some instabilities) - per Atanas T - call MAPL_GetResource(MAPL, steady_state_ocean, Label = "steady_state_ocean:", default = 0, rc = status); VERIFY_(status) + call MAPL_GetResource(MAPL, steady_state_ocean, Label = "steady_state_ocean:", default = 0, _RC) if(steady_state_ocean == 0) then call update_ocean_model(Boundary, Ocean_State, Ocean, Time, DT) @@ -1223,13 +790,13 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! mask U = 0.0 call ocean_model_data_get(Ocean_State, Ocean, 'mask', U, isc, jsc) - MASK = real(U, kind=G5KIND) + MOM_2D_MASK = real(U, kind=GeosKind) ! surface (potential) temperature (K) U = 0.0 call ocean_model_data_get(Ocean_State, Ocean, 't_surf', U, isc, jsc) ! this comes to us in deg C - where(MASK(:,:) > 0.0) - TW = real(U, kind=G5KIND) + MAPL_TICE ! because C to K was subtracted in MOM + where(MOM_2D_MASK(:,:) > 0.0) + TW = real(U, kind=GeosKind) + MAPL_TICE ! because C to K was subtracted in MOM elsewhere TW = MAPL_UNDEF end where @@ -1237,8 +804,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ! surface salinity (PSU) U = 0.0 call ocean_model_data_get(Ocean_State, Ocean, 's_surf', U, isc, jsc) ! this comes to us in PSU - where(MASK(:,:) > 0.0) - SW = real(U, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + SW = real(U, kind=GeosKind) elsewhere SW = MAPL_UNDEF end where @@ -1247,8 +814,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) U = 0.0 if(associated(SLV)) then call ocean_model_data_get(Ocean_State, Ocean, 'sea_lev', U, isc, jsc) ! this comes to us in m - where(MASK(:,:)>0.0) - SLV = real(U, kind = G5KIND) + where(MOM_2D_MASK(:,:)>0.0) + SLV = real(U, kind = GeosKind) elsewhere SLV = 0.0 end where @@ -1258,8 +825,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) U = 0.0 if(associated(FRAZIL)) then call ocean_model_data_get(Ocean_State, Ocean, 'frazil', U, isc, jsc) ! this comes to us in J/m2 - where(MASK(:,:)>0.0) - FRAZIL = real( (U)/dt_ocean, kind = G5KIND) ! relying on fortran to promote the int (dt_ocean) to real + where(MOM_2D_MASK(:,:)>0.0) + FRAZIL = real( (U)/dt_ocean, kind = GeosKind) ! relying on fortran to promote the int (dt_ocean) to real elsewhere FRAZIL = 0.0 end where @@ -1269,8 +836,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) U = 0.0 if(associated(MELT_POT)) then call ocean_model_data_get(Ocean_State, Ocean, 'melt_pot', U, isc, jsc) ! this comes to us in J/m2 - where(MASK(:,:)>0.0) - MELT_POT = -real( (U)/dt_ocean, kind = G5KIND) ! relying on fortran to promote the int (dt_ocean) to real + where(MOM_2D_MASK(:,:)>0.0) + MELT_POT = -real( (U)/dt_ocean, kind = GeosKind) ! relying on fortran to promote the int (dt_ocean) to real elsewhere MELT_POT = 0.0 end where @@ -1284,7 +851,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) ASSERT_(.false.) endif - where(MASK(:,:)>0.0) + where(MOM_2D_MASK(:,:)>0.0) FRZMLT = FRAZIL + MELT_POT elsewhere FRZMLT = 0.0 @@ -1299,16 +866,16 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) call ocean_model_get_UV_surf(Ocean_State, Ocean, 'va', V, isc, jsc) ! this comes to us in m/s if(associated(UW )) then - where(MASK(:,:) > 0.0) - UW = real(U, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + UW = real(U, kind=GeosKind) elsewhere UW=0.0 end where endif if(associated(VW )) then - where(MASK(:,:) > 0.0) - VW = real(V, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + VW = real(V, kind=GeosKind) elsewhere VW=0.0 end where @@ -1320,16 +887,16 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) call ocean_model_get_UV_surf(Ocean_State, Ocean, 'vb', V, isc, jsc) ! this comes to us in m/s if(associated(UWB )) then - where(MASK(:,:) > 0.0) - UWB = real(U, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + UWB = real(U, kind=GeosKind) elsewhere UWB =0.0 end where endif if(associated(VWB )) then - where(MASK(:,:) > 0.0) - VWB = real(V, kind=G5KIND) + where(MOM_2D_MASK(:,:) > 0.0) + VWB = real(V, kind=GeosKind) elsewhere VWB =0.0 end where @@ -1339,10 +906,10 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC ) !----------------------------------- ! none ! 3d exports with MOM6, such as depths, T, S, U, V, etc -! will not be exported. If needed, write them on tri-polar grid directly from MOM6 +! will not be exported. If needed, write them directly from MOM6 - deallocate(U, V) - deallocate(cos_rot,sin_rot) + deallocate(U, V, __STAT__) + deallocate(cos_rot,sin_rot, __STAT__) call MAPL_TimerOff(MAPL,"RUN" ) call MAPL_TimerOff(MAPL,"TOTAL" ) @@ -1382,8 +949,6 @@ subroutine Finalize ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals with MOM types @@ -1391,19 +956,18 @@ subroutine Finalize ( gc, import, export, clock, rc ) type(time_type) :: Time integer :: YEAR,MONTH,DAY,HR,MN,SC + __Iam__('Finalize') + ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- - Iam = "Finalize" - call ESMF_GridCompGet( gc, NAME=comp_name, RC=status ) - VERIFY_(STATUS) - Iam = trim(comp_name) // Iam + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//Iam ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, RC=status) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) ! Profilers !---------- @@ -1414,7 +978,7 @@ subroutine Finalize ( gc, import, export, clock, rc ) ! Get the Plug private internal state !-------------------------------------- - CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS ) + CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS) VERIFY_(STATUS) MOM_MAPL_internal_state => WRAP%PTR @@ -1426,14 +990,12 @@ subroutine Finalize ( gc, import, export, clock, rc ) ! Set the times for MOM !---------------------- - call ESMF_ClockGet( CLOCK, currTime=MyTime, RC=STATUS) - VERIFY_(status) + call ESMF_ClockGet( CLOCK, currTime=MyTime, _RC) call ESMF_TimeGet (MyTime, & YY=YEAR, MM=MONTH, DD=DAY, & H=HR, M =MN, S =SC, & - RC=STATUS ) - VERIFY_(STATUS) + _RC) Time = set_date(YEAR,MONTH,DAY,HR,MN,SC) @@ -1466,12 +1028,11 @@ subroutine Finalize ( gc, import, export, clock, rc ) Boundary% p , & Boundary% mi , & Boundary% ice_rigidity , & - stat=STATUS ) - VERIFY_(STATUS) + __STAT__) - deallocate ( Ocean, STAT=STATUS); VERIFY_(STATUS) - deallocate ( Boundary, STAT=STATUS); VERIFY_(STATUS) - deallocate ( MOM_MAPL_internal_state, STAT=STATUS); VERIFY_(STATUS) + deallocate ( Ocean, __STAT__) + deallocate ( Boundary, __STAT__) + deallocate ( MOM_MAPL_internal_state, __STAT__) ! call MAPL_TimerOff(MAPL,"FINALIZE") @@ -1480,8 +1041,7 @@ subroutine Finalize ( gc, import, export, clock, rc ) ! Generic Finalize ! ------------------ - call MAPL_GenericFinalize( GC, IMPORT, EXPORT, CLOCK, RC=status ) - VERIFY_(STATUS) + call MAPL_GenericFinalize( GC, IMPORT, EXPORT, CLOCK, _RC) call mpp_exit() @@ -1497,7 +1057,7 @@ end subroutine Finalize ! !INTERFACE: - subroutine Record ( gc, import, export, clock, rc ) + subroutine Record ( GC, IMPORT, EXPORT, CLOCK, RC ) ! !ARGUMENTS: @@ -1516,49 +1076,44 @@ subroutine Record ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals character(len=14) :: timeStamp logical :: doRecord + __Iam__('Record') + ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- - Iam = "Record" - call ESMF_GridCompGet( gc, NAME=comp_name, RC=status ) - VERIFY_(STATUS) - Iam = trim(comp_name) // Iam + call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC) + Iam = trim(COMP_NAME)//'::'//Iam ! Get my internal MAPL_Generic state !----------------------------------- - call MAPL_GetObjectFromGC ( GC, MAPL, RC=status) - VERIFY_(STATUS) + call MAPL_GetObjectFromGC ( GC, MAPL, _RC) ! Profilers !---------- call MAPL_TimerOn(MAPL,"TOTAL") - doRecord = MAPL_RecordAlarmIsRinging(MAPL, RC=status) - VERIFY_(STATUS) + doRecord = MAPL_RecordAlarmIsRinging(MAPL, MODE=MAPL_Write2Disk, _RC) if (doRecord) then ! Get the Plug private internal state !-------------------------------------- - CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS ) + CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS) VERIFY_(STATUS) MOM_MAPL_internal_state => WRAP%PTR Ocean_State => MOM_MAPL_internal_state%Ocean_State - call MAPL_DateStampGet(clock, timeStamp, rc=status) - VERIFY_(STATUS) + call MAPL_DateStampGet(clock, timeStamp, _RC) ! Write a restart !----------------- @@ -1577,11 +1132,10 @@ end subroutine Record end module MOM6_GEOSPlugMod -subroutine SetServices(gc, rc) +subroutine SetServices(GC, RC) use ESMF use MOM6_GEOSPlugMod, only : mySetservices=>SetServices - type(ESMF_GridComp) :: gc - integer, intent(out) :: rc - call mySetServices(gc, rc=rc) + type(ESMF_GridComp) :: GC + integer, intent(out) :: RC + call mySetServices(GC, rc=RC) end subroutine - diff --git a/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc b/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc new file mode 100644 index 0000000..274c42d --- /dev/null +++ b/MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc @@ -0,0 +1,89 @@ +schema_version: 2.0.0 +component: MOM6_GEOSPlug + +category: IMPORT +#------------------------------------------------------------------------------------ +# VARIABLE | DIMENSIONS | Additional Metadata +#------------------------------------------------------------------------------------ +NAME | UNITS | DIMS | VLOC | LONG_NAME +#------------------------------------------------------------------------------------ +TAUX | N m-2 | xy | N | Agrid_eastward_stress_on_ocean +TAUY | N m-2 | xy | N | Agrid_northward_stress_on_ocean +PS | Pa | xy | N | surface_atmospheric_pressure +PICE | Pa | xy | N | pressure_due_to_ice_weight +SWHEAT | W m-2 | xyz | C | DUMMY_IMPORT_solar_heating_rate +LWFLX | W m-2 | xy | N | surface_net_downward_longwave_flux +SHFLX | W m-2 | xy | N | upward_sensible_heat_flux +QFLUX | kg m-2 s-1 | xy | N | evaporation +RAIN | kg m-2 s-1 | xy | N | ocean_rainfall +SNOW | kg m-2 s-1 | xy | N | ocean_snowfall +SFLX | kg m-2 s-1 | xy | N | salt_flux_from_sea_ice_to_ocean +PENUVR | W m-2 | xy | N | net_downward_penetrating_direct_UV_flux +PENPAR | W m-2 | xy | N | net_downward_penetrating_direct_PAR_flux +PENUVF | W m-2 | xy | N | net_downward_penetrating_diffuse_UV_flux +PENPAF | W m-2 | xy | N | net_downward_penetrating_diffuse_PAR_flux +DRNIR | W m-2 | xy | N | net_surface_downwelling_nir_beam_flux +DFNIR | W m-2 | xy | N | net_surface_downwelling_nir_diffuse_flux +DISCHARGE | kg m-2 s-1 | xy | N | river_discharge_at_ocean_points +AICE | 1 | xy | N | ice_concentration_of_grid_cell +TAUXBOT | N m-2 | xy | N | eastward_stress_at_base_of_ice_Agrid +TAUYBOT | N m-2 | xy | N | northward_stress_at_base_of_ice_Agrid + +category: EXPORT +#------------------------------------------------------------------------------------ +# VARIABLE | DIMENSIONS | Additional Metadata +#------------------------------------------------------------------------------------ +NAME | UNITS | DIMS | VLOC | LONG_NAME +#------------------------------------------------------------------------------------ +UW | m s-1 | xy | N | surface_Agrid_eastward_velocity +VW | m s-1 | xy | N | surface_Agrid_northward_velocity +UWB | m s-1 | xy | N | surface_Bgrid_X_velocity +VWB | m s-1 | xy | N | surface_Bgrid_Y_velocity +TW | K | xy | N | surface_temperature +SW | psu | xy | N | surface_salinity +MOM_2D_MASK | 1 | xy | N | ocean_mask_at_tracer_points +AREA | m+2 | xy | N | ocean_area_at_tracer_points +SLV | m | xy | N | sea_level_with_ice_loading_and_invBaro +FRAZIL | W m-2 | xy | N | heating_from_frazil_formation +MELT_POT | W m-2 | xy | N | heat_that_can_be_used_to_melt_sea_ice +FRZMLT | W m-2 | xy | N | freeze_melt_potential +DH | m OR kg m-2 | xyz | C | DUMMY_EXPORT_layer_thickness +T | K | xyz | C | DUMMY_EXPORT_potential_temperature +S | PSU | xyz | C | DUMMY_EXPORT_salinity + +category: INTERNAL +#---------------------------------------------------------------------------------------- +# VARIABLE | DIMENSION | Additional Metadata +#---------------------------------------------------------------------------------------- + NAME | UNITS | DIMS | VLOC | UNGRIDDED | RESTART | ADD2EXPORT | FRIENDLYTO | LONG NAME +#---------------------------------------------------------------------------------------- + + + +#******************************************************** +# +# Legend +# +#------------------------------------------------------------------ +# Column label | MAPL keyword/interpretation | Default +#--------------|--------------------------------------------------- +# NAME | short_name | +# UNITS | units | +# DIMS | dims | +# VLOC | VLocation | MAPL_VLocationNone +# LONG NAME | long_name | +# COND | if () then | .FALSE. +# NUM_SUBTILES | num_subtiles +# ... +#------------------------------------------------------------------ +# +#-------------------------------------------- +# Entry alias | Column | MAPL keyword/interpretation +#--------------|----------------------------- +# xyz | DIMS | MAPL_HorzVert +# xy | DIMS | MAPL_HorzOnly +# z | DIMS | MAPL_VertOnly (plus ungridded) +# C | VLOC | MAPL_VlocationCenter +# E | VLOC | MAPL_VlocationEdge +# N | VLOC | MAPL_VlocationNone +#-------------------------------------------- diff --git a/MOM6_GEOSPlug/mom6_app/72x36/MOM_override b/MOM6_GEOSPlug/mom6_app/72x36/MOM_override index 2c195c3..ed8f4bf 100755 --- a/MOM6_GEOSPlug/mom6_app/72x36/MOM_override +++ b/MOM6_GEOSPlug/mom6_app/72x36/MOM_override @@ -1,33 +1,33 @@ ! Blank file in which we can put "overrides" for parameters -NK = 50 -LAYOUT = 3, 2 +#override NK = 50 +#override LAYOUT = 3, 2 #override DT = 900.0 #override DT_THERM = 900. #override USE_REGRIDDING = True #override BULKMIXEDLAYER = False -COORD_FILE = "Layer_coord50.nc" -USE_STORED_SLOPES = True -USE_NEUTRAL_DIFFUSION = True -SIMPLE_TKE_TO_KD = True -REGRIDDING_COORDINATE_MODE = "Z*" -ALE_COORDINATE_CONFIG = "FILE:vgrid.nc,dz" -REMAPPING_SCHEME = "PPM_H4" -HMIX_FIXED = 0.5 -CFL_TRUNCATE_RAMP_TIME = 7200. -Z_INIT_ALE_REMAPPING = True -ENERGETICS_SFC_PBL = True -USE_MLD_ITERATION = False -MASS_WEIGHT_IN_PRESSURE_GRADIENT = True +#override COORD_FILE = "Layer_coord50.nc" +#override USE_STORED_SLOPES = True +#override USE_NEUTRAL_DIFFUSION = True +#override SIMPLE_TKE_TO_KD = True +#override REGRIDDING_COORDINATE_MODE = "Z*" +#override ALE_COORDINATE_CONFIG = "FILE:vgrid.nc,dz" +#override REMAPPING_SCHEME = "PPM_H4" +#override HMIX_FIXED = 0.5 +#override CFL_TRUNCATE_RAMP_TIME = 7200. +#override Z_INIT_ALE_REMAPPING = True +#override ENERGETICS_SFC_PBL = True +#override USE_MLD_ITERATION = False +#override MASS_WEIGHT_IN_PRESSURE_GRADIENT = True -!VERBOSITY = 9 -DEBUG = True -FATAL_UNUSED_PARAMS = True +#override VERBOSITY = 2 +#override DEBUG = True +#override FATAL_UNUSED_PARAMS = True -TOPO_FILE = "ocean_topog_Edited.nc" +#override TOPO_FILE = "ocean_topog_Edited.nc" -RESTART_CHECKSUMS_REQUIRED = False +#override RESTART_CHECKSUMS_REQUIRED = False -HFREEZE = 10.0 -BAD_VAL_SST_MIN = -3.0 -BAD_VAL_SSS_MAX = 55.0 +#override HFREEZE = 10.0 +#override BAD_VAL_SST_MIN = -3.0 +#override BAD_VAL_SSS_MAX = 55.0 diff --git a/MOM_GEOS5PlugMod/CMakeLists.txt b/MOM_GEOS5PlugMod/CMakeLists.txt index 4877672..acfd0c6 100644 --- a/MOM_GEOS5PlugMod/CMakeLists.txt +++ b/MOM_GEOS5PlugMod/CMakeLists.txt @@ -20,3 +20,7 @@ string(REPLACE " " ";" tmp ${FREAL8}) foreach (flag ${tmp}) target_compile_options (${this} PRIVATE $<$:${flag}>) endforeach () + +mapl_acg (${this} MOM_GEOS5PlugMod_StateSpecs.rc + IMPORT_SPECS EXPORT_SPECS + GET_POINTERS DECLARE_POINTERS) diff --git a/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod.F90 b/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod.F90 index b47d047..df3207b 100644 --- a/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod.F90 +++ b/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod.F90 @@ -157,507 +157,12 @@ subroutine SetServices ( GC, RC ) !BOS -! !IMPORT STATE: - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUX', & - LONG_NAME = 'Agrid_eastward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TAUY', & - LONG_NAME = 'Agrid_northward_stress_on_ocean', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PS', & - LONG_NAME = 'Surface Atmospheric Pressure', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PICE', & - LONG_NAME = 'pressure due to ice weight', & - UNITS = 'Pa', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SWHEAT', & - LONG_NAME = 'solar_heating_rate', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC ,& - LONG_NAME = 'surface_net_downward_longwave_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'LWFLX' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'upward_sensible_heat_flux' ,& - UNITS = 'W m-2' ,& - SHORT_NAME = 'SHFLX' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'evaporation' ,& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'QFLUX' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'RAIN', & - LONG_NAME = 'ocean_rainfall',& - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SNOW', & - LONG_NAME = 'ocean_snowfall',& - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'SFLX', & - LONG_NAME = 'salt_flux_from_sea_ice_to_ocean', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVR', & - LONG_NAME = 'net_downward_penetrating_direct_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAR', & - LONG_NAME = 'net_downward_penetrating_direct_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENUVF', & - LONG_NAME = 'net_downward_penetrating_diffuse_UV_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'PENPAF', & - LONG_NAME = 'net_downward_penetrating_diffuse_PAR_flux', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC ,& - LONG_NAME = 'net_surface_downwelling_nir_beam_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DRNIR' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC ,& - LONG_NAME = 'net_surface_downwelling_nir_diffuse_flux',& - UNITS = 'W m-2' ,& - SHORT_NAME = 'DFNIR' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'TR', & - LONG_NAME = 'tracer_mixing_ratios', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - DATATYPE = MAPL_BundleItem, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - LONG_NAME = 'river_discharge_at_ocean_points',& - UNITS = 'kg m-2 s-1' ,& - SHORT_NAME = 'DISCHARGE' ,& - DIMS = MAPL_DimsHorzOnly ,& - VLOCATION = MAPL_VLocationNone ,& - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'STROCNXB', & - LONG_NAME = 'x_stress_at_base_of_ice_weighted_by_aiu', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'STROCNYB', & - LONG_NAME = 'y_stress_at_base_of_ice_weighted_by_aiu', & - UNITS = 'N m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - - VERIFY_(STATUS) - - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'AICEU', & - LONG_NAME = 'ice_concentration_of_grid_cell_Bgrid', & - UNITS = '1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - if (dual_ocean) then - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'DEL_TEMP', & - LONG_NAME = 'temperature correction to top level MOM (Tsst-Tmom', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - end if - -! !EXPORT STATE: - -! Run1 exports - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UW', & - LONG_NAME = 'surface_Agrid_eastward_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VW', & - LONG_NAME = 'surface_Agrid_northward_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UWB', & - LONG_NAME = 'surface_Bgrid_X_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VWB', & - LONG_NAME = 'surface_Bgrid_Y_velocity', & - UNITS = 'm s-1 ', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TW', & - LONG_NAME = 'surface_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SW', & - LONG_NAME = 'surface_salinity', & - UNITS = 'psu', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'MOM_3D_MASK', & - LONG_NAME = 'Mom4_ocean_mask_at_t-points', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'AREA', & - LONG_NAME = 'Mom4_ocean_area_at_t-points', & - UNITS = 'm+2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SSH', & - LONG_NAME = 'sea_level_height', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SLV', & - LONG_NAME = 'sea_level_with_ice_loading', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'FRZMLT', & - LONG_NAME = 'freeze_melt_potential', & - UNITS = 'W m-2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) +! !Import state: +#include "MOM_GEOS5PlugMod_Import___.h" -! Diagnostic exports +! !Export state: +#include "MOM_GEOS5PlugMod_Export___.h" - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DH', & - LONG_NAME = 'layer_thickness', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'RHO', & - LONG_NAME = 'density', & - UNITS = 'kg m-3', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'MASSCELLO', & - LONG_NAME = 'mass_per_unit_area', & - UNITS = 'kg m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'HC', & - LONG_NAME = 'heat_content', & - UNITS = 'J m-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'U', & - LONG_NAME = 'eastward_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'V', & - LONG_NAME = 'northward_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'UX', & - LONG_NAME = 'x_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'VX', & - LONG_NAME = 'y_current', & - UNITS = 'm s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'T', & - LONG_NAME = 'potential_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TCON', & - LONG_NAME = 'conservative_temperature', & - UNITS = 'K', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'S', & - LONG_NAME = 'salinity', & - UNITS = 'psu', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'WMO', & - LONG_NAME = 'upward_mass_transport', & - UNITS = 'tonne s-1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'WMOSQ', & - LONG_NAME = 'upward_mass_transport_squared', & - UNITS = 'tonne2 s-2', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'TOSSQ', & - LONG_NAME = 'surface_temperature_squared', & - UNITS = 'K2', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'PBO', & - LONG_NAME = 'pressure_at_sea_floor', & - UNITS = 'dbar', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'OMLDAMAX', & - LONG_NAME = 'maximum_mixed_layer_thickness', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'DEPTH', & - LONG_NAME = 'layer_depth', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'MLD', & - LONG_NAME = 'mixed_layer_depth', & - UNITS = 'm', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'PSI', & - LONG_NAME = 'barotropic_streamfunction', & - UNITS = 'kg s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, & - RC=STATUS ) - VERIFY_(STATUS) - - call MAPL_AddExportSpec(GC, & - SHORT_NAME = 'SWFRAC', & - LONG_NAME = 'shortwave_fractional_decay', & - UNITS = '1', & - DIMS = MAPL_DimsHorzVert, & - VLOCATION = MAPL_VLocationCenter, & - RC=STATUS ) - VERIFY_(STATUS) - !EOS ! Set the Initialize, Run, Finalize entry points @@ -665,14 +170,14 @@ subroutine SetServices ( GC, RC ) call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, RC=status) VERIFY_(STATUS) - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=status) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, RC=status) VERIFY_(STATUS) call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize, RC=status) VERIFY_(STATUS) call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_WRITERESTART, Record, RC=status) VERIFY_(STATUS) if (dual_ocean) then - call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run2, RC=status) + call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run2, RC=status) VERIFY_(STATUS) end if @@ -722,9 +227,9 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS - character(len=ESMF_MAXSTR) :: COMP_NAME + character(len=ESMF_MAXSTR) :: IAm + integer :: STATUS + character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals @@ -1081,8 +586,8 @@ subroutine Run ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS + character(len=ESMF_MAXSTR) :: IAm + integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals @@ -1843,8 +1348,8 @@ subroutine Run2 ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS + character(len=ESMF_MAXSTR) :: IAm + integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals @@ -1989,8 +1494,8 @@ subroutine Finalize ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS + character(len=ESMF_MAXSTR) :: IAm + integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals with MOM types @@ -2090,8 +1595,8 @@ subroutine Record ( gc, import, export, clock, rc ) ! ErrLog Variables - character(len=ESMF_MAXSTR) :: IAm - integer :: STATUS + character(len=ESMF_MAXSTR) :: IAm + integer :: STATUS character(len=ESMF_MAXSTR) :: COMP_NAME ! Locals diff --git a/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod_StateSpecs.rc b/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod_StateSpecs.rc new file mode 100644 index 0000000..3b2cb87 --- /dev/null +++ b/MOM_GEOS5PlugMod/MOM_GEOS5PlugMod_StateSpecs.rc @@ -0,0 +1,99 @@ +schema_version: 2.0.0 +component: Ocean + +category: IMPORT +#------------------------------------------------------------------------------------ +# VARIABLE | DIMENSIONS | Additional Metadata +#------------------------------------------------------------------------------------ +NAME | UNITS | DIMS | VLOC | COND | DATATYPE | LONG_NAME +#------------------------------------------------------------------------------------ +TAUX | N m-2 | xy | N | | | Agrid_eastward_stress_on_ocean +TAUY | N m-2 | xy | N | | | Agrid_northward_stress_on_ocean +PS | Pa | xy | N | | | Surface Atmospheric Pressure +PICE | Pa | xy | N | | | pressure due to ice weight +SWHEAT | W m-2 | xyz | C | | | solar_heating_rate +LWFLX | W m-2 | xy | N | | | surface_net_downward_longwave_flux +SHFLX | W m-2 | xy | N | | | upward_sensible_heat_flux +QFLUX | kg m-2 s-1 | xy | N | | | evaporation +RAIN | kg m-2 s-1 | xy | N | | | ocean_rainfall +SNOW | kg m-2 s-1 | xy | N | | | ocean_snowfall +SFLX | kg m-2 s-1 | xy | N | | | salt_flux_from_sea_ice_to_ocean +PENUVR | W m-2 | xy | N | | | net_downward_penetrating_direct_UV_flux +PENPAR | W m-2 | xy | N | | | net_downward_penetrating_direct_PAR_flux +PENUVF | W m-2 | xy | N | | | net_downward_penetrating_diffuse_UV_flux +PENPAF | W m-2 | xy | N | | | net_downward_penetrating_diffuse_PAR_flux +DRNIR | W m-2 | xy | N | | | net_surface_downwelling_nir_beam_flux +DFNIR | W m-2 | xy | N | | | net_surface_downwelling_nir_diffuse_flux +DISCHARGE | kg m-2 s-1 | xy | N | | | river_discharge_at_ocean_points +STROCNXB | N m-2 | xy | N | | | x_stress_at_base_of_ice_weighted_by_aiu +STROCNYB | N m-2 | xy | N | | | y_stress_at_base_of_ice_weighted_by_aiu +AICEU | 1 | xy | N | | | ice_concentration_of_grid_cell_Bgrid +DEL_TEMP | K | xy | N | dual_ocean | | temperature correction to top level MOM:Tsst-Tmom +TR | 1 | xyz | C | | MAPL_BundleItem | tracer_mixing_ratios + +category: EXPORT +#------------------------------------------------------------------------------------ +# VARIABLE | DIMENSIONS | Additional Metadata +#------------------------------------------------------------------------------------ +NAME | UNITS | DIMS | VLOC | LONG_NAME +#------------------------------------------------------------------------------------ +UW | m s-1 | xy | N | surface_Agrid_eastward_velocity +VW | m s-1 | xy | N | surface_Agrid_northward_velocity +UWB | m s-1 | xy | N | surface_Bgrid_X_velocity +VWB | m s-1 | xy | N | surface_Bgrid_Y_velocity +TW | K | xy | N | surface_temperature +SW | psu | xy | N | surface_salinity +MOM_3D_MASK | 1 | xyz | C | Mom4_ocean_mask_at_t-points +AREA | m+2 | xy | N | Mom4_ocean_area_at_t-points +SSH | m | xy | N | sea_level_height +SLV | m | xy | N | sea_level_with_ice_loading +FRZMLT | W m-2 | xy | N | freeze_melt_potential +DH | m | xyz | C | layer_thickness +RHO | kg m-3 | xyz | C | density +MASSCELLO | kg m-2 | xyz | C | mass_per_unit_area +HC | J m-2 | xyz | C | heat_content +U | m s-1 | xyz | C | eastward_current +V | m s-1 | xyz | C | northward_current +UX | m s-1 | xyz | C | x_current +VX | m s-1 | xyz | C | y_current +T | K | xyz | C | potential_temperature +TCON | K | xyz | C | conservative_temperature +S | psu | xyz | C | salinity +WMO | tonne s-1 | xyz | C | upward_mass_transport +WMOSQ | tonne2 s-2 | xyz | C | upward_mass_transport_squared +TOSSQ | K2 | xy | N | surface_temperature_squared +PBO | dbar | xy | N | pressure_at_sea_floor +OMLDAMAX | m | xy | N | maximum_mixed_layer_thickness +DEPTH | m | xyz | C | layer_depth +MLD | m | xy | N | mixed_layer_depth +PSI | kg s-1 | xy | N | barotropic_streamfunction +SWFRAC | 1 | xyz | C | shortwave_fractional_decay + + +#******************************************************** +# +# Legend +# +#------------------------------------------------------------------ +# Column label | MAPL keyword/interpretation | Default +#--------------|--------------------------------------------------- +# NAME | short_name | +# UNITS | units | +# DIMS | dims | +# VLOC | VLocation | MAPL_VLocationNone +# LONG NAME | long_name | +# COND | if () then | .FALSE. +# NUM_SUBTILES | num_subtiles +# ... +#------------------------------------------------------------------ +# +#-------------------------------------------- +# Entry alias | Column | MAPL keyword/interpretation +#--------------|----------------------------- +# xyz | DIMS | MAPL_HorzVert +# xy | DIMS | MAPL_HorzOnly +# z | DIMS | MAPL_VertOnly (plus ungridded) +# C | VLOC | MAPL_VlocationCenter +# E | VLOC | MAPL_VlocationEdge +# N | VLOC | MAPL_VlocationNone +#--------------------------------------------