<p><b>dwj07@fsu.edu</b> 2012-12-17 19:14:46 -0700 (Mon, 17 Dec 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Commiting first cut at generic forcing. Including surface fluxes for CESM couplng.<br>
<br>
        Still need Short Wave Radiation.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/generic_forcing/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/Makefile        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/Makefile        2012-12-18 02:14:46 UTC (rev 2355)
@@ -5,7 +5,8 @@
mpas_ocn_advection.o \
         mpas_ocn_thick_hadv.o \
         mpas_ocn_thick_vadv.o \
- mpas_ocn_gm.o \
+         mpas_ocn_thick_surface_flux.o \
+         mpas_ocn_gm.o \
         mpas_ocn_vel_coriolis.o \
         mpas_ocn_vel_vadv.o \
         mpas_ocn_vel_hmix.o \
@@ -32,6 +33,7 @@
         mpas_ocn_tracer_hmix.o \
         mpas_ocn_tracer_hmix_del2.o \
         mpas_ocn_tracer_hmix_del4.o \
+         mpas_ocn_tracer_surface_flux.o \
         mpas_ocn_vmix.o \
         mpas_ocn_vmix_coefs_const.o \
         mpas_ocn_vmix_coefs_rich.o \
@@ -55,7 +57,9 @@
         mpas_ocn_equation_of_state_linear.o \
mpas_ocn_global_diagnostics.o \
         mpas_ocn_time_average.o \
-         mpas_ocn_monthly_forcing.o
+         mpas_ocn_forcing_monthly.o \
+         mpas_ocn_forcing.o \
+         mpas_ocn_constants.o
all: core_hyd
@@ -82,6 +86,8 @@
mpas_ocn_thick_vadv.o:
+mpas_ocn_thick_surface_flux.o:
+
mpas_ocn_gm.o:
mpas_ocn_vel_pressure_grad.o:
@@ -136,6 +142,8 @@
mpas_ocn_tracer_hmix_del4.o:
+mpas_ocn_tracer_surface_flux.o:
+
mpas_ocn_tracer_advection.o: mpas_ocn_tracer_advection_std.o mpas_ocn_tracer_advection_mono.o
mpas_ocn_tracer_advection_std.o: mpas_ocn_tracer_advection_std_hadv.o mpas_ocn_tracer_advection_std_vadv.o
@@ -170,12 +178,17 @@
mpas_ocn_equation_of_state_linear.o:
-mpas_ocn_monthly_forcing.o:
+mpas_ocn_forcing.o: mpas_ocn_forcing_monthly.o
-mpas_ocn_mpas_core.o: mpas_ocn_mpas_core.o \
-                         mpas_ocn_test_cases.o \
+mpas_ocn_forcing_monthly.o:
+
+mpas_ocn_constants.o:
+
+mpas_ocn_mpas_core.o: mpas_ocn_test_cases.o \
                                         mpas_ocn_advection.o \
                                         mpas_ocn_thick_hadv.o \
+                                         mpas_ocn_thick_vadv.o \
+                                         mpas_ocn_thick_surface_flux.o \
mpas_ocn_gm.o \
                                         mpas_ocn_thick_vadv.o \
                                         mpas_ocn_vel_coriolis.o \
@@ -203,6 +216,7 @@
                                         mpas_ocn_tracer_hmix.o \
                                         mpas_ocn_tracer_hmix_del2.o \
                                         mpas_ocn_tracer_hmix_del4.o \
+                                         mpas_ocn_tracer_surface_flux.o \
                                         mpas_ocn_vmix.o \
                                         mpas_ocn_vmix_coefs_const.o \
                                         mpas_ocn_vmix_coefs_rich.o \
@@ -226,7 +240,9 @@
                                         mpas_ocn_equation_of_state_linear.o \
                                         mpas_ocn_global_diagnostics.o \
                                         mpas_ocn_time_average.o \
-                                         mpas_ocn_monthly_forcing.o
+                                         mpas_ocn_forcing.o \
+                                         mpas_ocn_forcing_monthly.o \
+                                         mpas_ocn_constants.o
clean:
        $(RM) *.o *.mod *.f90 libdycore.a
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2012-12-18 02:14:46 UTC (rev 2355)
@@ -114,7 +114,7 @@
dim vertexDegree vertexDegree
dim nVertLevels nVertLevels
dim nVertLevelsP1 nVertLevels+1
-dim nMonths nMonths
+dim nForcing nForcing
%
% var persistence type name_in_file ( dims ) time_levs iro- name_in_code struct super-array array_class
@@ -216,12 +216,12 @@
var persistent integer cellMask ( nVertLevels nCells ) 0 o cellMask mesh - -
% Forcing variables.
-var persistent real u_src ( nVertLevels nEdges ) 0 ir u_src mesh - -
+var persistent real windStress ( nVertLevels nEdges ) 0 ir windStress mesh - -
var persistent real temperatureRestore ( nCells ) 0 ir temperatureRestore mesh - -
var persistent real salinityRestore ( nCells ) 0 ir salinityRestore mesh - -
-var persistent real windStressMonthly ( nMonths nEdges ) 0 ir windStressMonthly mesh - -
-var persistent real temperatureRestoreMonthly ( nMonths nCells ) 0 ir temperatureRestoreMonthly mesh - -
-var persistent real salinityRestoreMonthly ( nMonths nCells ) 0 ir salinityRestoreMonthly mesh - -
+var persistent real windStressInput ( nForcing nEdges ) 0 ir windStressInput mesh - -
+var persistent real temperatureRestoreInput ( nForcing nCells ) 0 ir temperatureRestoreInput mesh - -
+var persistent real salinityRestoreInput ( nForcing nCells ) 0 ir salinityRestoreInput mesh - -
% Prognostic variables: read from input, saved in restart, and written to output
var persistent real u ( nVertLevels nEdges Time ) 2 ir u state - -
@@ -277,11 +277,11 @@
var persistent real uReconstructZ ( nVertLevels nCells Time ) 2 - uReconstructZ state - -
var persistent real uReconstructZonal ( nVertLevels nCells Time ) 2 o uReconstructZonal state - -
var persistent real uReconstructMeridional ( nVertLevels nCells Time ) 2 o uReconstructMeridional state - -
-var persistent real uSrcReconstructX ( nVertLevels nCells Time ) 2 - uSrcReconstructX state - -
-var persistent real uSrcReconstructY ( nVertLevels nCells Time ) 2 - uSrcReconstructY state - -
-var persistent real uSrcReconstructZ ( nVertLevels nCells Time ) 2 - uSrcReconstructZ state - -
-var persistent real uSrcReconstructZonal ( nVertLevels nCells Time ) 2 o uSrcReconstructZonal state - -
-var persistent real uSrcReconstructMeridional ( nVertLevels nCells Time ) 2 o uSrcReconstructMeridional state - -
+var persistent real windStressReconstructX ( nVertLevels nCells Time ) 2 - windStressReconstructX state - -
+var persistent real windStressReconstructY ( nVertLevels nCells Time ) 2 - windStressReconstructY state - -
+var persistent real windStressReconstructZ ( nVertLevels nCells Time ) 2 - windStressReconstructZ state - -
+var persistent real windStressReconstructZonal ( nVertLevels nCells Time ) 2 o windStressReconstructZonal state - -
+var persistent real windSrressReconstructMeridional ( nVertLevels nCells Time ) 2 o windStressReconstructMeridional state - -
var persistent real MontPot ( nVertLevels nCells Time ) 2 - MontPot state - -
var persistent real pressure ( nVertLevels nCells Time ) 2 - pressure state - -
var persistent real wTop ( nVertLevelsP1 nCells Time ) 2 - wTop state - -
@@ -323,3 +323,47 @@
var persistent integer edgeSignOnCell ( maxEdges nCells ) 0 - edgeSignOnCell mesh - -
var persistent integer edgeSignOnVertex ( maxEdges nVertices ) 0 - edgeSignOnVertex mesh - -
var persistent integer kiteIndexOnCell ( maxEdges nCells ) 0 - kiteIndexOnCell mesh - -
+
+% Surface flux fields, for coupled runs
+var persistent real surfaceMassFlux ( nCells ) 0 - surfaceMassFlux mesh - forcing
+var persistent real temperatureFlux ( nCells ) 0 - temperatureFlux mesh surfaceTracerFlux forcing
+var persistent real salinityFlux ( nCells ) 0 - salinityFlux mesh surfaceTracerFlux forcing
+var persistent real tracer1Flux ( nCells ) 0 - tracer1Flux mesh surfaceTracerFlux forcing
+
+#ifdef MPAS_CESM
+% Coupler input fields, for coupled runs
+var persistent real meridionalWindStress ( nCells ) 0 - meridionalWindStress mesh - -
+var persistent real zonalWindStress ( nCells ) 0 - zonalWindStress mesh - -
+var persistent real latentHeatFlux ( nCells ) 0 - latentHeatFlux mesh - -
+var persistent real sensibleHeatFlux ( nCells ) 0 - sensibleHeatFlux mesh - -
+var persistent real longWaveHeatFluxUp ( nCells ) 0 - longWaveHeatFluxUp mesh - -
+var persistent real longWaveHeatFluxDown ( nCells ) 0 - longWaveHeatFluxDown mesh - -
+var persistent real evaporationFlux ( nCells ) 0 - evaporationFlux mesh - -
+var persistent real seaIceHeatFlux ( nCells ) 0 - seaIceHeatFlux mesh - -
+var persistent real snowFlux ( nCells ) 0 - snowFlux mesh - -
+var persistent real seaIceFreshWaterFlux ( nCells ) 0 - seaIceFreshWaterFlux - -
+var persistent real seaIceSalinityFlux ( nCells ) 0 - seaIceSalinityFlux - -
+var persistent real riverRunoffFlux ( nCells ) 0 - riverRunoffFlux - -
+var persistent real iceRunoffFlux ( nCells ) 0 - iceRunoffFlux - -
+var persistent real shortWaveHeatFlux ( nCells ) 0 - shortWaveHeatFlux - -
+var persistent real rainFlux ( nCells ) 0 - rainFlux mesh - -
+var persistent real seaLevelPressure ( nCells ) 0 - seaLevelPressure mesh - -
+var persistent real iceFraction ( nCells ) 0 - iceFraction mesh - -
+var persistent real prognosticCO2 ( nCells ) 0 - prognosticCO2 mesh - -
+var persistent real diagnosticCO2 ( nCells ) 0 - diagnosticCO2 mesh - -
+var persistent real squaredWindSpeed10Meter ( nCells ) 0 - squaredWindSpeed10Meter mesh - -
+
+% Coupler output fields, for coupled runs
+var persistent real surfaceMeltHeatFlux ( nCells ) 0 - surfaceMeltHeatFlux mesh - -
+var persistent real temperatureState ( nCells ) 0 - temperatureState mesh - -
+var persistent real salinityState ( nCells ) 0 - salinityState mesh - -
+var persistent real zonalVelocityState ( nCells ) 0 - zonalVelocityState mesh - -
+var persistent real meridionalVelocityState ( nCells ) 0 - meridionalVelocityState mesh - -
+var persistent real zonalSSHGradientState ( nCells ) 0 - zonalSSHGradientState mesh - -
+var persistent real meridionalSSHGradientState ( nCells ) 0 - meridionalSSHGradientState mesh - -
+var persistent real CO2Flux ( nCells ) 0 - CO2Flux mesh - -
+var persistent real DMSFlux ( nCells ) 0 - DMSFlux mesh - -
+var persistent real surfaceUpwardCO2Flux ( nCells ) 0 - surfaceUpwardCO2Flux mesh - -
+
+#endif
+
Copied: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_monthly.F (from rev 2347, branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F)
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_monthly.F         (rev 0)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_forcing_monthly.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -0,0 +1,192 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+! ocn_forcing_monthly
+!
+!> \brief MPAS ocean monthly forcing
+!> \author Doug Jacobsen
+!> \date 04/25/12
+!> \version SVN:$Id:$
+!> \details
+!> This module contains routines for building the forcing arrays,
+!> if monthly forcing is used.
+!
+!-----------------------------------------------------------------------
+
+module ocn_forcing_monthly
+
+ use mpas_grid_types
+ use mpas_configure
+ use mpas_timekeeping
+
+ implicit none
+ private
+ save
+
+ !--------------------------------------------------------------------
+ !
+ ! Public parameters
+ !
+ !--------------------------------------------------------------------
+
+ !--------------------------------------------------------------------
+ !
+ ! Public member functions
+ !
+ !--------------------------------------------------------------------
+
+ public :: ocn_build_forcing_arrays_monthly, &
+ ocn_forcing_monthly_init
+
+ !--------------------------------------------------------------------
+ !
+ ! Private module variables
+ !
+ !--------------------------------------------------------------------
+
+ logical :: monthlyForcingOn !< Flag to turn on/off resotring
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+! routine ocn_build_forcing_arrays
+!
+!> \brief Determines the forcing array used for the monthly forcing.
+!> \author Doug Jacobsen
+!> \date 04/25/12
+!> \version SVN:$Id$
+!> \details
+!> This routine computes the forcing arrays used later in MPAS.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_build_forcing_arrays_monthly(timeStamp, grid, err)!{{{
+
+ !-----------------------------------------------------------------
+ !
+ ! input variables
+ !
+ !-----------------------------------------------------------------
+
+ type(MPAS_Time_type), intent(in) :: timeStamp
+
+ !-----------------------------------------------------------------
+ !
+ ! input/output variables
+ !
+ !-----------------------------------------------------------------
+
+ type (mesh_type), intent(inout) :: &
+ grid !< Input: grid information
+
+
+ !-----------------------------------------------------------------
+ !
+ ! output variables
+ !
+ !-----------------------------------------------------------------
+
+ integer, intent(out) :: err !< Output: Error flag
+
+ !-----------------------------------------------------------------
+ !
+ ! local variables
+ !
+ !-----------------------------------------------------------------
+
+
+ real (kind=RKIND), dimension(:,:), pointer :: temperatureRestoreInput
+ real (kind=RKIND), dimension(:,:), pointer :: salinityRestoreInput
+ real (kind=RKIND), dimension(:,:), pointer :: windStressInput
+ real (kind=RKIND), dimension(:), pointer :: temperatureRestore
+ real (kind=RKIND), dimension(:), pointer :: salinityRestore
+ real (kind=RKIND), dimension(:,:), pointer :: windStress
+ integer :: iCell, iEdge, nCells, nEdges, nForcing, k
+ integer :: iMonth, iMonthP1, iDayInMonth, ierr
+ real (kind=RKIND) :: data, dataP1, weight, weightP1
+
+ err = 0
+
+ if(.not.monthlyForcingOn) return
+
+ nCells = grid % nCells
+ nEdges = grid % nEdges
+ nForcing = grid % nForcing
+
+ temperatureRestore => grid % temperatureRestore % array
+ salinityRestore => grid % salinityRestore % array
+ windStress => grid % windStress % array
+
+ temperatureRestoreInput => grid % temperatureRestoreInput % array
+ salinityRestoreInput => grid % salinityRestoreInput % array
+ windStressInput => grid % windStressInput % array
+
+ call mpas_get_time(timeStamp, MM = iMonth, DD = iDayInMonth, ierr = ierr)
+
+ err = ierr
+
+ iMonthP1 = mod(iMonth, nForcing) + 1
+
+ weight = 1.0 - (iDayInMonth-1) / 30.0
+ weightP1 = 1.0 - weight
+
+ do iCell=1,nCells
+ ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+ data = temperatureRestoreInput(iMonth,iCell)
+ dataP1 = temperatureRestoreInput(iMonthP1,iCell)
+ temperatureRestore(iCell) = data * weight + dataP1 * weightP1
+ data = salinityRestoreInput(iMonth,iCell)
+ dataP1 = salinityRestoreInput(iMonthP1,iCell)
+ salinityRestore(iCell) = data * weight + dataP1 * weightP1
+ end do
+
+ do iEdge=1,nEdges
+ ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+ data = windStressInput(iMonth,iEdge)
+ dataP1 = windStressInput(iMonthP1,iEdge)
+ windStress(1,iEdge) = data * weight + dataP1 * weightP1
+ end do
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_build_forcing_arrays_monthly!}}}
+
+!***********************************************************************
+!
+! routine ocn_forcing_monthly_init
+!
+!> \brief Initializes monthly forcing module
+!> \author Doug Jacobsen
+!> \date 04/25/12
+!> \version SVN:$Id$
+!> \details
+!> This routine initializes the monthly forcing module.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_forcing_monthly_init(err)!{{{
+
+ integer, intent(out) :: err !< Output: error flag
+
+ err = 0
+
+ monthlyForcingOn = .false.
+
+ if(config_use_monthly_forcing) then
+ monthlyForcingOn = .true.
+
+ write (0,'(a)') " Monthly forcing is on. Make sure monthly forcing variables include iro in Registry, and are in your initial condition or restart file."
+ end if
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_forcing_monthly_init!}}}
+
+!***********************************************************************
+
+end module ocn_forcing_monthly
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+! vim: foldmethod=marker
Deleted: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -1,192 +0,0 @@
-!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-!
-! ocn_monthly_forcing
-!
-!> \brief MPAS ocean monthly forcing
-!> \author Doug Jacobsen
-!> \date 04/25/12
-!> \version SVN:$Id:$
-!> \details
-!> This module contains routines for building the forcing arrays,
-!> if monthly forcing is used.
-!
-!-----------------------------------------------------------------------
-
-module ocn_monthly_forcing
-
- use mpas_grid_types
- use mpas_configure
- use mpas_timekeeping
-
- implicit none
- private
- save
-
- !--------------------------------------------------------------------
- !
- ! Public parameters
- !
- !--------------------------------------------------------------------
-
- !--------------------------------------------------------------------
- !
- ! Public member functions
- !
- !--------------------------------------------------------------------
-
- public :: ocn_build_forcing_arrays, &
- ocn_monthly_forcing_init
-
- !--------------------------------------------------------------------
- !
- ! Private module variables
- !
- !--------------------------------------------------------------------
-
- logical :: monthlyForcingOn !< Flag to turn on/off resotring
-
-!***********************************************************************
-
-contains
-
-!***********************************************************************
-!
-! routine ocn_build_forcing_arrays
-!
-!> \brief Determines the forcing array used for the monthly forcing.
-!> \author Doug Jacobsen
-!> \date 04/25/12
-!> \version SVN:$Id$
-!> \details
-!> This routine computes the forcing arrays used later in MPAS.
-!
-!-----------------------------------------------------------------------
-
- subroutine ocn_build_forcing_arrays(timeStamp, grid, err)!{{{
-
- !-----------------------------------------------------------------
- !
- ! input variables
- !
- !-----------------------------------------------------------------
-
- type(MPAS_Time_type), intent(in) :: timeStamp
-
- !-----------------------------------------------------------------
- !
- ! input/output variables
- !
- !-----------------------------------------------------------------
-
- type (mesh_type), intent(inout) :: &
- grid !< Input: grid information
-
-
- !-----------------------------------------------------------------
- !
- ! output variables
- !
- !-----------------------------------------------------------------
-
- integer, intent(out) :: err !< Output: Error flag
-
- !-----------------------------------------------------------------
- !
- ! local variables
- !
- !-----------------------------------------------------------------
-
-
- real (kind=RKIND), dimension(:,:), pointer :: temperatureRestoreMonthly
- real (kind=RKIND), dimension(:,:), pointer :: salinityRestoreMonthly
- real (kind=RKIND), dimension(:,:), pointer :: windStressMonthly
- real (kind=RKIND), dimension(:), pointer :: temperatureRestore
- real (kind=RKIND), dimension(:), pointer :: salinityRestore
- real (kind=RKIND), dimension(:,:), pointer :: u_src
- integer :: iCell, iEdge, nCells, nEdges, nMonths, k
- integer :: iMonth, iMonthP1, iDayInMonth, ierr
- real (kind=RKIND) :: data, dataP1, weight, weightP1
-
- err = 0
-
- if(.not.monthlyForcingOn) return
-
- nCells = grid % nCells
- nEdges = grid % nEdges
- nMonths = grid % nMonths
-
- temperatureRestore => grid % temperatureRestore % array
- salinityRestore => grid % salinityRestore % array
- u_src => grid % u_src % array
-
- temperatureRestoreMonthly => grid % temperatureRestoreMonthly % array
- salinityRestoreMonthly => grid % salinityRestoreMonthly % array
- windStressMonthly => grid % windStressMonthly % array
-
- call mpas_get_time(timeStamp, MM = iMonth, DD = iDayInMonth, ierr = ierr)
-
- err = ierr
-
- iMonthP1 = mod(iMonth, nMonths) + 1
-
- weight = 1.0 - (iDayInMonth-1) / 30.0
- weightP1 = 1.0 - weight
-
- do iCell=1,nCells
- ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
- data = temperatureRestoreMonthly(iMonth,iCell)
- dataP1 = temperatureRestoreMonthly(iMonthP1,iCell)
- temperatureRestore(iCell) = data * weight + dataP1 * weightP1
- data = salinityRestoreMonthly(iMonth,iCell)
- dataP1 = salinityRestoreMonthly(iMonthP1,iCell)
- salinityRestore(iCell) = data * weight + dataP1 * weightP1
- end do
-
- do iEdge=1,nEdges
- ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
- data = windStressMonthly(iMonth,iEdge)
- dataP1 = windStressMonthly(iMonthP1,iEdge)
- u_src(1,iEdge) = data * weight + dataP1 * weightP1
- end do
-
- !--------------------------------------------------------------------
-
- end subroutine ocn_build_forcing_arrays!}}}
-
-!***********************************************************************
-!
-! routine ocn_monthly_forcing_init
-!
-!> \brief Initializes monthly forcing module
-!> \author Doug Jacobsen
-!> \date 04/25/12
-!> \version SVN:$Id$
-!> \details
-!> This routine initializes the monthly forcing module.
-!
-!-----------------------------------------------------------------------
-
- subroutine ocn_monthly_forcing_init(err)!{{{
-
- integer, intent(out) :: err !< Output: error flag
-
- err = 0
-
- monthlyForcingOn = .false.
-
- if(config_use_monthly_forcing) then
- monthlyForcingOn = .true.
-
- write (0,'(a)') " Monthly forcing is on. Make sure monthly forcing variables include iro in Registry, and are in your initial condition or restart file."
- end if
-
- !--------------------------------------------------------------------
-
- end subroutine ocn_monthly_forcing_init!}}}
-
-!***********************************************************************
-
-end module ocn_monthly_forcing
-
-!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-! vim: foldmethod=marker
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_mpas_core.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_mpas_core.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -11,7 +11,7 @@
use ocn_time_integration
use ocn_tendency
- use ocn_monthly_forcing
+ use ocn_forcing
use ocn_vel_pressure_grad
use ocn_vel_vadv
@@ -30,6 +30,10 @@
use ocn_time_average
+ use ocn_constants
+ use ocn_thick_surface_flux
+ use ocn_tracer_surface_flux
+
type (io_output_object), save :: restart_obj
integer :: current_outfile_frames
@@ -95,9 +99,17 @@
call mpas_ocn_tracer_advection_init(err_tmp)
err = ior(err,err_tmp)
- call ocn_monthly_forcing_init(err_tmp)
+ call ocn_forcing_init(err_tmp)
err = ior(err, err_tmp)
+ call ocn_thick_surface_flux_init(err_tmp)
+ err = ior(err, err_tmp)
+
+ call ocn_tracer_surface_flux_init(err_tmp)
+ err = ior(err, err_tmp)
+
+ call ocn_constants_init()
+
call mpas_timer_init(domain)
if(err.eq.1) then
@@ -278,12 +290,12 @@
)
!TDR
- call mpas_reconstruct(mesh, mesh % u_src % array, &
- block % state % time_levs(1) % state % uSrcReconstructX % array, &
- block % state % time_levs(1) % state % uSrcReconstructY % array, &
- block % state % time_levs(1) % state % uSrcReconstructZ % array, &
- block % state % time_levs(1) % state % uSrcReconstructZonal % array, &
- block % state % time_levs(1) % state % uSrcReconstructMeridional % array &
+ call mpas_reconstruct(mesh, mesh % windStress % array, &
+ block % state % time_levs(1) % state % windStressReconstructX % array, &
+ block % state % time_levs(1) % state % windStressReconstructY % array, &
+ block % state % time_levs(1) % state % windStressReconstructZ % array, &
+ block % state % time_levs(1) % state % windStressReconstructZonal % array, &
+ block % state % time_levs(1) % state % windStressReconstructMeridional % array &
)
!TDR
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tendency.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tendency.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -25,6 +25,7 @@
use ocn_thick_hadv
use ocn_thick_vadv
+ use ocn_thick_surface_flux
use ocn_gm
use ocn_vel_coriolis
@@ -36,6 +37,7 @@
use ocn_tracer_hadv
use ocn_tracer_vadv
use ocn_tracer_hmix
+ use ocn_tracer_surface_flux
use ocn_restoring
use ocn_equation_of_state
@@ -109,12 +111,14 @@
type (state_type), intent(in) :: s !< Input: State information
type (mesh_type), intent(in) :: grid !< Input: Grid information
+ real (kind=RKIND), dimension(:), pointer :: surfaceMassFlux
real (kind=RKIND), dimension(:,:), pointer :: h_edge, wTop, tend_h, uTransport
integer :: err
call mpas_timer_start("ocn_tend_h")
+ surfaceMassFlux => grid % surfaceMassFlux % array
uTransport => s % uTransport % array
wTop => s % wTop % array
h_edge => s % h_edge % array
@@ -145,6 +149,10 @@
call ocn_thick_vadv_tend(grid, wtop, tend_h, err)
call mpas_timer_stop("vadv", thickVadvTimer)
+ call mpas_timer_start("surfaceMassFlux", .false.)
+ call ocn_thick_surface_flux_tend(grid, surfaceMassFlux, tend_h, err)
+ call mpas_timer_stop("surfaceMassFlux")
+
call mpas_timer_stop("ocn_tend_h")
end subroutine ocn_tend_h!}}}
@@ -175,7 +183,7 @@
tend_u, circulation, vorticity, viscosity, ke, ke_edge, Vor_edge, &
MontPot, wTop, divergence, vertViscTopOfEdge
- real (kind=RKIND), dimension(:,:), pointer :: u_src
+ real (kind=RKIND), dimension(:,:), pointer :: windStress
integer :: err
@@ -198,7 +206,7 @@
tend_u => tend % u % array
- u_src => grid % u_src % array
+ windStress => grid % windStress % array
!
! velocity tendency: start accumulating tendency terms
@@ -248,7 +256,7 @@
! know the bottom edge with nonzero velocity and place the drag there.
call mpas_timer_start("forcings", .false., velForceTimer)
- call ocn_vel_forcing_tend(grid, u, u_src, ke_edge, h_edge, tend_u, err)
+ call ocn_vel_forcing_tend(grid, u, windStress, ke_edge, h_edge, tend_u, err)
call mpas_timer_stop("forcings", velForceTimer)
!
@@ -284,6 +292,7 @@
type (mesh_type), intent(in) :: grid !< Input: Grid information
real (kind=RKIND), intent(in) :: dt !< Input: Time step
+ real (kind=RKIND), dimension(:,:), pointer :: surfaceTracerFlux
real (kind=RKIND), dimension(:,:), pointer :: &
uTransport, h,wTop, h_edge, vertDiffTopOfCell, tend_h, uh
real (kind=RKIND), dimension(:,:,:), pointer :: &
@@ -300,6 +309,8 @@
h_edge => s % h_edge % array
vertDiffTopOfCell => d % vertDiffTopOfCell % array
+ surfaceTracerFlux => grid % surfaceTracerFlux % array
+
tend_tr => tend % tracers % array
tend_h => tend % h % array
@@ -365,11 +376,13 @@
! add restoring to T and S in top model layer
!
call mpas_timer_start("restoring", .false., tracerRestoringTimer)
-
call ocn_restoring_tend(grid, h, s%index_temperature, s%index_salinity, tracers, tend_tr, err)
-
call mpas_timer_stop("restoring", tracerRestoringTimer)
+ call mpas_timer_start("surfaceTracerFlux", .false.)
+ call ocn_tracer_surface_flux_tend(grid, surfaceTracerFlux, tend_tr, err)
+ call mpas_timer_stop("surfaceTracerFlux")
+
10 format(2i8,10e20.10)
call mpas_timer_stop("ocn_tend_scalar")
Added: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_thick_surface_flux.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_thick_surface_flux.F         (rev 0)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_thick_surface_flux.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -0,0 +1,158 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+! ocn_thick_surface_flux
+!
+!> \brief MPAS ocean surface fluxes for thickness
+!> \author Doug Jacobsen
+!> \date 12/17/12
+!> \version SVN:$Id:$
+!> \details
+!> This module contains the routine for computing
+!> tendencies for thickness from surface fluxes
+!
+!-----------------------------------------------------------------------
+
+module ocn_thick_surface_flux
+
+ use mpas_grid_types
+ use mpas_configure
+
+ implicit none
+ private
+ save
+
+ !--------------------------------------------------------------------
+ !
+ ! Public parameters
+ !
+ !--------------------------------------------------------------------
+
+ !--------------------------------------------------------------------
+ !
+ ! Public member functions
+ !
+ !--------------------------------------------------------------------
+
+ public :: ocn_thick_surface_flux_tend, &
+ ocn_thick_surface_flux_init
+
+ !--------------------------------------------------------------------
+ !
+ ! Private module variables
+ !
+ !--------------------------------------------------------------------
+
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+! routine ocn_thick_surface_flux_tend
+!
+!> \brief Computes tendency term from horizontal advection of thickness
+!> \author Doug Jacobsen
+!> \date 15 September 2011
+!> \version SVN:$Id$
+!> \details
+!> This routine computes the horizontal advection tendency for
+!> thicknes based on current state and user choices of forcings.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_thick_surface_flux_tend(grid, surfaceMassFlux, tend, err)!{{{
+
+ !-----------------------------------------------------------------
+ !
+ ! input variables
+ !
+ !-----------------------------------------------------------------
+
+ real (kind=RKIND), dimension(:), intent(in) :: &
+ surfaceMassFlux !< Input: surface flux of mass
+
+ type (mesh_type), intent(in) :: &
+ grid !< Input: grid information
+
+ !-----------------------------------------------------------------
+ !
+ ! input/output variables
+ !
+ !-----------------------------------------------------------------
+
+ real (kind=RKIND), dimension(:,:), intent(inout) :: &
+ tend !< Input/Output: thickness tendency
+
+ !-----------------------------------------------------------------
+ !
+ ! output variables
+ !
+ !-----------------------------------------------------------------
+
+ integer, intent(out) :: err !< Output: error flag
+
+ !-----------------------------------------------------------------
+ !
+ ! local variables
+ !
+ !-----------------------------------------------------------------
+
+ integer :: iCell, nCells, k
+ integer, dimension(:), pointer :: maxLevelCell
+
+ err = 0
+
+ maxLevelCell => grid % maxLevelCell % array
+
+ nCells = grid % nCells
+
+ do iCell = 1, nCells
+ k = max(1, maxLevelCell(iCell))
+ tend(k, iCell) = tend(k, iCell) + surfaceMassFlux(iCell)/config_rho0
+ end do
+
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_thick_surface_flux_tend!}}}
+
+!***********************************************************************
+!
+! routine ocn_thick_surface_flux_init
+!
+!> \brief Initializes ocean horizontal thickness surface fluxes
+!> \author Doug Jacobsen
+!> \date 12/17/12
+!> \version SVN:$Id$
+!> \details
+!> This routine initializes quantities related to thickness
+!> surface fluxes in the ocean.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_thick_surface_flux_init(err)!{{{
+
+ !--------------------------------------------------------------------
+
+ !-----------------------------------------------------------------
+ !
+ ! call individual init routines for each parameterization
+ !
+ !-----------------------------------------------------------------
+
+ integer, intent(out) :: err !< Output: error flag
+
+ err = 0
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_thick_surface_flux_init!}}}
+
+!***********************************************************************
+
+end module ocn_thick_surface_flux
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+
+! vim: foldmethod=marker
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -330,12 +330,12 @@
)
!TDR
- call mpas_reconstruct(block % mesh, block % mesh % u_src % array, &
- block % state % time_levs(2) % state % uSrcReconstructX % array, &
- block % state % time_levs(2) % state % uSrcReconstructY % array, &
- block % state % time_levs(2) % state % uSrcReconstructZ % array, &
- block % state % time_levs(2) % state % uSrcReconstructZonal % array, &
- block % state % time_levs(2) % state % uSrcReconstructMeridional % array &
+ call mpas_reconstruct(block % mesh, block % mesh % windStress % array, &
+ block % state % time_levs(2) % state % windStressReconstructX % array, &
+ block % state % time_levs(2) % state % windStressReconstructY % array, &
+ block % state % time_levs(2) % state % windStressReconstructZ % array, &
+ block % state % time_levs(2) % state % windStressReconstructZonal % array, &
+ block % state % time_levs(2) % state % windStressReconstructMeridional % array &
)
!TDR
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_split.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_split.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_integration_split.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -1000,12 +1000,12 @@
)
!TDR
- call mpas_reconstruct(block % mesh, block % mesh % u_src % array, &
- block % state % time_levs(2) % state % uSrcReconstructX % array, &
- block % state % time_levs(2) % state % uSrcReconstructY % array, &
- block % state % time_levs(2) % state % uSrcReconstructZ % array, &
- block % state % time_levs(2) % state % uSrcReconstructZonal % array, &
- block % state % time_levs(2) % state % uSrcReconstructMeridional % array &
+ call mpas_reconstruct(block % mesh, block % mesh % windStress % array, &
+ block % state % time_levs(2) % state % windStressReconstructX % array, &
+ block % state % time_levs(2) % state % windStressReconstructY % array, &
+ block % state % time_levs(2) % state % windStressReconstructZ % array, &
+ block % state % time_levs(2) % state % windStressReconstructZonal % array, &
+ block % state % time_levs(2) % state % windStressReconstructMeridional % array &
)
!TDR
Added: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_surface_flux.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_surface_flux.F         (rev 0)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_tracer_surface_flux.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -0,0 +1,150 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+! ocn_tracer_surface_flux
+!
+!> \brief MPAS ocean tracer surface flux
+!> \author Doug Jacobsen
+!> \date 12/17/12
+!> \version SVN:$Id:$
+!> \details
+!> This module contains the routine for computing
+!> surface flux tendencies.
+!
+!-----------------------------------------------------------------------
+
+module ocn_tracer_surface_flux
+
+ use mpas_grid_types
+ use mpas_configure
+
+ implicit none
+ private
+ save
+
+ !--------------------------------------------------------------------
+ !
+ ! Public parameters
+ !
+ !--------------------------------------------------------------------
+
+ !--------------------------------------------------------------------
+ !
+ ! Public member functions
+ !
+ !--------------------------------------------------------------------
+
+ public :: ocn_tracer_surface_flux_tend, &
+ ocn_tracer_surface_flux_init
+
+ !--------------------------------------------------------------------
+ !
+ ! Private module variables
+ !
+ !--------------------------------------------------------------------
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+! routine ocn_tracer_surface_flux_tend
+!
+!> \brief Computes tendency term for surface fluxes
+!> \author Doug Jacobsen
+!> \date 12/17/12
+!> \version SVN:$Id$
+!> \details
+!> This routine computes the tendency for tracers based on surface fluxes.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_tracer_surface_flux_tend(grid, surfaceTracerFlux, tend, err)!{{{
+
+ !-----------------------------------------------------------------
+ !
+ ! input variables
+ !
+ !-----------------------------------------------------------------
+
+ type (mesh_type), intent(in) :: &
+ grid !< Input: grid information
+
+ real (kind=RKIND), dimension(:,:), intent(in) :: &
+ surfaceTracerFlux !< Input: surface tracer fluxes
+
+ !-----------------------------------------------------------------
+ !
+ ! input/output variables
+ !
+ !-----------------------------------------------------------------
+
+ real (kind=RKIND), dimension(:,:,:), intent(inout) :: &
+ tend !< Input/Output: velocity tendency
+
+ !-----------------------------------------------------------------
+ !
+ ! output variables
+ !
+ !-----------------------------------------------------------------
+
+ integer, intent(out) :: err !< Output: error flag
+
+ !-----------------------------------------------------------------
+ !
+ ! local variables
+ !
+ !-----------------------------------------------------------------
+
+ integer :: iCell, nCells, k, iTracer, nTracers
+
+ integer, dimension(:), pointer :: maxLevelCell
+
+ err = 0
+
+ nCells = grid % nCells
+ nTracers = size(tend, dim=1)
+
+ maxLevelCell => grid % maxLevelCell % array
+
+ do iCell = 1, nCells
+ k = max(1, maxLevelCell(iCell))
+
+ do iTracer = 1, nTracers
+ tend(iTracer, k, iCell) = tend(iTracer, k, iCell) + surfaceTracerFlux(iTracer, iCell)
+ end do
+ end do
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_tracer_surface_flux_tend!}}}
+
+!***********************************************************************
+!
+! routine ocn_tracer_surface_flux_init
+!
+!> \brief Initializes ocean tracer surface flux quantities
+!> \author Doug Jacobsen
+!> \date 12/17/12
+!> \version SVN:$Id$
+!> \details
+!> This routine initializes quantities related to surface fluxes in the ocean.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_tracer_surface_flux_init(err)!{{{
+
+ !--------------------------------------------------------------------
+
+ integer, intent(out) :: err !< Output: error flag
+
+ err = 0
+
+ end subroutine ocn_tracer_surface_flux_init!}}}
+
+!***********************************************************************
+
+end module ocn_tracer_surface_flux
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+! vim: foldmethod=marker
Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_vel_forcing_windstress.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_vel_forcing_windstress.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_vel_forcing_windstress.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -62,7 +62,7 @@
!
!-----------------------------------------------------------------------
- subroutine ocn_vel_forcing_windstress_tend(grid, u_src, h_edge, tend, err)!{{{
+ subroutine ocn_vel_forcing_windstress_tend(grid, windStress, h_edge, tend, err)!{{{
!-----------------------------------------------------------------
!
@@ -71,7 +71,7 @@
!-----------------------------------------------------------------
real (kind=RKIND), dimension(:,:), intent(in) :: &
- u_src !< Input: wind stress
+ windStress !< Input: wind stress
real (kind=RKIND), dimension(:,:), intent(in) :: &
h_edge !< Input: thickness at edge
@@ -130,7 +130,7 @@
do k = 1,min(maxLevelEdgeTop(iEdge),1)
! forcing in top layer only
- tend(k,iEdge) = tend(k,iEdge) + edgeMask(k, iEdge) * (u_src(k,iEdge) / config_rho0 / h_edge(k,iEdge))
+ tend(k,iEdge) = tend(k,iEdge) + edgeMask(k, iEdge) * (windStress(k,iEdge) / config_rho0 / h_edge(k,iEdge))
enddo
enddo
Modified: branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2012-12-17 22:11:35 UTC (rev 2354)
+++ branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2012-12-18 02:14:46 UTC (rev 2355)
@@ -979,262 +979,89 @@
!
!-----------------------------------------------------------------------
-! character (len=StrKIND) :: &
-! label, &
-! message
-!
-! integer :: &
-! i,j,k,n,iblock
+ character (len=StrKIND) :: &
+ label, &
+ message
+
+ integer :: &
+ i,n
+
+ type (block_type), pointer :: block_ptr
+
+!-----------------------------------------------------------------------
!
-! real (kind=RKIND), dimension(nx_block,ny_block) :: &
-! WORKB
+! zero out padded cells
!
-! real (kind=RKIND), dimension(nx_block,ny_block,max_blocks_clinic) :: &
-! WORK1, WORK2 ! local work space
+!-----------------------------------------------------------------------
+
+ errorCode = POP_Success
+
+!-----------------------------------------------------------------------
!
-! real (r8) :: &
-! m2percm2, &
-! gsum
+! unpack and distribute wind stress, then convert to correct units
+! and rotate components to local coordinates
!
-! type (block) :: this_block ! local block info
-!
-!!-----------------------------------------------------------------------
-!!
-!! zero out padded cells
-!!
-!!-----------------------------------------------------------------------
-!
-! errorCode = POP_Success
-!
-! WORK1 = c0
-! WORK2 = c0
-!
-!!-----------------------------------------------------------------------
-!!
-!! unpack and distribute wind stress, then convert to correct units
-!! and rotate components to local coordinates
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! WORK1(i,j,iblock) = x2o_o%rAttr(index_x2o_Foxx_taux,n)
-! WORK2(i,j,iblock) = x2o_o%rAttr(index_x2o_Foxx_tauy,n)
-! enddo
-! enddo
-! enddo ! iblock
-!
-! !***
-! !*** do NOT perform halo updates now, because vector updates must
-! !*** be done after the rotation is completed.
-! !***
-!
-!!-----------------------------------------------------------------------
-!!
-!! rotate true zonal/meridional wind stress into local coordinates,
-!! convert to dyne/cm**2, and shift SMFT to U grid
-!!
-!! halo updates are performed in subroutine rotate_wind_stress,
-!! following the rotation
-!!
-!!-----------------------------------------------------------------------
-!
-! call rotate_wind_stress(WORK1, WORK2)
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-!!-----------------------------------------------------------------------
-!!
-!! unpack and distribute fresh water flux and salt flux
-!!
-!! NOTE: if there are code changes associated with changing the names or
-!! the number of fluxes received from the coupler, then subroutine
-!! update_ghost_cells_coupler_fluxes will need to be modified also
-!!
-!!-----------------------------------------------------------------------
-!
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! SNOW_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Faxa_snow,n)
-! WORKB (i,j ) = x2o_o%rAttr(index_x2o_Faxa_rain,n)
-! EVAP_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Foxx_evap,n)
-! MELT_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Fioi_meltw,n)
-! ROFF_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Forr_roff,n)
-! IOFF_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Forr_ioff,n)
-! SALT_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Fioi_salt,n)
-!
-! PREC_F(i,j,iblock) = WORKB(i,j) + SNOW_F(i,j,iblock) ! rain + snow
-!
-! WORKB(i,j ) = x2o_o%rAttr(index_x2o_Foxx_swnet,n)
-! SHF_QSW(i,j,iblock) = WORKB(i,j)* &
-! RCALCT(i,j,iblock)*hflux_factor ! convert from W/m**2
-! SENH_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Foxx_sen,n)
-! LWUP_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Foxx_lwup,n)
-! LWDN_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Faxa_lwdn,n)
-! MELTH_F(i,j,iblock) = x2o_o%rAttr(index_x2o_Fioi_melth,n)
-!
-! WORKB(i,j ) = x2o_o%rAttr(index_x2o_Si_ifrac,n)
-! IFRAC(i,j,iblock) = WORKB(i,j) * RCALCT(i,j,iblock)
-!
-! !*** converting from Pa to dynes/cm**2
-! WORKB(i,j ) = x2o_o%rAttr(index_x2o_Sa_pslv,n)
-! ATM_PRESS(i,j,iblock) = c10 * WORKB(i,j) * RCALCT(i,j,iblock)
-!
-! !*** converting from m**2/s**2 to cm**2/s**2
-! WORKB(i,j ) = x2o_o%rAttr(index_x2o_So_duu10n,n)
-! U10_SQR(i,j,iblock) = cmperm * cmperm * WORKB(i,j) * RCALCT(i,j,iblock)
-!
-! enddo
-! enddo
-!
-! enddo
-!
-!!-----------------------------------------------------------------------
-!!
-!! incoming data quality control
-!!
-!!-----------------------------------------------------------------------
-!#ifdef CCSMCOUPLED
-! if ( any(IOFF_F < c0) ) then
-! call shr_sys_abort ('Error: incoming IOFF_F is negative')
-! endif
-!#endif
-!
-!
-!!-----------------------------------------------------------------------
-!!
-!! update ghost cells for fluxes received from the coupler
-!!
-!!-----------------------------------------------------------------------
-!
-! call update_ghost_cells_coupler_fluxes(errorCode)
-!
-! if (errorCode /= POP_Success) then
-! call POP_ErrorSet(errorCode, &
-! 'ocn_import_mct: error in update_ghost_cells_coupler_fluxes')
-! return
-! endif
-!
-!!-----------------------------------------------------------------------
-!!
-!! unpack atmospheric CO2
-!!
-!!-----------------------------------------------------------------------
-!
-! if (index_x2o_Sa_co2prog > 0) then
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! WORK1(i,j,iblock) = x2o_o%rAttr(index_x2o_Sa_co2prog,n)
-! enddo
-! enddo
-! enddo
-!
-! call POP_HaloUpdate(WORK1,POP_haloClinic, &
-! POP_gridHorzLocCenter, &
-! POP_fieldKindScalar, errorCode, &
-! fillValue = 0.0_POP_r8)
-!
-! if (errorCode /= POP_Success) then
-! call POP_ErrorSet(errorCode, &
-! 'ocn_import_mct: error updating PROG CO2 halo')
-! return
-! endif
-!
-! call named_field_set(ATM_CO2_PROG_nf_ind, WORK1)
-! endif
-!
-! if (index_x2o_Sa_co2diag > 0) then
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! WORK1(i,j,iblock) = x2o_o%rAttr(index_x2o_Sa_co2diag,n)
-! enddo
-! enddo
-! enddo
-!
-! call POP_HaloUpdate(WORK1,POP_haloClinic, &
-! POP_gridHorzLocCenter, &
-! POP_fieldKindScalar, errorCode, &
-! fillValue = 0.0_POP_r8)
-!
-! if (errorCode /= POP_Success) then
-! call POP_ErrorSet(errorCode, &
-! 'ocn_import_mct: error updating DIAG CO2 halo')
-! return
-! endif
-!
-! call named_field_set(ATM_CO2_DIAG_nf_ind, WORK1)
-! endif
-!
-!!-----------------------------------------------------------------------
-!!
-!! receive orbital parameters
-!!
-!!-----------------------------------------------------------------------
-!
-! call seq_infodata_GetData(infodata, &
-! orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr)
-!
-!
-!!-----------------------------------------------------------------------
-!!
-!! diagnostics
-!!
-!!-----------------------------------------------------------------------
-!
-! if (ldiag_cpl) then
-!
-! write(message,'(6a,1x,5a)') &
-! ' Global averages of fluxes received from cpl at ', &
-! cyear,'/',cmonth ,'/',cday, chour,':',cminute,':',csecond
-! call document ('pop_recv_from_coupler', trim(message))
-!
-! m2percm2 = mpercm*mpercm
-! do k = 1,nrecv
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! WORK1(i,j,iblock) = x2o_o%rAttr(k,n) ! mult. by TAREA in global_sum_prod
-! enddo
-! enddo
-! enddo
-!
-! gsum = global_sum_prod(WORK1 , TAREA, distrb_clinic, &
-! field_loc_center, RCALCT)*m2percm2
-! if (my_task == master_task) then
-! call seq_flds_getField(label,k,seq_flds_x2o_fields)
-! write(stdout,1100)'ocn','recv', label ,gsum
-! call shr_sys_flush(stdout)
-! endif
-! enddo
-! endif
-!
-!
-!1100 format ('comm_diag ', a3, 1x, a4, 1x, a8, 1x, es26.19:, 1x, a6)
+!-----------------------------------------------------------------------
+ n = 0
+ block_ptr => domain % blocklist
+ do while(associated(block_ptr))
+ do i = block_ptr % mesh % nCellsSolve
+ n = n + 1
+ block_ptr % mesh % zonalWindStress % array(n) = x2o_o % rAttr(index_x2o_Foxx_taux, n)
+ block_ptr % mesh % meridionalWindStress % array(n) = x2o_o % rAttr(index_x2o_Foxx_tauy, n)
+
+ block_ptr % mesh % latentHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_lat, n)
+ block_ptr % mesh % sensibleHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_sen, n)
+ block_ptr % mesh % longWaveHeatFluxUp % array(n) = x2o_o % rAttr(index_x2o_Foxx_lwup, n)
+ block_ptr % mesh % longWaveHeatFluxDown % array(n) = x2o_o % rAttr(index_x2o_Faxa_lwdn, n)
+ block_ptr % mesh % evaporationFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_evap, n)
+ block_ptr % mesh % seaIceHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_melth, n)
+ block_ptr % mesh % snowFlux % array(n) = x2o_o % rAttr(index_x2o_Faxa_snow, n)
+
+ block_ptr % mesh % seaIceFreshWaterFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_meltw, n)
+ block_ptr % mesh % seaIceSalinityFlux % array(n) = x2o_o % rAttr(index_x2o_Fioi_salt, n)
+ block_ptr % mesh % riverRunoffFlux % array(n) = x2o_o % rAttr(index_x2o_Forr_roff, n)
+ block_ptr % mesh % iceRunoffFlux % array(n) = x2o_o % rAttr(index_x2o_Forr_ioff, n)
+
+ block_ptr % mesh % shortWaveHeatFlux % array(n) = x2o_o % rAttr(index_x2o_Foxx_swnet, n)
+
+ block_ptr % mesh % rainFlux % array(n) = x2o_o % rAttr(index_x2o_Faxa_rain, n)
+ block_ptr % mesh % seaLevelPressure % array(n) = x2o_o % rAttr(index_x2o_Sa_pslv, n)
+ block_ptr % mesh % iceFraction % array(n) = x2o_o % rAttr(index_x2o_Si_ifrac, n)
+
+ block_ptr % mesh % prognosticCO2 % array(n) = x2o_o % rAttr(index_x2o_Sa_co2prog, n)
+ block_ptr % mesh % diagnosticCO2 % array(n) = x2o_o % rAttr(index_x2o_Sa_co2diag, n)
+ block_ptr % mesh % squaredWindSpeed10Meter % array(n) = x2o_o % rAttr(index_x2o_So_duu10n, n)
+
+ if(block_ptr % mesh % iceRunoffFlux % array(n) < 0.0_RKIND) then
+ call shr_sys_abort ('Error: incoming IOFF_F is negative')
+ end if
+ end do
+ block_ptr => block_ptr % next
+ end do
+
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % meridionalWindStress)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % zonalWindStress)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % latentHeatFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % sensibleHeatFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % longWaveHeatFluxUp)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % longWaveHeatFluxDown)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % evaporationFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % seaIceHeatFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % snowFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % seaIceFreshWaterFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % seaIceSalinityFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % riverRunoffFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % iceRunoffFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % shortWaveHeatFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % rainFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % seaLevelPressure)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % iceFraction)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % prognosticCO2)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % diagnosticCO2)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % squaredWindSpeed10Meter)
+
!-----------------------------------------------------------------------
!EOC
@@ -1264,225 +1091,48 @@
!EOP
!BOC
-!!-----------------------------------------------------------------------
-!!
-!! local variables
-!!
-!!-----------------------------------------------------------------------
+!-----------------------------------------------------------------------
!
-! integer (int_kind) :: n, iblock
-!
-! character (char_len) :: label
-!
-! integer (int_kind) :: &
-! i,j,k
+! local variables
!
-! real (r8), dimension(nx_block,ny_block) :: &
-! WORK1, WORK2, &! local work space
-! WORK3, WORK4
-!
-! real (r8), dimension(nx_block,ny_block,max_blocks_clinic) :: &
-! WORKA ! local work space with full block dimension
-!
-! real (r8) :: &
-! m2percm2, &
-! gsum
-!
-! type (block) :: this_block ! local block info
-!
-!!-----------------------------------------------------------------------
-!
-!!-----------------------------------------------------------------------
-!!
-!! initialize control buffer
-!!
-!!-----------------------------------------------------------------------
-!
-! errorCode = POP_Success
-!
-!!-----------------------------------------------------------------------
-!!
-!! interpolate onto T-grid points and rotate on T grid
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-!
-! call ugrid_to_tgrid(WORK3,SBUFF_SUM(:,:,iblock,index_o2x_So_u),iblock)
-! call ugrid_to_tgrid(WORK4,SBUFF_SUM(:,:,iblock,index_o2x_So_v),iblock)
-!
-! WORK1 = (WORK3*cos(ANGLET(:,:,iblock))+WORK4*sin(-ANGLET(:,:,iblock))) &
-! * mpercm/tlast_coupled
-! WORK2 = (WORK4*cos(ANGLET(:,:,iblock))-WORK3*sin(-ANGLET(:,:,iblock))) &
-! * mpercm/tlast_coupled
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_So_u,n) = WORK1(i,j)
-! o2x_o%rAttr(index_o2x_So_v,n) = WORK2(i,j)
-! enddo
-! enddo
-! enddo
-!
-!!-----------------------------------------------------------------------
-!!
-!! convert and pack surface temperature
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_So_t,n) = &
-! SBUFF_SUM(i,j,iblock,index_o2x_So_t)/tlast_coupled + T0_Kelvin
-! enddo
-! enddo
-! enddo
-!
-!!-----------------------------------------------------------------------
-!!
-!! convert and pack salinity
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_So_s,n) = &
-! SBUFF_SUM(i,j,iblock,index_o2x_So_s)*salt_to_ppt/tlast_coupled
-! enddo
-! enddo
-! enddo
-!
-!!-----------------------------------------------------------------------
-!!
-!! interpolate onto T-grid points, then rotate on T grid
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! call ugrid_to_tgrid(WORK3,SBUFF_SUM(:,:,iblock,index_o2x_So_dhdx),iblock)
-! call ugrid_to_tgrid(WORK4,SBUFF_SUM(:,:,iblock,index_o2x_So_dhdy),iblock)
-!
-! WORK1 = (WORK3*cos(ANGLET(:,:,iblock)) + WORK4*sin(-ANGLET(:,:,iblock))) &
-! /grav/tlast_coupled
-! WORK2 = (WORK4*cos(ANGLET(:,:,iblock)) - WORK3*sin(-ANGLET(:,:,iblock))) &
-! /grav/tlast_coupled
-!
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_So_dhdx,n) = WORK1(i,j)
-! o2x_o%rAttr(index_o2x_So_dhdy,n) = WORK2(i,j)
-! enddo
-! enddo
-! enddo
-!
-!!-----------------------------------------------------------------------
-!!
-!! pack heat flux due to freezing/melting (W/m^2)
-!! QFLUX computation and units conversion occurs in ice.F
-!!
-!!-----------------------------------------------------------------------
-!
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_Fioo_q,n) = QFLUX(i,j,iblock)
-! enddo
-! enddo
-! enddo
-!
-! tlast_ice = c0
-! AQICE = c0
-! QICE = c0
-!
-!!-----------------------------------------------------------------------
-!!
-!! pack co2 flux, if requested (kg CO2/m^2/s)
-!! units conversion occurs where co2 flux is computed
-!!
-!!-----------------------------------------------------------------------
-!
-! if (index_o2x_Faoo_fco2_ocn > 0) then
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! o2x_o%rAttr(index_o2x_Faoo_fco2_ocn,n) = &
-! SBUFF_SUM(i,j,iblock,index_o2x_Faoo_fco2_ocn)/tlast_coupled
-! enddo
-! enddo
-! enddo
-! endif
-!
-!!-----------------------------------------------------------------------
-!!
-!! diagnostics
-!!
-!!-----------------------------------------------------------------------
-!
-! if (ldiag_cpl) then
-! call ccsm_char_date_and_time
-!!DEBUG write(message,'(6a,1x,5a)')' Global averages of fluxes sent to cpl at ', &
-!!DEBUG cyear,'/',cmonth, '/',cday, chour,':',cminute,':',csecond
-!!DEBUG call document ('pop_send_to_coupler', message)
-! write(stdout,*)'pop_send_to_coupler'
-!
-! m2percm2 = mpercm*mpercm
-! do k = 1,nsend
-! n = 0
-! do iblock = 1, nblocks_clinic
-! this_block = get_block(blocks_clinic(iblock),iblock)
-! do j=this_block%jb,this_block%je
-! do i=this_block%ib,this_block%ie
-! n = n + 1
-! WORKA(i,j,iblock) = o2x_o%rAttr(k,n)
-! enddo
-! enddo
-! enddo
-!
-! call POP_HaloUpdate(WORKA,POP_haloClinic, &
-! POP_gridHorzLocCenter, &
-! POP_fieldKindScalar, errorCode, &
-! fillValue = 0.0_POP_r8)
-!
-! if (errorCode /= POP_Success) then
-! call POP_ErrorSet(errorCode, &
-! 'ocn_export_mct: error updating halo for state')
-! return
-! endif
-!
-! gsum = global_sum_prod(WORKA , TAREA, distrb_clinic, &
-! field_loc_center, RCALCT)*m2percm2
-! if (my_task == master_task) then
-! call seq_flds_getField(label,k,seq_flds_o2x_fields)
-! write(stdout,1100)'ocn','send', label ,gsum
-! endif
-! enddo ! k
-! if (my_task == master_task) call shr_sys_flush(stdout)
-! endif
-!
-!1100 format ('comm_diag ', a3, 1x, a4, 1x, a8, 1x, es26.19:, 1x, a6)
-!
-! tlast_coupled = c0
+!-----------------------------------------------------------------------
+ integer :: i,n
+
+ type (block_type), pointer :: block_ptr
+
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % surfaceMeltHeatFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % temperatureState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % salinityState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % zonalVelocityState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % meridionalVelocityState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % zonalSSHGradientState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % meridionalSSHGradientState)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % CO2Flux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % DMSFlux)
+ call mpas_dmpar_exch_halo_field(domain % blocklist % mesh % surfaceUpwardCO2Flux)
+
+ n = 0
+ block_ptr => domain % blocklist
+ do while(associated(block_ptr))
+ do i = 1, block_ptr % mesh % nCellsSolve
+ n = n + 1
+ o2x_o % rAttr(index_o2x_Fioo_q, n) = block_ptr % mesh % surfaceMeltHeatFlux % array(n)
+ o2x_o % rAttr(index_o2x_So_t, n) = block_ptr % mesh % temperatureState % array(n)
+ o2x_o % rAttr(index_o2x_So_s, n) = block_ptr % mesh % salinityState % array(n)
+ o2x_o % rAttr(index_o2x_So_u, n) = block_ptr % mesh % zonalVelocityState % array(n)
+ o2x_o % rAttr(index_o2x_So_v, n) = block_ptr % mesh % meridionalVelocityState % array(n)
+ o2x_o % rAttr(index_o2x_So_dhdx, n) = block_ptr % mesh % zonalSSHGradientState % array(n)
+ o2x_o % rAttr(index_o2x_So_dhdy, n) = block_ptr % mesh % meridionalSSHGradientState % array(n)
+ o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % mesh % CO2Flux % array(n)
+ o2x_o % rAttr(index_o2x_Faoo_fdms_ocn, n) = block_ptr % mesh % DMSFlux % array(n)
+ o2x_o % rAttr(index_o2x_Faoo_fco2_ocn, n) = block_ptr % mesh % surfaceUpwardCO2Flux % array(n)
+ end do
+
+ block_ptr => block_ptr % next
+ end do
+
+
!-----------------------------------------------------------------------
!EOC
</font>
</pre>