<p><b>akt@lanl.gov</b> 2013-01-31 14:37:47 -0700 (Thu, 31 Jan 2013)</p><p>Ported first CICE subroutine into test module<br>
</p><hr noshade><pre><font color="gray">Modified: branches/cice_projects/initial_cice_core/src/core_cice/Makefile
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/Makefile        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/Makefile        2013-01-31 21:37:47 UTC (rev 2408)
@@ -1,23 +1,35 @@
 .SUFFIXES: .F .o
 
-OBJS =        mpas_cice_convert_to_CICE.o \
+OBJS =        mpas_cice_kinds_mod.o \
+        mpas_cice_constants.o \
+        mpas_cice_domain_size.o \
+        mpas_cice_state.o \
+        mpas_cice_test.o \
         mpas_cice_init.o \
         mpas_cice_timestep.o \
-        pas_cice_mpas_core.o 
+        mpas_cice_mpas_core.o 
 
 all: core_cice
 
 core_cice: $(OBJS)
         ar -ru libdycore.a $(OBJS)
 
-mpas_cice_convert_to_CICE.o:
+mpas_cice_kinds_mod.o:
 
-mpas_cice_init.o: mpas_cice_convert_to_CICE.o
+mpas_cice_constants.o: mpas_cice_kinds_mod.o
 
-mpas_cice_timestep.o: mpas_cice_convert_to_CICE.o 
+mpas_cice_domain_size.o: mpas_cice_kinds_mod.o
 
-mpas_cice_mpas_core.o: mpas_cice_init.o mpas_cice_timestep.o
+mpas_cice_state.o: mpas_cice_kinds_mod.o mpas_cice_domain_size.o
 
+mpas_cice_init.o: mpas_cice_state.o
+
+mpas_cice_test.o: mpas_cice_kinds_mod.o mpas_cice_constants.o
+
+mpas_cice_timestep.o: mpas_cice_kinds_mod.o mpas_cice_test.o 
+
+mpas_cice_mpas_core.o: mpas_cice_test.o mpas_cice_init.o mpas_cice_timestep.o
+
 clean:
         $(RM) *.o *.mod *.f90 libdycore.a
 

Modified: branches/cice_projects/initial_cice_core/src/core_cice/Registry
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/Registry        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/Registry        2013-01-31 21:37:47 UTC (rev 2408)
@@ -36,9 +36,9 @@
 dim vertexDegree vertexDegree
 dim nVertLevels nVertLevels
 dim nTracers nTracers
-dim nCategories 1
-dim nIceLayers 4
-dim nSnowLayers 1
+dim nCategories nCategories
+dim nIceLayers nIceLayers
+dim nSnowLayers nSnowLayers
 
 %
 % var persistence type  name_in_file  ( dims )  time_levs iro-  name_in_code struct super-array array_class
@@ -128,10 +128,10 @@
 var persistent real    snowVolumeCategory ( nCells nCategories ) 0 - snowVolumeCategory states - -
 
 % tracers
-var persistent real    iceEnthalpy ( nIceLayers nCells nCategories ) 0 - iceEnthalpy tracer iceVolumeLayerTracers tracers
-var persistent real    iceSalinity ( nIceLayers nCells nCategories ) 0 - iceSalinity tracer iceVolumeLayerTracers tracers
-var persistent real    snowEnthalpy ( nSnowLayers nCells nCategories ) 0 - snowEnthalpy tracer - -
-% snowVolumeLayerTracers tracers
+var persistent real    iceEnthalpy ( nIceLayers nCategories nCells ) 0 - iceEnthalpy tracer iceVolumeLayerTracers tracers
+var persistent real    iceSalinity ( nIceLayers nCategories nCells ) 0 - iceSalinity tracer iceVolumeLayerTracers tracers
+var persistent real    snowEnthalpy ( nSnowLayers nCategories nCells ) 0 - snowEnthalpy tracer snowVolumeLayerTracers wibble
+var persistent real    snowSalinity ( nSnowLayers nCategories nCells ) 0 - snowSalinity tracer snowVolumeLayerTracers wibble
 
 % flux
 var persistent real    seaSurfaceTemperature ( nCells ) 0 - seaSurfaceTemperature flux - -

