Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ option (BUILD_MIT_OCEAN "BUILD_MIT_OCEAN is turned off by default" OFF) #OFF by
if ( NOT BUILD_MIT_OCEAN )
esma_add_library (${this}
SRCS GEOS_OceanGridComp.F90
SUBCOMPONENTS MOM6_GEOSPlug MOM_GEOS5PlugMod GEOSdatasea_GridComp
SUBCOMPONENTS MOM6_GEOSPlug GEOSdatasea_GridComp
DEPENDENCIES GEOSdatasea_GridComp MAPL esmf)

else()
Expand Down
19 changes: 6 additions & 13 deletions GEOS_OceanGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,8 @@ subroutine SetServices ( GC, RC )
OCEAN_NAME="DATASEA"
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="MOM6", _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)
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)
Expand Down Expand Up @@ -174,10 +171,6 @@ subroutine SetServices ( GC, 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 = 'SSH', CHILD_ID = OCN, _RC)
call MAPL_AddExportSpec (GC, SHORT_NAME = 'PBO', CHILD_ID = OCN, _RC)
endif
if (trim(OCEAN_NAME) == "MOM6") then
call MAPL_AddExportSpec (GC, SHORT_NAME = 'UWC', CHILD_ID = OCN, _RC)
call MAPL_AddExportSpec (GC, SHORT_NAME = 'VWC', CHILD_ID = OCN, _RC)
Expand Down Expand Up @@ -357,8 +350,8 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
call MAPL_GetPointer(EXPORT, MASKO, 'MASKO' , alloc=.true., _RC)

select case (trim(OCEAN_NAME))
case ("MOM", "MIT")
call MAPL_GetPointer(GEX(OCN), MASK3D, trim(OCEAN_NAME)//'_3D_MASK', _RC)
case ("MIT")
call MAPL_GetPointer(GEX(OCN), MASK3D, 'MIT_3D_MASK', _RC)
MASK => MASK3D(:,:,1)
case ("MOM6")
call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', _RC)
Expand Down Expand Up @@ -579,8 +572,8 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
! ---------------------------------------------------------------
if(DO_DATASEA==0) then
select case(trim(OCEAN_NAME))
case ("MOM", "MIT")
call MAPL_GetPointer(GEX(OCN), MASK3D, trim(OCEAN_NAME)//'_3D_MASK', _RC)
case ("MIT")
call MAPL_GetPointer(GEX(OCN), MASK3D, 'MIT_3D_MASK', _RC)
MASK => MASK3D(:,:,1)
case ("MOM6")
call MAPL_GetPointer(GEX(OCN), MASK, 'MOM_2D_MASK', _RC)
Expand Down Expand Up @@ -738,7 +731,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )

if(associated(RFLUX )) RFLUX = 0.0
select case (trim(OCEAN_NAME))
case ("MOM", "MIT", "DATASEA")
case ("MIT", "DATASEA")
do L=1,LM
HEAT(:,:,L) = HEATi(:,:,L)*WGHT
if(associated(RFLUX)) then
Expand Down
2 changes: 1 addition & 1 deletion MOM6_GEOSPlug/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ esma_add_subdirectories(

esma_add_library (${this}
SRCS ${SRCS}
DEPENDENCIES MAPL FMS::fms_r8 mom6
DEPENDENCIES MAPL FMS::fms mom6
TYPE SHARED
)

Expand Down
148 changes: 148 additions & 0 deletions MOM6_GEOSPlug/MOM6_GEOSPlug.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module MOM6_GEOSPlugMod
ocean_state_type, &
ocean_model_get_UV_surf, &
ocean_model_get_thickness, &
ocean_model_put_prog_tracer, &
ocean_model_get_prog_tracer, &
ocean_model_get_prog_tracer_index

Expand Down Expand Up @@ -83,6 +84,8 @@ module MOM6_GEOSPlugMod
type(MOM_MAPL_Type), pointer :: Ptr
end type MOM_MAPLWrap_Type

logical :: DUAL_OCEAN

contains

!BOP
Expand Down Expand Up @@ -113,6 +116,9 @@ subroutine SetServices ( GC, RC )
! Locals
!=============================================================================

type (MAPL_MetaComp), pointer :: MAPL
integer :: iDUAL_OCEAN

__Iam__('SetServices')

! Begin...
Expand All @@ -123,13 +129,23 @@ subroutine SetServices ( GC, RC )
call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC)
Iam = trim(COMP_NAME)//'::'//'SetServices'

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)

call MAPL_GetResource(MAPL, iDUAL_OCEAN, 'DUAL_OCEAN:', default=0, RC=STATUS )
DUAL_OCEAN = iDUAL_OCEAN /= 0


! Set the Initialize, Run, Finalize entry points
! ----------------------------------------------

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)
if (dual_ocean) then
call MAPL_GridCompSetEntryPoint ( GC, ESMF_Method_Run, Run2, _RC)
end if

!BOS

Expand All @@ -146,6 +162,7 @@ subroutine SetServices ( GC, RC )

call MAPL_TimerAdd(GC, name="INITIALIZE" , _RC)
call MAPL_TimerAdd(GC, name="RUN" , _RC)
call MAPL_TimerAdd(GC, name="RUN2" , _RC)
call MAPL_TimerAdd(GC, name="FINALIZE" , _RC)

! Generic SetServices
Expand Down Expand Up @@ -977,6 +994,137 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
RETURN_(ESMF_SUCCESS)
end subroutine Run

!=================================================================================

!BOP

! !IROUTINE: Run2 -- Run2 method, needed only when in dual_ocean mode. Apply correction to top-level MOM temperature, based on DEL_TEMP

! !INTERFACE:

subroutine Run2 ( 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_State) :: INTERNAL ! Internal state

!EOP

! ErrLog Variables

character(len=ESMF_MAXSTR) :: IAm
integer :: STATUS
character(len=ESMF_MAXSTR) :: COMP_NAME

!! Locals
type(MAPL_MetaComp), pointer :: MAPL => null()

type(ocean_public_type), pointer :: Ocean => null()
type(ocean_state_type), pointer :: Ocean_State => null()
type(ocean_grid_type), pointer :: Ocean_grid => null()
type(MOM_MAPL_Type), pointer :: MOM_MAPL_internal_state => null()
type(MOM_MAPLWrap_Type) :: wrap

integer :: isc,iec,jsc,jec

!! Imports
REAL_, pointer :: DEL_TEMP(:,:)

!! Temporaries

real, allocatable :: T(:,:,:)
integer :: IM, JM, LM
integer :: tracer_index

!! Begin
!!------

!! Get the component's name and set-up traceback handle.
!! -----------------------------------------------------
Iam = "Run2"
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)

!! Profilers
!!----------

call MAPL_TimerOn (MAPL,"TOTAL")
call MAPL_TimerOn (MAPL,"RUN2" )

!! Get the Plug's private internal state
!!--------------------------------------

CALL ESMF_UserCompGetInternalState( GC, 'MOM_MAPL_state', WRAP, STATUS);
VERIFY_(STATUS)
MOM_MAPL_internal_state => WRAP%PTR

!! Aliases to MOM types
!!---------------------

Ocean => MOM_MAPL_internal_state%Ocean
Ocean_State => MOM_MAPL_internal_state%Ocean_State

! Get domain size
!----------------
call get_domain_extent(Ocean%Domain, isc, iec, jsc, jec)

IM=iec-isc+1
JM=jec-jsc+1

call get_ocean_grid (Ocean_state, Ocean_grid)
LM=Ocean_grid%ke

!! Temporaries with MOM default reals
!!-----------------------------------

allocate(T(IM,JM,LM), stat=STATUS); VERIFY_(STATUS)

!! Get IMPORT pointers
!!--------------------

call MAPL_GetPointer(IMPORT, DEL_TEMP, 'DEL_TEMP', RC=STATUS); VERIFY_(STATUS)

!! Get EXPORT pointers
!!--------------------
!! by now this should be allocated, so 'alloc=.true.' is needed
!call MAPL_GetPointer(EXPORT, MASK, 'MOM_3D_MASK', RC=STATUS)
!VERIFY_(STATUS)

call ocean_model_get_prog_tracer_index(Ocean_State,tracer_index,'temp')
ASSERT_(tracer_index > 0) ! temperature index is valid
call ocean_model_get_prog_tracer(Ocean_State,tracer_index, T, isc, jsc)

!!ALT: Note that we modify only top level of T
!! we do not need to worry about temperature units
!! since we are applying difference

!! some relaxation ??? here or in guest ???

T(:,:,1) = T(:,:,1) + DEL_TEMP

call ocean_model_put_prog_tracer(Ocean_State, tracer_index, T)

deallocate(T, __STAT__)

call MAPL_TimerOff(MAPL,"RUN2" )
call MAPL_TimerOff(MAPL,"TOTAL")

! All Done
!---------

RETURN_(ESMF_SUCCESS)
end subroutine Run2

!BOP

!====================================================================
Expand Down
45 changes: 23 additions & 22 deletions MOM6_GEOSPlug/MOM6_GEOSPlug_StateSpecs.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,30 @@ category: IMPORT
#------------------------------------------------------------------------------------
# VARIABLE | DIMENSIONS | Additional Metadata
#------------------------------------------------------------------------------------
NAME | UNITS | DIMS | VLOC | LONG_NAME
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 | 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
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 | | | apressure_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
DEL_TEMP | K | xy | N | DUAL_OCEAN | | temperature correction to top level MOM (Tsst-Tmom)

category: EXPORT
#------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion MOM6_GEOSPlug/mom6_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ endforeach ()

esma_add_library (${this}
SRCS ${SRCS}
DEPENDENCIES FMS::fms_r8
DEPENDENCIES FMS::fms OpenMP::OpenMP_Fortran
INCLUDES
$<BUILD_INTERFACE:${MOM6_path}/config_src/memory/dynamic_nonsymmetric>
# choose above set MOM6_infra interface
Expand Down
3 changes: 0 additions & 3 deletions MOM_GEOS5PlugMod/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions MOM_GEOS5PlugMod/CMakeLists.txt

This file was deleted.

Loading
Loading