Los Alamos Sea Ice (CICE) NUOPC Cap
 All Classes Files Functions Variables Pages
Data Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
cice_cap_mod Module Reference

Data Types

type  cice_internalstate_type
 
type  cice_internalstate_wrapper
 
type  fld_list_type
 

Public Member Functions

subroutine, public setservices (gcomp, rc)
 NUOPC SetService method is the only public entry point. SetServices registers all of the user-provided subroutines in the module with the NUOPC layer. More...
 

Private Member Functions

subroutine initializep0 (gcomp, importState, exportState, clock, rc)
 First initialize subroutine called by NUOPC. The purpose is to set which version of the Initialize Phase Definition (IPD) to use. More...
 
subroutine initializeadvertise (gcomp, importState, exportState, clock, rc)
 Called by NUOPC to advertise import and export fields. "Advertise" simply means that the standard names of all import and export fields are supplied. The NUOPC layer uses these to match fields between components in the coupled system. More...
 
subroutine initializerealize (gcomp, importState, exportState, clock, rc)
 Called by NUOPC to realize import and export fields. "Realizing" a field means that its grid has been defined and an ESMF_Field object has been created and put into the import or export State. More...
 
subroutine setclock (gcomp, rc)
 NUOPC specialization point to set up this cap's clock. More...
 
subroutine modeladvance_slow (gcomp, rc)
 Called by NUOPC to advance the CICE model a single timestep. More...
 
subroutine cice_model_finalize (gcomp, rc)
 Called by NUOPC at the end of the run to clean up. The cap does this simply by calling CICE_Finalize. More...
 
subroutine cice_advertisefields (state, nfields, field_defs, rc)
 Advertises a set of fields in an ESMF_State object by calling NUOPC_Advertise in a loop. More...
 
subroutine cice_realizefields (state, grid, nfields, field_defs, tag, rc)
 Adds a set of fields to an ESMF_State object. Each field is wrapped in an ESMF_Field object. Memory is either allocated by ESMF or an existing CICE pointer is referenced. More...
 
subroutine state_diagnose (State, string, rc)
 
subroutine state_reset (State, value, rc)
 
subroutine state_getfldptr (ST, fldname, fldptr, rc)
 Retrieve a pointer to a field's data array from inside an ESMF_State object. More...
 
logical function fieldbundle_fldchk (FB, fldname, rc)
 
subroutine fieldbundle_getfldptr (FB, fldname, fldptr, rc)
 
subroutine cice_fieldssetup
 
subroutine fld_list_add (num, fldlist, stdname, transferOffer, data, shortname)
 
subroutine dumpciceinternal (grid, slice, stdname, nop, farray)
 Writes out a diagnostic file containing field data named field_ice_internal_<fldname>.nc. More...
 

Private Attributes

integer import_slice = 0
 
integer export_slice = 0
 
integer, parameter fldsmax = 100
 
integer fldstoice_num = 0
 