Added: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_constants.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_constants.F                                (rev 0)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_constants.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -0,0 +1,242 @@
+!=======================================================================
+!BOP
+!
+! !MODULE: ice_constants - sets physical constants
+!
+! !DESCRIPTION:
+!
+! This module defines a variety of physical and numerical constants
+! used throughout the ice model \\
+!
+! Code originally based on constants.F in POP
+!
+! !REVISION HISTORY:
+!  SVN:$Id: ice_constants.F90 567 2013-01-07 02:57:36Z eclare $
+!
+! author Elizabeth C. Hunke, LANL
+!
+! !INTERFACE:
+
+      module cice_constants
+!
+! !USES:
+!
+      use cice_kinds_mod
+!
+!EOP
+!
+      implicit none
+      !save
+
+      !-----------------------------------------------------------------
+      ! physical constants
+      !-----------------------------------------------------------------
+
+#ifdef AOMIP
+      real (kind=dbl_kind), parameter :: &amp;
+         rhos      = 300.0_dbl_kind   ,&amp;! density of snow (kg/m^3)
+         rhoi      = 900.0_dbl_kind   ,&amp;! density of ice (kg/m^3)
+         rhow      = 1025.0_dbl_kind  ,&amp;! density of seawater (kg/m^3)
+         cp_air    = 1004.0_dbl_kind  ,&amp;! specific heat of air (J/kg/K)
+         emissivity= 0.98_dbl_kind    ,&amp;! emissivity of snow and ice
+         cp_ice    = 2090._dbl_kind   ,&amp;! specific heat of fresh ice (J/kg/K)
+         cp_brine  = 4650._dbl_kind   ,&amp;! specific heat of brine (J/kg/K) 
+                                        ! from Taylor and Feltham (2004)
+         cp_ocn    = 4190._dbl_kind   ,&amp;! specific heat of ocn    (J/kg/K)
+         depressT  = 0.0575_dbl_kind  ,&amp;! Tf:brine salinity ratio (C/ppt)
+         dragio    = 0.0055_dbl_kind  ,&amp;! ice-ocn drag coefficient
+         albocn    = 0.10_dbl_kind      ! ocean albedo
+#else
+! CICE default parameters
+      real (kind=dbl_kind), parameter :: &amp;
+         rhos      = 330.0_dbl_kind   ,&amp;! density of snow (kg/m^3)
+         rhoi      = 917.0_dbl_kind   ,&amp;! density of ice (kg/m^3)
+         rhow      = 1026.0_dbl_kind  ,&amp;! density of seawater (kg/m^3)
+         cp_air    = 1005.0_dbl_kind  ,&amp;! specific heat of air (J/kg/K)
+         ! (Briegleb JGR 97 11475-11485  July 1992)
+         emissivity= 0.95_dbl_kind    ,&amp;! emissivity of snow and ice
+         cp_ice    = 2106._dbl_kind   ,&amp;! specific heat of fresh ice (J/kg/K)
+         cp_ocn    = 4218._dbl_kind   ,&amp;! specific heat of ocn    (J/kg/K)
+                                        ! freshwater value needed for enthalpy
+         depressT  = 0.054_dbl_kind   ,&amp;! Tf:brine salinity ratio (C/ppt)
+         dragio    = 0.00536_dbl_kind ,&amp;! ice-ocn drag coefficient
+         albocn    = 0.06_dbl_kind      ! ocean albedo
+#endif
+
+! UNESCO melting temperature parameters
+      real (kind=dbl_kind), parameter :: &amp;
+         mlt_a     = 0.0575_dbl_kind       ,&amp; !nonlinear melting T coefficient (oC/ppt)
+         mlt_b     = 1.710523e-3_dbl_kind  ,&amp; !(oC/ppt^(3/2))
+         mlt_c     = 2.154996e-4_dbl_kind     !(oC/ppt^2)
+          
+
+      real (kind=dbl_kind), parameter :: &amp;
+         gravit    = 9.80616_dbl_kind    ,&amp;! gravitational acceleration (m/s^2)
+         omega     = 7.292e-5_dbl_kind   ,&amp;! angular velocity of earth (rad/sec)
+         radius    = 6.37e6_dbl_kind       ! earth radius (m)
+
+      real (kind=dbl_kind), parameter :: &amp;
+         pi = 3.14159265358979323846_dbl_kind,&amp;! pi
+         secday    = 86400.0_dbl_kind ,&amp;! seconds in calendar day
+         Tocnfrz   = -1.8_dbl_kind    ,&amp;! freezing temp of seawater (C),
+                                        ! used as Tsfcn for open water
+         rhofresh  = 1000.0_dbl_kind  ,&amp;! density of fresh water (kg/m^3)
+         zvir      = 0.606_dbl_kind   ,&amp;! rh2o/rair - 1.0
+         vonkar    = 0.4_dbl_kind     ,&amp;! von Karman constant
+         cp_wv     = 1.81e3_dbl_kind  ,&amp;! specific heat of water vapor (J/kg/K)
+         stefan_boltzmann = 567.0e-10_dbl_kind,&amp;!  W/m^2/K^4
+         Tffresh   = 273.15_dbl_kind  ,&amp;! freezing temp of fresh ice (K)
+         Lsub      = 2.835e6_dbl_kind ,&amp;! latent heat, sublimation freshwater (J/kg)
+         Lvap      = 2.501e6_dbl_kind ,&amp;! latent heat, vaporization freshwater (J/kg)
+         Lfresh    = Lsub-Lvap        ,&amp;! latent heat of melting of fresh ice (J/kg)
+         Timelt    = 0.0_dbl_kind     ,&amp;! melting temperature, ice top surface  (C)
+         Tsmelt    = 0.0_dbl_kind     ,&amp;! melting temperature, snow top surface (C)
+         ice_ref_salinity = 4._dbl_kind ,&amp;! (ppt)
+!        ocn_ref_salinity = 34.7_dbl_kind,&amp;! (ppt)
+!        rho_air   = 1.2_dbl_kind     ,&amp;! ambient air density (kg/m^3)
+         spval_dbl = 1.0e30_dbl_kind    ! special value (double precision)
+
+      real (kind=real_kind), parameter :: &amp;
+         spval     = 1.0e30_real_kind   ! special value for netCDF output
+
+      real (kind=dbl_kind), parameter :: &amp;
+         iceruf   = 0.0005_dbl_kind   ,&amp;! ice surface roughness (m)
+
+         ! (Ebert, Schramm and Curry JGR 100 15965-15975 Aug 1995)
+         kappav = 1.4_dbl_kind ,&amp;! vis extnctn coef in ice, wvlngth&lt;700nm (1/m)
+         kappan = 17.6_dbl_kind,&amp;! vis extnctn coef in ice, wvlngth&lt;700nm (1/m)
+
+         kice   = 2.03_dbl_kind  ,&amp;! thermal conductivity of fresh ice(W/m/deg)
+         kseaice= 2.00_dbl_kind  ,&amp;! thermal conductivity of sea ice (W/m/deg)
+                                   ! (used in zero layer thermodynamics option)
+         ksno   = 0.30_dbl_kind  ,&amp;! thermal conductivity of snow  (W/m/deg)
+         zref   = 10._dbl_kind   ,&amp;! reference height for stability (m)
+         hsmin  = 0.0001_dbl_kind,&amp;! minimum allowed snow depth (m) for DE
+         snowpatch = 0.02_dbl_kind,&amp;! parameter for fractional snow area (m)
+         salt_loss = 0.65_dbl_kind ! zbgc fraction of available salt retained (1.0 = no loss)
+                    
+      ! weights for albedos 
+! 4 Jan 2007 BPB  Following are appropriate for complete cloud
+! in a summer polar atmosphere with 1.5m bare sea ice surface:
+! .636/.364 vis/nir with only 0.5% direct for each band.
+      real (kind=dbl_kind), parameter :: &amp;           ! currently used only
+         awtvdr = 0.00318_dbl_kind, &amp;! visible, direct  ! for history and
+         awtidr = 0.00182_dbl_kind, &amp;! near IR, direct  ! diagnostics
+         awtvdf = 0.63282_dbl_kind, &amp;! visible, diffuse
+         awtidf = 0.36218_dbl_kind   ! near IR, diffuse
+
+      real (kind=dbl_kind), parameter :: &amp;
+         qqqice  = 11637800._dbl_kind   ,&amp;! for qsat over ice
+         TTTice  = 5897.8_dbl_kind      ,&amp;! for qsat over ice
+         qqqocn  = 627572.4_dbl_kind    ,&amp;! for qsat over ocn
+         TTTocn  = 5107.4_dbl_kind        ! for qsat over ocn
+
+      ! these are currently set so as to have no effect on the decomposition
+      real (kind=dbl_kind), parameter :: &amp;
+         shlat  =  30.0_dbl_kind   ,&amp;! artificial masking edge (deg)
+         nhlat  = -30.0_dbl_kind     ! artificial masking edge (deg)
+   
+      !-----------------------------------------------------------------
+      ! numbers
+      !-----------------------------------------------------------------
+
+      real (kind=dbl_kind), parameter :: &amp;
+        c0   = 0.0_dbl_kind, &amp;
+        c1   = 1.0_dbl_kind, &amp;
+        c1p5 = 1.5_dbl_kind, &amp;
+        c2   = 2.0_dbl_kind, &amp;
+        c3   = 3.0_dbl_kind, &amp;
+        c4   = 4.0_dbl_kind, &amp;
+        c5   = 5.0_dbl_kind, &amp;
+        c6   = 6.0_dbl_kind, &amp;
+        c8   = 8.0_dbl_kind, &amp;
+        c9   = 9.0_dbl_kind, &amp;
+        c10  = 10.0_dbl_kind, &amp;
+        c12  = 12.0_dbl_kind, &amp;
+        c15  = 15.0_dbl_kind, &amp;
+        c16  = 16.0_dbl_kind, &amp;
+        c20  = 20.0_dbl_kind, &amp;
+        c25  = 25.0_dbl_kind, &amp;
+        c30  = 30.0_dbl_kind, &amp;
+        c100 = 100.0_dbl_kind, &amp;
+        c180 = 180.0_dbl_kind, &amp;
+        c360 = 360.0_dbl_kind, &amp;
+        c365 = 365.0_dbl_kind, &amp;
+        c400 = 400.0_dbl_kind, &amp;
+        c3600= 3600.0_dbl_kind, &amp;
+        c1000= 1000.0_dbl_kind, &amp;
+        p001 = 0.001_dbl_kind, &amp;
+        p01  = 0.01_dbl_kind, &amp;
+        p025 = 0.025_dbl_kind, &amp;
+        p1   = 0.1_dbl_kind, &amp;
+        p2   = 0.2_dbl_kind, &amp;
+        p4   = 0.4_dbl_kind, &amp;
+        p5   = 0.5_dbl_kind, &amp;
+        p6   = 0.6_dbl_kind, &amp;
+        p05  = 0.05_dbl_kind, &amp;
+        p15  = 0.15_dbl_kind, &amp;
+        p25  = 0.25_dbl_kind, &amp;
+        p75  = 0.75_dbl_kind, &amp;
+        p166 = c1/c6, &amp;
+        p333 = c1/c3, &amp;
+        p666 = c2/c3, &amp;
+        p111 = c1/c9, &amp;
+        p055 = p111*p5, &amp;
+        p027 = p055*p5, &amp;
+        p222 = c2/c9, &amp;
+        eps11  = 1.0e-11_dbl_kind, &amp;
+        eps13  = 1.0e-13_dbl_kind, &amp;
+        eps16  = 1.0e-16_dbl_kind, &amp;
+        puny   = eps11, &amp;
+        bignum = 1.0e+30_dbl_kind, &amp;
+        pih    = p5*pi, &amp;
+        piq    = p5*pih, &amp;
+        pi2    = c2*pi, &amp;
+        days_per_4c = 146097.0_dbl_kind, &amp;
+        days_per_c  = 36524.0_dbl_kind,  &amp;
+        days_per_4y = 1461.0_dbl_kind,   &amp;
+        days_per_y  = 365.0_dbl_kind
+
+      !-----------------------------------------------------------------
+      ! location of fields for staggered grids
+      !-----------------------------------------------------------------
+
+      integer (int_kind), parameter :: &amp;   
+        field_loc_unknown  =  0, &amp; 
+        field_loc_noupdate = -1, &amp; 
+        field_loc_center   =  1, &amp; 
+        field_loc_NEcorner =  2, &amp; 
+        field_loc_Nface    =  3, &amp; 
+        field_loc_Eface    =  4, &amp;
+        field_loc_Wface    =  5
+
+
+      !-----------------------------------------------------------------
+      ! field type attribute - necessary for handling
+      ! changes of direction across tripole boundary
+      !-----------------------------------------------------------------
+
+      integer (int_kind), parameter :: &amp;   
+        field_type_unknown  =  0, &amp; 
+        field_type_noupdate = -1, &amp; 
+        field_type_scalar   =  1, &amp; 
+        field_type_vector   =  2, &amp; 
+        field_type_angle    =  3
+
+      !-----------------------------------------------------------------
+      ! conversion factors
+      !-----------------------------------------------------------------
+
+      real (kind=dbl_kind), parameter :: &amp;
+        cm_to_m       = 0.01_dbl_kind   ,&amp;! cm to meters
+        m_to_cm       = 100._dbl_kind   ,&amp;! meters to cm
+        m2_to_km2     = 1.e-6_dbl_kind  ,&amp;! m^2 to km^2
+        kg_to_g       = 1000._dbl_kind  ,&amp;! kilograms to grams
+        mps_to_cmpdy  = 8.64e6_dbl_kind ,&amp;! m per s to cm per day
+        rad_to_deg    = 180._dbl_kind/pi  ! degree-radian conversion
+
+!=======================================================================
+
+      end module cice_constants
+
+!=======================================================================

Deleted: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_convert_to_CICE.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_convert_to_CICE.F        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_convert_to_CICE.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -1,48 +0,0 @@
-module cice_convert_to_CICE
-
-  implicit none
-
-  ! vertical layer numbers
-  integer :: &amp;
-       nilyr , &amp;
-       nslyr
-
-  ! number of tracers
-  integer :: ntrcr
-
-  ! tracer array start positions
-  integer :: &amp;
-       nt_Tsfc , &amp;
-       nt_qice , &amp;
-       nt_qsno
-
-
-
-
-contains
-
-  !-------------------------------------------------------------------------
-
-  subroutine init_convert_to_CICE(domain)
-
-    type (domain_type), intent(in) :: domain 
-
-    ! vertical layer numbers
-    nilyr = domain % blocklist % mesh % nIceLayers
-    nslyr = domain % blocklist % mesh % nSnowLayers
-
-    ! tracer array start positions and tracer number
-    nt_Tsfc = 1           ! index tracers, starting with Tsfc = 1
-    ntrcr = 1             ! count tracers, starting with Tsfc = 1
-    
-    nt_qice = ntrcr + 1
-    ntrcr = ntrcr + nilyr ! qice in nilyr layers
-    
-    nt_qsno = ntrcr + 1
-    ntrcr = ntrcr + nslyr ! qsno in nslyr layers
-
-  end subroutine init_convert_to_CICE
-
-  !-------------------------------------------------------------------------
-
-end module cice_convert_to_CICE

Added: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_domain_size.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_domain_size.F                                (rev 0)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_domain_size.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -0,0 +1,102 @@
+!=======================================================================
+!BOP
+!
+! !MODULE: ice_domain_size
+!
+! !DESCRIPTION:
+!
+! Defines the global domain size and number of categories and layers.
+! Code originally based on domain_size.F in POP
+!
+! !REVISION HISTORY:
+!  SVN:$Id: ice_domain_size.F90 574 2013-01-13 16:20:47Z eclare $
+!
+! author Elizabeth C. Hunke, LANL
+! 2004: Block structure and snow parameters added by William Lipscomb
+!       Renamed (used to be ice_model_size)
+! 2006: Converted to free source form (F90) by Elizabeth Hunke
+!       Removed hardwired sizes (NX...can now be set in compile scripts)
+!
+! !INTERFACE:
+!
+      module cice_domain_size
+!
+! !USES:
+!
+      use cice_kinds_mod
+!
+!EOP
+!=======================================================================
+
+      implicit none
+      save
+
+      ! added instead of preprocessor
+      integer (kind=int_kind), parameter :: &amp;
+           NXGLOB  = 1 , &amp; 
+           NYGLOB  = 1 , &amp; 
+           NICECAT = 1 , &amp; 
+           NICELYR = 4 , &amp; 
+           NSNWLYR = 1 , &amp; 
+           NTRAERO = 0 , &amp; 
+           NBGCLYR = 1 , &amp; 
+           TRAGE   = 0 , &amp; 
+           TRFY    = 0 , &amp; 
+           TRLVL   = 0 , &amp; 
+           TRPND   = 0 , &amp; 
+           TRBRI   = 0 , &amp; 
+           BLCKX   = 1 , &amp; 
+           BLCKY   = 1 , &amp; 
+           MXBLCKS = 1
+
+      integer (kind=int_kind), parameter :: &amp;
+        nx_global = NXGLOB    , &amp; ! i-axis size
+        ny_global = NYGLOB    , &amp; ! j-axis size
+        ncat      = NICECAT   , &amp; ! number of categories
+        nilyr     = NICELYR   , &amp; ! number of ice layers per category
+        nslyr     = NSNWLYR   , &amp; ! number of snow layers per category
+        max_aero  =   6       , &amp; ! maximum number of aerosols 
+        n_aero    = NTRAERO   , &amp; ! number of aerosols in use
+
+        nblyr     = NBGCLYR   , &amp; ! number of biology layers per category
+        nblyr_hist = nblyr+2  , &amp; ! number of ice layer plus boundary points
+        nltrcr    = 6         , &amp; ! number of layer bgc tracers  
+                                  ! number of biology layer tracers      
+        nbltrcr   = 1         , &amp; ! 4 basic bio;  1 nitrate only 
+
+                                  ! number of tracers (defined in ice_init)
+        max_ntrcr =   1         &amp; ! 1 = surface temperature              
+                  + nilyr       &amp; ! ice salinity
+                  + nilyr       &amp; ! ice enthalpy
+                  + nslyr       &amp; ! snow enthalpy
+                              !!!!! optional tracers:
+                  + TRAGE       &amp; ! age
+                  + TRFY        &amp; ! first-year area
+                  + TRLVL*2     &amp; ! level/deformed ice
+                  + TRPND*3     &amp; ! ponds
+                  + n_aero*4    &amp; ! number of aerosols * 4 aero layers
+                  + TRBRI       &amp; ! brine height
+                  + TRBRI*nltrcr*nblyr,&amp;! zbgc (off if TRBRI=0)
+        max_nstrm =   5           ! max number of history output streams
+
+      integer (kind=int_kind), parameter :: &amp;
+        block_size_x = BLCKX  , &amp; ! size of block in first horiz dimension
+        block_size_y = BLCKY      ! size of block in second horiz dimension
+
+   !*** The model will inform the user of the correct
+   !*** values for the parameter below.  A value higher than
+   !*** necessary will not cause the code to fail, but will
+   !*** allocate more memory than is necessary.  A value that
+   !*** is too low will cause the code to exit.  
+   !*** A good initial guess is found using
+   !*** max_blocks = (nx_global/block_size_x)*(ny_global/block_size_y)/
+   !***               num_procs

+      integer (kind=int_kind), parameter :: &amp;
+        max_blocks = MXBLCKS      ! max number of blocks per processor
+
+!=======================================================================
+
+      end module cice_domain_size
+
+!=======================================================================

Modified: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_init.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_init.F        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_init.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -7,15 +7,12 @@
 
   !-------------------------------------------------------------------------
   
-  subroutine init_data(domain)
+  subroutine init_data()
 
-    use cice_convert_to_CICE
+    use cice_state
 
-    type (domain_type), intent(in) :: domain 
+    call init_cice_state()
 
-    init_convert_to_CICE(domain)
-
-
   end subroutine init_data
 
   !-------------------------------------------------------------------------

Added: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_kinds_mod.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_kinds_mod.F                                (rev 0)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_kinds_mod.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -0,0 +1,42 @@
+!=======================================================================
+!BOP
+!
+! !MODULE: ice_kinds_mod - defines variable precision
+!
+! !DESCRIPTION:
+!
+! Defines variable precision for all common data types \\
+! Code originally based on kinds_mod.F in POP
+!
+! !REVISION HISTORY:
+!  SVN:$Id: ice_kinds_mod.F90 140 2008-07-25 20:15:53Z eclare $
+!
+! author: Elizabeth C. Hunke and William H. Lipscomb, LANL
+! 2006: ECH converted to free source form (F90)
+!
+! !INTERFACE:
+!
+      module cice_kinds_mod
+!
+! !USES:
+!
+!EOP
+!=======================================================================
+
+      use mpas_kind_types
+
+      implicit none
+
+      integer, parameter :: char_len  = 80, &amp;
+                            char_len_long  = 256, &amp;
+                            log_kind  = kind(.true.), &amp;
+                            int_kind  = kind(1), &amp;
+                            real_kind = RKIND, &amp;
+                            dbl_kind  = RKIND, &amp;
+                            r16_kind  = selected_real_kind(26)
+
+!=======================================================================
+
+      end module cice_kinds_mod
+
+!=======================================================================

Modified: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_mpas_core.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_mpas_core.F        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_mpas_core.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -47,7 +47,7 @@
       current_outfile_frames = 0
 
       ! CICE init
-      call init_data(domain)
+      call init_data()
 
    end subroutine mpas_core_init
 

Added: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_state.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_state.F                                (rev 0)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_state.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -0,0 +1,263 @@
+!=======================================================================
+!BOP
+!
+! !MODULE: ice_state - primary state variables
+!
+! !DESCRIPTION:
+!
+! Primary state variables in various configurations
+! Note: other state variables are at the end of this...
+! The primary state variable names are:
+!-------------------------------------------------------------------
+! for each category   aggregated over     units
+!                       categories
+!-------------------------------------------------------------------
+! aicen(i,j,n)         aice(i,j)           ---
+! vicen(i,j,n)         vice(i,j)           m
+! vsnon(i,j,n)         vsno(i,j)           m
+! trcrn(i,j,it,n)      trcr(i,j,it)        
+!
+! Area is dimensionless because aice is the fractional area
+! (normalized so that the sum over all categories, including open
+! water, is 1.0).  That is why vice/vsno have units of m instead of m^3.
+!
+! Variable names follow these rules:
+!
+! (1) For 3D variables (indices i,j,n), write 'ice' or 'sno' or
+!     'sfc' and put an 'n' at the end.
+! (2) For 2D variables (indices i,j) aggregated over all categories,
+!     write 'ice' or 'sno' or 'sfc' without the 'n'.
+! (3) For 2D variables (indices i,j) associated with an individual
+!     category, write 'i' or 's' instead of 'ice' or 'sno' and put an 'n'
+!     at the end: e.g. hin, hsn.  These are not declared here
+!     but in individual modules (e.g., ice_therm_vertical).
+!
+! !REVISION HISTORY:
+!  SVN:$Id: ice_state.F90 567 2013-01-07 02:57:36Z eclare $
+!
+! authors C. M. Bitz, UW
+!         Elizabeth C. Hunke and William H. Lipscomb, LANL
+!
+! 2004: Block structure added by William Lipscomb
+! 2006: Converted to free form source (F90) by Elizabeth Hunke
+!
+! !INTERFACE:
+!
+      module cice_state
+!
+! !USES:
+!
+      use cice_kinds_mod
+      use cice_domain_size
+      !use ice_blocks
+!
+!EOP
+!
+      implicit none
+      save
+
+      !-----------------------------------------------------------------
+      ! state of the ice aggregated over all categories
+      !-----------------------------------------------------------------
+
+      !real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: &amp;
+      !   aice  , &amp; ! concentration of ice
+      !   vice  , &amp; ! volume per unit area of ice          (m)
+      !   vsno      ! volume per unit area of snow         (m)
+
+      !real (kind=dbl_kind), &amp;
+      !   dimension(nx_block,ny_block,max_ntrcr,max_blocks) :: &amp;
+      !   trcr      ! ice tracers
+                   ! 1: surface temperature of ice/snow (C)
+
+      !-----------------------------------------------------------------
+      ! state of the ice for each category
+      !-----------------------------------------------------------------
+
+      !real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks):: &amp;
+      !   aice0     ! concentration of open water
+
+      !real (kind=dbl_kind), &amp;
+      !   dimension (nx_block,ny_block,ncat,max_blocks) :: &amp;
+      !   aicen , &amp; ! concentration of ice
+      !   vicen , &amp; ! volume per unit area of ice          (m)
+      !   vsnon     ! volume per unit area of snow         (m)
+
+      !real (kind=dbl_kind), &amp;
+      !   dimension (nx_block,ny_block,max_ntrcr,ncat,max_blocks) :: &amp;
+      !   trcrn     ! tracers
+                   ! 1: surface temperature of ice/snow (C)
+
+      !integer (kind=int_kind), dimension (max_ntrcr) :: &amp;
+      !   trcr_depend   ! = 0 for ice area tracers
+                       ! = 1 for ice volume tracers
+                       ! = 2 for snow volume tracers
+
+      integer (kind=int_kind) :: &amp;
+         ntrcr     ! number of tracers in use
+
+      !-----------------------------------------------------------------
+      ! indices and flags for tracers
+      !-----------------------------------------------------------------
+
+      integer (kind=int_kind) ::                      &amp;
+         ntraceb     , &amp;    ! number of bio layer tracers in use                   &amp;
+         ntrace_start       ! index of first bio tracer
+      
+      integer (kind=int_kind) :: &amp;
+         nt_Tsfc  , &amp; ! ice/snow temperature
+         nt_qice  , &amp; ! volume-weighted ice enthalpy (in layers)
+         nt_qsno  , &amp; ! volume-weighted snow enthalpy (in layers)
+         nt_sice  , &amp; ! volume-weighted ice bulk salinity (CICE grid layers)
+         nt_fbri  , &amp; ! volume fraction of ice with dynamic salt (hinS/vicen*aicen)
+         nt_iage  , &amp; ! volume-weighted ice age
+         nt_FY    , &amp; ! area-weighted first-year ice area
+         nt_alvl  , &amp; ! level ice area fraction
+         nt_vlvl  , &amp; ! level ice volume fraction
+         nt_apnd  , &amp; ! melt pond area fraction
+         nt_hpnd  , &amp; ! melt pond depth
+         nt_ipnd  , &amp; ! melt pond refrozen lid thickness
+         nt_aero  , &amp; ! starting index for aerosols in ice
+         nt_bgc_N_sk,   &amp; ! algae (skeletal layer)
+         nt_bgc_C_sk,   &amp; ! 
+         nt_bgc_chl_sk, &amp; ! 
+         nt_bgc_Nit_sk, &amp; ! nutrients (skeletal layer) 
+         nt_bgc_Am_sk,  &amp; ! 
+         nt_bgc_Sil_sk, &amp; !
+         nt_bgc_DMSPp_sk, &amp; ! trace gases (skeletal layer)
+         nt_bgc_DMSPd_sk, &amp; ! 
+         nt_bgc_DMS_sk, &amp; ! 
+         nt_bgc_Nit_ml, &amp; ! nutrients (ocean mixed layer) 
+         nt_bgc_Am_ml,  &amp; ! 
+         nt_bgc_Sil_ml, &amp; !
+         nt_bgc_DMSP_ml, &amp; ! trace gases (ocean mixed layer)
+         nt_bgc_DMS_ml, &amp; !  
+         nt_bgc_N,   &amp; ! algae: bulk quantities are tracers (volume preserved)
+         nt_bgc_C,   &amp; ! 
+         nt_bgc_chl, &amp; ! 
+         nt_bgc_NO,  &amp; ! nutrients  
+         nt_bgc_NH,  &amp; ! 
+         nt_bgc_Sil, &amp; !
+         nt_bgc_DMSPp, &amp; ! trace gases (skeletal layer)
+         nt_bgc_DMSPd, &amp; ! 
+         nt_bgc_DMS, &amp; ! 
+         nt_bgc_PON, &amp; ! zooplankton and detritus  
+         nt_bgc_S      ! Bulk salinity in fraction ice with dynamic salinity (Bio grid) 
+
+      logical (kind=log_kind) :: &amp;
+         tr_iage,   &amp; ! if .true., use age tracer
+         tr_FY,     &amp; ! if .true., use first-year area tracer
+         tr_lvl,    &amp; ! if .true., use level ice tracer
+         tr_pond,   &amp; ! if .true., use melt pond tracer
+         tr_pond_cesm,&amp; ! if .true., use cesm pond tracer
+         tr_pond_lvl, &amp; ! if .true., use level-ice pond tracer
+         tr_pond_topo,&amp; ! if .true., use explicit topography-based ponds
+         tr_aero      ! if .true., use aerosol tracers
+
+      !-----------------------------------------------------------------
+      ! dynamic variables closely related to the state of the ice
+      !-----------------------------------------------------------------
+
+      !real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: &amp;
+      !   uvel     , &amp; ! x-component of velocity (m/s)
+      !   vvel     , &amp; ! y-component of velocity (m/s)
+      !   divu     , &amp; ! strain rate I component, velocity divergence (1/s)
+      !   shear    , &amp; ! strain rate II component (1/s)
+      !   strength     ! ice strength (N/m)
+
+      !-----------------------------------------------------------------
+      ! ice state at start of time step, saved for later in the step 
+      !-----------------------------------------------------------------
+
+      !real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: &amp;
+      !   aice_init       ! initial concentration of ice, for diagnostics
+
+      !real (kind=dbl_kind), &amp;
+      !   dimension(nx_block,ny_block,ncat,max_blocks) :: &amp;
+      !   aicen_init  , &amp; ! initial ice concentration, for linear ITD
+      !   vicen_init      ! initial ice volume (m), for linear ITD
+
+      ! logical (kind=log_kind) :: &amp;
+      !   hbrine          ! if .true., brine height differs from ice thickness
+
+!=======================================================================
+
+      contains
+
+!=======================================================================
+
+        subroutine init_cice_state()
+
+         tr_iage = .false.
+         tr_FY = .false.
+         tr_lvl = .false.
+         tr_pond = .false.
+         tr_pond_cesm = .false.
+         tr_pond_lvl = .false.
+         tr_pond_topo = .false.
+         tr_aero = .false.
+
+         nt_Tsfc = 1           ! index tracers, starting with Tsfc = 1
+         ntrcr = 1             ! count tracers, starting with Tsfc = 1
+
+         nt_qice = ntrcr + 1
+         ntrcr = ntrcr + nilyr ! qice in nilyr layers
+
+         nt_qsno = ntrcr + 1
+         ntrcr = ntrcr + nslyr ! qsno in nslyr layers
+
+         nt_sice = ntrcr + 1
+         ntrcr = ntrcr + nilyr ! sice in nilyr layers
+
+         nt_iage = 0
+         if (tr_iage) then
+             nt_iage = ntrcr + 1   ! chronological ice age
+             ntrcr = ntrcr + 1
+         endif
+
+         nt_FY = 0
+         if (tr_FY) then
+             nt_FY = ntrcr + 1     ! area of first year ice
+             ntrcr = ntrcr + 1
+         endif
+
+         nt_alvl = 0
+         nt_vlvl = 0
+         if (tr_lvl) then
+             nt_alvl = ntrcr + 1
+             ntrcr = ntrcr + 1
+             nt_vlvl = ntrcr + 1
+             ntrcr = ntrcr + 1
+         endif
+
+         nt_apnd = 0
+         nt_hpnd = 0
+         nt_ipnd = 0
+         if (tr_pond) then            ! all explicit melt pond schemes
+             nt_apnd = ntrcr + 1
+             ntrcr = ntrcr + 1
+             nt_hpnd = ntrcr + 1
+             ntrcr = ntrcr + 1
+             if (tr_pond_lvl) then
+                 nt_ipnd = ntrcr + 1  ! refrozen pond ice lid thickness
+                 ntrcr = ntrcr + 1    ! on level-ice ponds (if frzpnd='hlid')
+             endif
+             if (tr_pond_topo) then
+                 nt_ipnd = ntrcr + 1  ! refrozen pond ice lid thickness
+                 ntrcr = ntrcr + 1    ! 
+             endif
+         endif
+
+         nt_aero = 0
+         if (tr_aero) then
+             nt_aero = ntrcr + 1
+             ntrcr = ntrcr + 4*n_aero ! 4 dEdd layers, n_aero species
+         endif
+
+        end subroutine init_cice_state
+
+!=======================================================================
+
+      end module cice_state
+
+!=======================================================================

Added: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_test.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_test.F                                (rev 0)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_test.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -0,0 +1,262 @@
+module cice_test
+
+  use cice_kinds_mod
+  use cice_domain_size
+  use cice_constants
+
+contains
+
+!=======================================================================
+!BOP
+!
+! !ROUTINE: frzmlt_bottom_lateral - bottom and lateral heat fluxes
+!
+! !DESCRIPTION:
+!
+! Adjust frzmlt to account for changes in fhocn since from_coupler.
+! Compute heat flux to bottom surface.
+! Compute fraction of ice that melts laterally.
+!
+! !REVISION HISTORY:
+!
+! authors C. M. Bitz, UW
+!         William H. Lipscomb, LANL
+!         Elizabeth C. Hunke, LANL
+!
+! !INTERFACE:
+!
+      subroutine frzmlt_bottom_lateral (nx_block, ny_block, &amp;
+                                        ilo, ihi, jlo, jhi, &amp;
+                                        ntrcr,    dt,       &amp;
+                                        aice,     frzmlt,   &amp;
+                                        vicen,    vsnon,    &amp;
+                                        trcrn,              &amp;
+                                        sst,      Tf,       &amp;
+                                        strocnxT, strocnyT, &amp;
+                                        Tbot,     fbot,     &amp;
+                                        rside)
+!
+! !USES:
+!
+! !INPUT/OUTPUT PARAMETERS:
+
+      integer (kind=int_kind), intent(in) :: &amp;
+         nx_block, ny_block, &amp; ! block dimensions
+         ilo,ihi,jlo,jhi   , &amp; ! beginning and end of physical domain
+         ntrcr                 ! number of tracers
+
+      real (kind=dbl_kind), intent(in) :: &amp;
+         dt                  ! time step
+
+      real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: &amp;
+         aice    , &amp; ! ice concentration
+         frzmlt  , &amp; ! freezing/melting potential (W/m^2)
+         sst     , &amp; ! sea surface temperature (C)
+         Tf      , &amp; ! freezing temperature (C)
+         strocnxT, &amp; ! ice-ocean stress, x-direction
+         strocnyT    ! ice-ocean stress, y-direction
+
+      real (kind=dbl_kind), dimension(nx_block,ny_block,ncat), &amp;
+         intent(in) :: &amp;
+         vicen   , &amp; ! ice volume (m)
+         vsnon       ! snow volume (m)
+
+      real (kind=dbl_kind), dimension(nx_block,ny_block,ntrcr,ncat), &amp;
+         intent(in) :: &amp;
+         trcrn       ! tracer array
+
+      real (kind=dbl_kind), dimension(nx_block,ny_block), &amp;
+         intent(out) :: &amp;
+         Tbot    , &amp; ! ice bottom surface temperature (deg C)
+         fbot    , &amp; ! heat flux to ice bottom  (W/m^2)
+         rside       ! fraction of ice that melts laterally
+!
+!EOP
+!
+      integer (kind=int_kind) :: &amp;
+         i, j           , &amp; ! horizontal indices
+         n              , &amp; ! thickness category index
+         k              , &amp; ! layer index
+         ij             , &amp; ! horizontal index, combines i and j loops
+         imelt              ! number of cells with ice melting
+
+      integer (kind=int_kind), dimension (nx_block*ny_block) :: &amp;
+         indxi, indxj     ! compressed indices for cells with ice melting
+
+      real (kind=dbl_kind), dimension (:), allocatable :: &amp;
+         etot    , &amp; ! total energy in column
+         fside       ! lateral heat flux (W/m^2)
+
+      real (kind=dbl_kind) :: &amp;
+         deltaT    , &amp; ! SST - Tbot &gt;= 0
+         ustar     , &amp; ! skin friction velocity for fbot (m/s)
+         wlat      , &amp; ! lateral melt rate (m/s)
+         xtmp          ! temporary variable
+
+      ! Parameters for bottom melting
+
+      ! 0.006 = unitless param for basal heat flx ala McPhee and Maykut
+
+      real (kind=dbl_kind), parameter :: &amp;
+         cpchr = -cp_ocn*rhow*0.006_dbl_kind
+
+
+      ! Parameters for lateral melting
+
+      real (kind=dbl_kind), parameter :: &amp;
+         floediam = 300.0_dbl_kind, &amp; ! effective floe diameter (m)
+         alpha    = 0.66_dbl_kind , &amp; ! constant from Steele (unitless)
+         m1 = 1.6e-6_dbl_kind     , &amp; ! constant from Maykut &amp; Perovich
+                                      ! (m/s/deg^(-m2))
+         m2 = 1.36_dbl_kind           ! constant from Maykut &amp; Perovich
+                                      ! (unitless)
+
+      do j = 1, ny_block
+      do i = 1, nx_block
+         rside(i,j) = c0
+         Tbot (i,j) = Tf(i,j)
+         fbot (i,j) = c0
+      enddo
+      enddo
+
+      !-----------------------------------------------------------------
+      ! Identify grid cells where ice can melt.
+      !-----------------------------------------------------------------
+
+      imelt = 0
+      do j = jlo, jhi
+      do i = ilo, ihi
+#if (defined notz_experiment || defined notz_fieldwork)
+         if (aice(i,j) &gt; puny) then
+#else
+         if (aice(i,j) &gt; puny .and. frzmlt(i,j) &lt; c0) then ! ice can melt
+#endif
+            imelt = imelt + 1
+            indxi(imelt) = i
+            indxj(imelt) = j
+         endif
+      enddo                     ! i
+      enddo                     ! j
+
+      allocate(etot (imelt))
+      allocate(fside(imelt))
+
+      do ij = 1, imelt  ! cells where ice can melt
+         i = indxi(ij)
+         j = indxj(ij)
+
+         fside(ij) = c0
+
+      !-----------------------------------------------------------------
+      ! Use boundary layer theory for fbot.
+      ! See Maykut and McPhee (1995): JGR, 100, 24,691-24,703.
+      !-----------------------------------------------------------------
+
+         deltaT = max((sst(i,j)-Tbot(i,j)),c0)
+
+         ! strocnx has units N/m^2 so strocnx/rho has units m^2/s^2
+         ustar = sqrt (sqrt(strocnxT(i,j)**2+strocnyT(i,j)**2)/rhow)
+         ustar = max (ustar,ustar_min)
+
+#if defined notz_experiment
+         fbot(i,j) = c0
+!#elif (defined pond_barrow || defined snowice_maksym)
+!         fbot(i,j) = c0
+#elif defined notz_fieldwork
+         fbot(i,j) = cpchr * deltaT * ustar ! &lt; 0
+#else
+         fbot(i,j) = cpchr * deltaT * ustar ! &lt; 0
+         fbot(i,j) = max (fbot(i,j), frzmlt(i,j)) ! frzmlt &lt; fbot &lt; 0
+#endif
+
+!!! uncomment to use all frzmlt for standalone runs
+   !     fbot(i,j) = min (c0, frzmlt(i,j))
+
+      !-----------------------------------------------------------------
+      ! Compute rside.  See these references:
+      !    Maykut and Perovich (1987): JGR, 92, 7032-7044
+      !    Steele (1992): JGR, 97, 17,729-17,738
+      !-----------------------------------------------------------------
+
+         wlat = m1 * deltaT**m2 ! Maykut &amp; Perovich
+         rside(i,j) = wlat*dt*pi/(alpha*floediam) ! Steele
+         rside(i,j) = max(c0,min(rside(i,j),c1))
+
+      enddo                     ! ij
+
+      !-----------------------------------------------------------------
+      ! Compute heat flux associated with this value of rside.
+      !-----------------------------------------------------------------
+
+      do n = 1, ncat
+
+         do ij = 1, imelt
+            etot(ij) = c0
+         enddo
+
+         ! melting energy/unit area in each column, etot &lt; 0
+
+         do k = 1, nslyr
+!DIR$ CONCURRENT !Cray
+!cdir nodep      !NEC
+!ocl novrec      !Fujitsu
+            do ij = 1, imelt
+               i = indxi(ij)
+               j = indxj(ij)
+               etot(ij) = etot(ij) + trcrn(i,j,nt_qsno+k-1,n) &amp;
+                                   * vsnon(i,j,n)/real(nslyr,kind=dbl_kind)
+            enddo               ! ij
+         enddo
+
+         do k = 1, nilyr
+!DIR$ CONCURRENT !Cray
+!cdir nodep      !NEC
+!ocl novrec      !Fujitsu
+            do ij = 1, imelt
+               i = indxi(ij)
+               j = indxj(ij)
+               etot(ij) = etot(ij) + trcrn(i,j,nt_qice+k-1,n) &amp;
+                                   * vicen(i,j,n)/real(nilyr,kind=dbl_kind)
+            enddo               ! ij
+         enddo                  ! nilyr
+
+!DIR$ CONCURRENT !Cray
+!cdir nodep      !NEC
+!ocl novrec      !Fujitsu
+         do ij = 1, imelt
+            i = indxi(ij)
+            j = indxj(ij)
+            ! lateral heat flux
+            fside(ij) = fside(ij) + rside(i,j)*etot(ij)/dt ! fside &lt; 0
+         enddo                  ! ij
+
+      enddo                     ! n
+
+      !-----------------------------------------------------------------
+      ! Limit bottom and lateral heat fluxes if necessary.
+      !-----------------------------------------------------------------
+
+!DIR$ CONCURRENT !Cray
+!cdir nodep      !NEC
+!ocl novrec      !Fujitsu
+      do ij = 1, imelt
+         i = indxi(ij)
+         j = indxj(ij)
+
+         xtmp = frzmlt(i,j)/(fbot(i,j) + fside(ij) + puny) 
+         xtmp = min(xtmp, c1)
+#if !(defined notz_experiment || defined notz_fieldwork || defined snowice_maksym || defined pond_barrow)
+         fbot(i,j)  = fbot(i,j)  * xtmp
+#endif
+         rside(i,j) = rside(i,j) * xtmp
+      enddo                     ! ij
+
+      deallocate(etot)
+      deallocate(fside)
+
+      end subroutine frzmlt_bottom_lateral
+
+!=======================================================================
+
+end module cice_test
+

Modified: branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_timestep.F
===================================================================
--- branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_timestep.F        2013-01-31 19:44:06 UTC (rev 2407)
+++ branches/cice_projects/initial_cice_core/src/core_cice/mpas_cice_timestep.F        2013-01-31 21:37:47 UTC (rev 2408)
@@ -1,7 +1,6 @@
 module cice_timestep
 
   use mpas_grid_types
-  use cice_convert_to_CICE
 
   implicit none
 
@@ -27,12 +26,18 @@
 
   subroutine step_therm1(domain, dt)
 
+    use cice_test
+    use cice_state, only: ntrcr, nilyr, nt_qice, nt_qsno
+
     type (domain_type), intent(inout) :: domain 
     real (kind=RKIND), intent(in) :: dt
     integer :: nCells, nCategories
     integer :: iCell
 
-    type (struct_type) :: flux, state, tracer, mesh
+    type (block_type),  pointer :: block
+    type (states_type), pointer :: states
+    type (tracer_type), pointer :: tracer
+    type (flux_type),   pointer :: flux
 
     ! original non-local variables
     real(kind=RKIND), dimension(1,1,1) :: &amp;
@@ -56,63 +61,72 @@
          Tbot, &amp;
          fbot
 
-    mesh   =&gt; domain % blocklist % mesh
-    flux   =&gt; domain % blocklist % flux
-    staten =&gt; domain % blocklist % state
-    tracer =&gt; domain % blocklist % tracer
-
-    nCells      = meshnnCells
-    nCategories = mesh % nCategories
-
+    ! allocate local cice variables
     allocate(vicen(1,1,nCategories,1))
     allocate(vsnon(1,1,nCategories,1))
     allocate(trcrn(1,1,ntrcr,nCategories,1))
 
-    ! loop over all cells
-    do iCell = 1, nCells
+    ! loop over blocks
+    block =&gt; domain % blocklist
+    do while (associated(block))
 
-       ! state variable conversion
-       aice(1,1,1)    = state % iceAreaCell % array(iCell)
-       vicen(1,1,:,1) = state % iceVolumeCell % array(iCell,:)
-       vsnon(1,1,:,1) = state % snowVolumeCell % array(iCell,:)
+       ! loop over all cells
+       do iCell = 1, nCells
 
-       ! flux varible conversion
-       sst(1,1,1)    = flux % seaSurfaceTemperature % array(iCell)
-       Tf(1,1,1)     = flux % seaFreezingTemperature % array(iCell)
-       rside(1,1,1)  = flux % iceLateralMeltFraction % array(iCell)
-       frzmlt(1,1,1) = flux % seaFreezeMeltPotential % array(iCell)
+          ! structure pointers
+          states =&gt; block % states
+          tracer =&gt; block % tracer
+          flux   =&gt; block % flux
 
-       strocnxT(1,1,1) = c0
-       strocnyT(1,1,1) = c0
-
-       ! tracer conversion
-       trcrn(1,1,nt_qice:nt_qice+nilyr-1,:,1) = tracer % iceVolumeLayerTracers % array(index_iceEnthalpy,:,iCell,:)
-       trcrn(1,1,nt_qsno:nt_qsno+nilyr-1,:,1) = tracer % snowVolumeLayerTracers % array(index_snowEnthalpy,:,iCell,:)
-
-       !!! BEGIN ORIGINAL CICE CALL
-       !call frzmlt_bottom_lateral(1, 1,                                 &amp;
-       !                           1, 1, 1, 1,                           &amp;
-       !                           ntrcr,             dt,                &amp;
-       !                           aice    (:,:,:),   frzmlt  (:,:,:),   &amp;
-       !                           vicen   (:,:,:,1), vsnon   (:,:,:,:), &amp;
-       !                           trcrn   (:,:,1:ntrcr,:,:),            &amp;
-       !                           sst     (:,:,:),   Tf      (:,:,:),   &amp;
-       !                           strocnxT(:,:,:),   strocnyT(:,:,:),   &amp;
-       !                           Tbot,              fbot,              &amp;
-       !                           rside   (:,:,:))
-       !!! END ORIGINAL CICE CALL
-
-       ! state variable back conversion
-       state % iceAreaCell % array(iCell)      = aice(1,1,1)
-       state % iceVolumeCell % array(iCell,:)  = vicen(1,1,:,1)
-       state % snowVolumeCell % array(iCell,:) = vsnon(1,1,:,1)
-
-       ! tracer back conversion
-       tracer % iceVolumeLayerTracers % array(index_iceEnthalpy,:,iCell,:)   = trcrn(1,1,nt_qice:nt_qice+nilyr-1,:,1)
-       tracer % snowVolumeLayerTracers % array(index_snowEnthalpy,:,iCell,:) = trcrn(1,1,nt_qsno:nt_qsno+nilyr-1,:,1)
-
-    enddo ! iCell
-
+          ! state variable conversion
+          aice(1,1,1)    = states % iceAreaCell % array(iCell)
+          vicen(1,1,:,1) = states % iceVolumeCategory % array(iCell,:)
+          vsnon(1,1,:,1) = states % snowVolumeCategory % array(iCell,:)
+          
+          ! flux variable conversion
+          sst(1,1,1)    = flux % seaSurfaceTemperature % array(iCell)
+          Tf(1,1,1)     = flux % seaFreezingTemperature % array(iCell)
+          rside(1,1,1)  = flux % iceLateralMeltFraction % array(iCell)
+          frzmlt(1,1,1) = flux % seaFreezeMeltPotential % array(iCell)
+          
+          strocnxT(1,1,1) = 0.0_RKIND
+          strocnyT(1,1,1) = 0.0_RKIND
+          
+          ! tracer conversion
+          trcrn(1,1,nt_qice:nt_qice+nilyr-1,:,1) = &amp;
+               tracer % iceVolumeLayerTracers % array(tracer % index_iceEnthalpy,:,iCell,:)
+          trcrn(1,1,nt_qsno:nt_qsno+nilyr-1,:,1) = &amp;
+               tracer % snowVolumeLayerTracers % array(tracer % index_snowEnthalpy,:,iCell,:)
+          
+!!! BEGIN ORIGINAL CICE CALL
+          call frzmlt_bottom_lateral(1, 1,                                 &amp;
+                                     1, 1, 1, 1,                           &amp;
+                                     ntrcr,             dt,                &amp;
+                                     aice    (:,:,:),   frzmlt  (:,:,:),   &amp;
+                                     vicen   (:,:,:,1), vsnon   (:,:,:,:), &amp;
+                                     trcrn   (:,:,1:ntrcr,:,:),            &amp;
+                                     sst     (:,:,:),   Tf      (:,:,:),   &amp;
+                                     strocnxT(:,:,:),   strocnyT(:,:,:),   &amp;
+                                     Tbot,              fbot,              &amp;
+                                     rside   (:,:,:))
+!!! END ORIGINAL CICE CALL
+          
+          ! state variable back conversion
+          states % iceAreaCell % array(iCell)      = aice(1,1,1)
+          states % iceVolumeCategory % array(iCell,:)  = vicen(1,1,:,1)
+          states % snowVolumeCategory % array(iCell,:) = vsnon(1,1,:,1)
+          
+          ! tracer back conversion
+          tracer % iceVolumeLayerTracers % array(tracer % index_iceEnthalpy,:,iCell,:)   = &amp;
+               trcrn(1,1,nt_qice:nt_qice+nilyr-1,:,1)
+          tracer % snowVolumeLayerTracers % array(tracer % index_snowEnthalpy,:,iCell,:) = &amp;
+               trcrn(1,1,nt_qsno:nt_qsno+nilyr-1,:,1)
+          
+       enddo ! iCell
+       
+       block =&gt; block % next
+    end do ! blocks
+    
     ! clean up original variables
     deallocate(vicen)
     deallocate(vsnon)

</font>
</pre>