type(fld_list_type), dimension(fldsmaxfldstoice
 
integer fldsfrice_num = 0
 
type(fld_list_type), dimension(fldsmaxfldsfrice
 
integer lsize
 
character(len=256) tmpstr
 
character(len=2048) info
 
logical ispresent
 
integer dbrc
 
type(esmf_grid), save ice_grid_i
 
logical write_diagnostics = .true.
 
logical profile_memory = .true.
 

Member Function/Subroutine Documentation

subroutine cice_cap_mod::cice_advertisefields ( type(esmf_state), intent(inout)  state,
integer, intent(in)  nfields,
type(fld_list_type), dimension(:), intent(inout)  field_defs,
integer, intent(inout)  rc 
)
private

Advertises a set of fields in an ESMF_State object by calling NUOPC_Advertise in a loop.

Parameters
statethe ESMF_State object in which to advertise the fields
nfieldsnumber of fields
field_defsan array of fld_list_type listing the fields to advertise
rcreturn code
subroutine cice_cap_mod::cice_fieldssetup ( )
private
subroutine cice_cap_mod::cice_model_finalize ( type(esmf_gridcomp)  gcomp,
integer, intent(out)  rc 
)
private

Called by NUOPC at the end of the run to clean up. The cap does this simply by calling CICE_Finalize.

Parameters
gcompthe ESMF_GridComp object
rcreturn code
subroutine cice_cap_mod::cice_realizefields ( type(esmf_state), intent(inout)  state,
type(esmf_grid), intent(in)  grid,
integer, intent(in)  nfields,
type(fld_list_type), dimension(:), intent(inout)  field_defs,
character(len=*), intent(in)  tag,
integer, intent(inout)  rc 
)
private

Adds a set of fields to an ESMF_State object. Each field is wrapped in an ESMF_Field object. Memory is either allocated by ESMF or an existing CICE pointer is referenced.

Parameters
statethe ESMF_State object to add fields to
gridthe ESMF_Grid object on which to define the fields
nfieldsnumber of fields
field_defsarray of fld_list_type indicating the fields to add
tagused to output to the log
rcreturn code
subroutine cice_cap_mod::dumpciceinternal ( type(esmf_grid)  grid,
integer, intent(in)  slice,
character(len=*)  stdname,
character(len=*)  nop,
real(esmf_kind_r8), dimension(:,:,:), target  farray 
)
private

Writes out a diagnostic file containing field data named field_ice_internal_<fldname>.nc.

Parameters
gridthe ESMF_Grid on describing the field's grid
slicetime spice number
stdnamestandard name of the field
nopignored for now
farrayarray of data to write
logical function cice_cap_mod::fieldbundle_fldchk ( type(esmf_fieldbundle), intent(in)  FB,
character(len=*), intent(in)  fldname,
integer, intent(out), optional  rc 
)
private
subroutine cice_cap_mod::fieldbundle_getfldptr ( type(esmf_fieldbundle), intent(in)  FB,
character(len=*), intent(in)  fldname,
real(esmf_kind_r8), dimension(:,:), intent(in), pointer  fldptr,
integer, intent(out), optional  rc 
)
private
subroutine cice_cap_mod::fld_list_add ( integer, intent(inout)  num,
type(fld_list_type), dimension(:), intent(inout)  fldlist,
character(len=*), intent(in)  stdname,
character(len=*), intent(in)  transferOffer,
real(esmf_kind_r8), dimension(:,:,:), optional, target  data,
character(len=*), intent(in), optional  shortname 
)
private
subroutine cice_cap_mod::initializeadvertise ( type(esmf_gridcomp)  gcomp,
type(esmf_state)  importState,
type(esmf_state)  exportState,
type(esmf_clock)  clock,
integer, intent(out)  rc 
)
private

Called by NUOPC to advertise import and export fields. "Advertise" simply means that the standard names of all import and export fields are supplied. The NUOPC layer uses these to match fields between components in the coupled system.

Parameters
gcompan ESMF_GridComp object
importStatean ESMF_State object for import fields
exportStatean ESMF_State object for export fields
clockan ESMF_Clock object
rcreturn code
subroutine cice_cap_mod::initializep0 ( type(esmf_gridcomp)  gcomp,
type(esmf_state)  importState,
type(esmf_state)  exportState,
type(esmf_clock)  clock,
integer, intent(out)  rc 
)
private

First initialize subroutine called by NUOPC. The purpose is to set which version of the Initialize Phase Definition (IPD) to use.

For this CICE cap, we are using IPDv01.

Parameters
gcompan ESMF_GridComp object
importStatean ESMF_State object for import fields
exportStatean ESMF_State object for export fields
clockan ESMF_Clock object
rcreturn code
subroutine cice_cap_mod::initializerealize ( type(esmf_gridcomp)  gcomp,
type(esmf_state)  importState,
type(esmf_state)  exportState,
type(esmf_clock)  clock,
integer, intent(out)  rc 
)
private

Called by NUOPC to realize import and export fields. "Realizing" a field means that its grid has been defined and an ESMF_Field object has been created and put into the import or export State.

CICE defines its own parallel decomposition in 2D blocks. The indices are stored in i_glob and j_glob. These are used to create an ESMF_DistGrid object using the deBlockList parameter. The ESMF_DistGrid is set up with a periodic boundary condition in the first (X) dimension and bipolar boundary condition at the top row. These are set using calls to ESMF_DistGridConnectionSet. Information about how the decomposition blocks are distributed among processors is determined by a call to ice_distributionGetBlockLoc().

Geographic coordinates are added to the ESMF_Grid object at center and corner stagger locations. CICE maintains these coordinates in radians in the TLON, TLAT, ULON, and ULAT arrays. They are converted to degrees before adding to the ESMF_Grid object. Cell areas are set based on the CICE tarea array and cell masks are set based on the hm array.

The fields to import and export are stored in the fldsToIce and fldsFrIce arrays, respectively. Each field entry includes the standard name, information about whether the field's grid will be provided by the cap, and optionally a pointer to the field's data array. Currently, all fields are defined on the same grid defined by the cap (so set to "will provide"). The fields are created by calling cice_cap_mod::cice_realizefields.

Parameters
gcompan ESMF_GridComp object
importStatean ESMF_State object for import fields
exportStatean ESMF_State object for export fields
clockan ESMF_Clock object
rcreturn code
subroutine cice_cap_mod::modeladvance_slow ( type(esmf_gridcomp)  gcomp,
integer, intent(out)  rc 
)
private

Called by NUOPC to advance the CICE model a single timestep.

This subroutine copies field data out of the cap import state and into the model internal arrays. Then it calls CICE_Run to make a single timestep. Finally, it copies the updated arrays into the cap export state.

This routine also writes out a diagnostic file for each import and export field using NUOPC_FieldWrite. The files are named field_ice_import_<fldname>.nc and field_ice_export_<fldname>.nc, respectively. In this subroutine there are numerous calls to cice_cap_mod::state_getfldptr which is a convenience function to retrieve the data pointer from an ESMF_State object based on the field's name.

All incoming vectors from mediator are rotated counter clock wise onto local basis vector directions. All outgoing vectors to mediator are rotated clock wise onto regular lat-lon directions. Zonal and meridional sea surface slope fields are calculated from sea level input and rotated counter clock wise onto local basis vector directions. Internally LANL cice uses the zonal and meridional sea surface slope fields calculated here.

At the end of the subroutine, a series of calls is made to cice_cap_mod::dumpciceinternal which writes out a time slice of each CICE internal variable for diagnostic purposes.

Parameters
gcompan ESMF_GridComp object
rcreturn code
subroutine cice_cap_mod::setclock ( type(esmf_gridcomp)  gcomp,
integer, intent(out)  rc 
)
private

NUOPC specialization point to set up this cap's clock.

By default, the clock is a copy of the clock coming in from the NUOPC Driver. In this case we are pulling in the thermodynamic timestep from the CICE model (dt) an setting that as the "stability timestep." This ensures that if dt is smaller than the Driver's requested timestep length, it will use dt instead. In this case, subcycling is automatically handled by NUOPC, e.g., the CICE model will potentially be called multiple times until it reaches the coupling timestep requested by the Driver.

subroutine, public cice_cap_mod::setservices ( type(esmf_gridcomp)  gcomp,
integer, intent(out)  rc 
)

NUOPC SetService method is the only public entry point. SetServices registers all of the user-provided subroutines in the module with the NUOPC layer.

Parameters
gcompan ESMF_GridComp object
rcreturn code
subroutine cice_cap_mod::state_diagnose ( type(esmf_state), intent(inout)  State,
character(len=*), intent(in), optional  string,
integer, intent(out), optional  rc 
)
private
subroutine cice_cap_mod::state_getfldptr ( type(esmf_state), intent(in)  ST,
character(len=*), intent(in)  fldname,
real(esmf_kind_r8), dimension(:,:,:), intent(in), pointer  fldptr,
integer, intent(out), optional  rc 
)
private

Retrieve a pointer to a field's data array from inside an ESMF_State object.

Parameters
STthe ESMF_State object
fldnamename of the fields
fldptrpointer to 3D array
rcreturn code
subroutine cice_cap_mod::state_reset ( type(esmf_state), intent(inout)  State,
real(esmf_kind_r8), intent(in), optional  value,
integer, intent(out), optional  rc 
)
private

Member Data Documentation

integer cice_cap_mod::dbrc
private
integer cice_cap_mod::export_slice = 0
private
type (fld_list_type), dimension(fldsmax) cice_cap_mod::fldsfrice
private
integer cice_cap_mod::fldsfrice_num = 0
private
integer, parameter cice_cap_mod::fldsmax = 100
private
type (fld_list_type), dimension(fldsmax) cice_cap_mod::fldstoice
private
integer cice_cap_mod::fldstoice_num = 0
private
type(esmf_grid), save cice_cap_mod::ice_grid_i
private
integer cice_cap_mod::import_slice = 0
private
character(len=2048) cice_cap_mod::info
private
logical cice_cap_mod::ispresent
private
integer cice_cap_mod::lsize
private
logical cice_cap_mod::profile_memory = .true.
private
character(len=256) cice_cap_mod::tmpstr
private
logical cice_cap_mod::write_diagnostics = .true.
private

The documentation for this module was generated from the following file: