From 6d037e3d0a28d42134b0f85d2476a8568b2444f7 Mon Sep 17 00:00:00 2001 From: Adrian Turner Date: Wed, 14 Oct 2015 21:06:49 -0600 Subject: [PATCH 1/2] Added geographical vectors analysis members and removed old method from velocity solver. --- src/core_cice/Registry.xml | 15 - src/core_cice/analysis_members/Makefile | 2 +- .../Registry_cice_analysis_members.xml | 1 + .../Registry_cice_geographical_vectors.xml | 63 +++ .../mpas_cice_analysis_driver.F | 12 + .../mpas_cice_geographical_vectors.F | 508 ++++++++++++++++++ .../shared/mpas_cice_velocity_solver.F | 227 -------- 7 files changed, 585 insertions(+), 243 deletions(-) create mode 100644 src/core_cice/analysis_members/Registry_cice_geographical_vectors.xml create mode 100644 src/core_cice/analysis_members/mpas_cice_geographical_vectors.F diff --git a/src/core_cice/Registry.xml b/src/core_cice/Registry.xml index de380f0b16..39ccd44946 100644 --- a/src/core_cice/Registry.xml +++ b/src/core_cice/Registry.xml @@ -706,21 +706,6 @@ - - - - - - - - - - - - - - - @@ -905,16 +871,6 @@ - - - - - - - - - - @@ -922,6 +878,7 @@ + @@ -930,29 +887,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "analysis_members/Registry_cice_analysis_members.xml" diff --git a/src/core_cice/model_forward/mpas_cice_core.F b/src/core_cice/model_forward/mpas_cice_core.F index 2051dbb714..7735ef9644 100644 --- a/src/core_cice/model_forward/mpas_cice_core.F +++ b/src/core_cice/model_forward/mpas_cice_core.F @@ -103,7 +103,7 @@ function cice_core_init(domain, startTimeStamp) result(iErr) block => domain % blocklist do while (associated(block)) - call MPAS_pool_get_subpool(block % structs, "global_diagnostics", diagnosticsPool) + call MPAS_pool_get_subpool(block % structs, "diagnostics", diagnosticsPool) call MPAS_pool_get_array(diagnosticsPool, "xtime", xtime) xtime = startTimeStamp @@ -358,14 +358,14 @@ subroutine mpas_timestep(domain, itimestep, dt, timeStamp) type (block_type), pointer :: block - type (MPAS_pool_type), pointer :: globalDiagnostics + type (MPAS_pool_type), pointer :: diagnosticsPool character(len=strKIND), pointer :: xtime block => domain % blocklist do while (associated(block)) - call MPAS_pool_get_subpool(block % structs, "global_diagnostics", globalDiagnostics) - call MPAS_pool_get_array(globalDiagnostics, "xtime", xtime) + call MPAS_pool_get_subpool(block % structs, "diagnostics", diagnosticsPool) + call MPAS_pool_get_array(diagnosticsPool, "xtime", xtime) xtime = timeStamp block => block % next diff --git a/src/core_cice/shared/mpas_cice_debug.F b/src/core_cice/shared/mpas_cice_debug.F index babd348945..d2914b609a 100644 --- a/src/core_cice/shared/mpas_cice_debug.F +++ b/src/core_cice/shared/mpas_cice_debug.F @@ -1887,13 +1887,16 @@ end subroutine strip_plot!}}} ! !----------------------------------------------------------------------- - subroutine cice_test_case_output(block, itimestep)!{{{ + subroutine cice_test_case_output(domain, itimestep)!{{{ - type(block_type), intent(inout) :: & - block !< Input/Output: + type(domain_type), intent(inout) :: & + domain !< Input/Output: integer, intent(in) :: & - itimestep !< Input: + itimestep !< Input: + + type(block_type), pointer :: & + block type (MPAS_pool_type), pointer :: & configs @@ -1904,27 +1907,33 @@ subroutine cice_test_case_output(block, itimestep)!{{{ character(len=strKIND), pointer :: & config_test_case_diag_type - configs => block % configs + block => domain % blocklist + do while (associated(block)) - call MPAS_pool_get_config(configs, "config_test_case_diag", config_test_case_diag) + configs => block % configs - if (config_test_case_diag) then + call MPAS_pool_get_config(configs, "config_test_case_diag", config_test_case_diag) - call MPAS_pool_get_config(configs, "config_test_case_diag_type", config_test_case_diag_type) + if (config_test_case_diag) then - select case (trim(config_test_case_diag_type)) - case ("global_velocity") - call test_case_output_global_velocity(block, itimestep) - case ("square_advection") - call test_case_output_square_advection(block, itimestep) - case ("advection") - !call test_case_output_advection(block, itimestep) - case default - write(*,*) "Test case diagnostics not implemented!", trim(config_test_case_diag_type) - stop - end select + call MPAS_pool_get_config(configs, "config_test_case_diag_type", config_test_case_diag_type) - endif + select case (trim(config_test_case_diag_type)) + case ("global_velocity") + call test_case_output_global_velocity(block, itimestep) + case ("square_advection") + call test_case_output_square_advection(block, itimestep) + case ("advection") + !call test_case_output_advection(block, itimestep) + case default + write(*,*) "Test case diagnostics not implemented!", trim(config_test_case_diag_type) + stop + end select + + endif + + block => block % next + end do end subroutine cice_test_case_output!}}} diff --git a/src/core_cice/shared/mpas_cice_diagnostics.F b/src/core_cice/shared/mpas_cice_diagnostics.F deleted file mode 100644 index f97a6ceed9..0000000000 --- a/src/core_cice/shared/mpas_cice_diagnostics.F +++ /dev/null @@ -1,368 +0,0 @@ -!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -! -! cice_diagnostics -! -!> \brief -!> \author Adrian K. Turner, LANL -!> \date August 20th 2014 -!> \details -!> -! -!----------------------------------------------------------------------- - -module cice_diagnostics - - use mpas_derived_types - use mpas_pool_routines - use mpas_timekeeping - - implicit none - - private - save - - public :: & - cice_run_diagnostics - -contains - -!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -! -! cice_run_diagnostics -! -!> \brief -!> \author Adrian K. Turner, LANL -!> \date August 20th 2014 -!> \details -!> -! -!----------------------------------------------------------------------- - - subroutine cice_run_diagnostics(block, clock) - - type(block_type), intent(inout) :: & - block !< Input/Output: - - type (MPAS_Clock_type), intent(in) :: & - clock !< Input: - - ! min max values for various variables - call cice_diagnostic_min_max(block, clock) - - ! global sums - call cice_diagnostic_global(block, clock) - - end subroutine cice_run_diagnostics - -!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -! -! cice_diagnostic_min_max -! -!> \brief -!> \author Adrian K. Turner, LANL -!> \date August 20th 2014 -!> \details -!> -! -!----------------------------------------------------------------------- - - subroutine cice_diagnostic_min_max(block, clock) - - use cice_constants, only: & - iceAreaMinimum - - type(block_type), intent(inout) :: & - block !< Input/Output: - - type (MPAS_Clock_type), intent(in) :: & - clock !< Input: - - type(MPAS_pool_type), pointer :: & - mesh, & - global_diagnostics, & - tracers - - real(kind=RKIND), dimension(:), pointer :: & - iceAreaCategoryMin, & - iceAreaCategoryMax, & - iceVolumeCategoryMin, & - iceVolumeCategoryMax, & - snowVolumeCategoryMin, & - snowVolumeCategoryMax, & - surfaceTemperatureMin, & - surfaceTemperatureMax, & - iceThicknessCategoryMin, & - iceThicknessCategoryMax, & - snowThicknessCategoryMin, & - snowThicknessCategoryMax - - integer, dimension(:), pointer :: & - snowThicknessCategoryLocMax - - real(kind=RKIND), dimension(:,:,:), pointer :: & - iceAreaCategory, & - iceVolumeCategory, & - snowVolumeCategory, & - surfaceTemperature - - integer, pointer :: & - nCells, & - nCategories - - integer :: & - iCell, & - iCategory - - real(kind=RKIND) :: & - iceThickness, & - snowThickness - - call MPAS_pool_get_subpool(block % structs, "mesh", mesh) - call MPAS_pool_get_subpool(block % structs, "global_diagnostics", global_diagnostics) - call MPAS_pool_get_subpool(block % structs, "tracers", tracers) - - call MPAS_pool_get_array(global_diagnostics, "iceAreaCategoryMin", iceAreaCategoryMin) - call MPAS_pool_get_array(global_diagnostics, "iceAreaCategoryMax", iceAreaCategoryMax) - call MPAS_pool_get_array(global_diagnostics, "iceVolumeCategoryMin", iceVolumeCategoryMin) - call MPAS_pool_get_array(global_diagnostics, "iceVolumeCategoryMax", iceVolumeCategoryMax) - call MPAS_pool_get_array(global_diagnostics, "snowVolumeCategoryMin", snowVolumeCategoryMin) - call MPAS_pool_get_array(global_diagnostics, "snowVolumeCategoryMax", snowVolumeCategoryMax) - call MPAS_pool_get_array(global_diagnostics, "surfaceTemperatureMin", surfaceTemperatureMin) - call MPAS_pool_get_array(global_diagnostics, "surfaceTemperatureMax", surfaceTemperatureMax) - call MPAS_pool_get_array(global_diagnostics, "iceThicknessCategoryMin", iceThicknessCategoryMin) - call MPAS_pool_get_array(global_diagnostics, "iceThicknessCategoryMax", iceThicknessCategoryMax) - call MPAS_pool_get_array(global_diagnostics, "snowThicknessCategoryMin", snowThicknessCategoryMin) - call MPAS_pool_get_array(global_diagnostics, "snowThicknessCategoryMax", snowThicknessCategoryMax) - call MPAS_pool_get_array(global_diagnostics, "snowThicknessCategoryLocMax", snowThicknessCategoryLocMax) - - call MPAS_pool_get_array(tracers, "iceAreaCategory", iceAreaCategory, 1) - call MPAS_pool_get_array(tracers, "iceVolumeCategory", iceVolumeCategory, 1) - call MPAS_pool_get_array(tracers, "snowVolumeCategory", snowVolumeCategory, 1) - call MPAS_pool_get_array(tracers, "surfaceTemperature", surfaceTemperature, 1) - - call MPAS_pool_get_dimension(mesh, "nCells", nCells) - call MPAS_pool_get_dimension(mesh, "nCategories", nCategories) - - iceAreaCategoryMin = 1.0e34_RKIND - iceAreaCategoryMax = -1.0e34_RKIND - iceVolumeCategoryMin = 1.0e34_RKIND - iceVolumeCategoryMax = -1.0e34_RKIND - snowVolumeCategoryMin = 1.0e34_RKIND - snowVolumeCategoryMax = -1.0e34_RKIND - surfaceTemperatureMin = 1.0e34_RKIND - surfaceTemperatureMax = -1.0e34_RKIND - iceThicknessCategoryMin = 1.0e34_RKIND - iceThicknessCategoryMax = -1.0e34_RKIND - snowThicknessCategoryMin = 1.0e34_RKIND - snowThicknessCategoryMax = -1.0e34_RKIND - - snowThicknessCategoryLocMax = -1 - - do iCell = 1, nCells - do iCategory = 1, nCategories - - if (iceAreaCategory(1,iCategory,iCell) > iceAreaMinimum) then - - iceAreaCategoryMin(iCategory) = min(iceAreaCategoryMin(iCategory), iceAreaCategory(1,iCategory,iCell)) - iceAreaCategoryMax(iCategory) = max(iceAreaCategoryMax(iCategory), iceAreaCategory(1,iCategory,iCell)) - - iceVolumeCategoryMin(iCategory) = min(iceVolumeCategoryMin(iCategory), iceVolumeCategory(1,iCategory,iCell)) - iceVolumeCategoryMax(iCategory) = max(iceVolumeCategoryMax(iCategory), iceVolumeCategory(1,iCategory,iCell)) - - snowVolumeCategoryMin(iCategory) = min(snowVolumeCategoryMin(iCategory), snowVolumeCategory(1,iCategory,iCell)) - snowVolumeCategoryMax(iCategory) = max(snowVolumeCategoryMax(iCategory), snowVolumeCategory(1,iCategory,iCell)) - - surfaceTemperatureMin(iCategory) = min(surfaceTemperatureMin(iCategory), surfaceTemperature(1,iCategory,iCell)) - surfaceTemperatureMax(iCategory) = max(surfaceTemperatureMax(iCategory), surfaceTemperature(1,iCategory,iCell)) - - iceThickness = iceVolumeCategory(1,iCategory,iCell) / iceAreaCategory(1,iCategory,iCell) - snowThickness = snowVolumeCategory(1,iCategory,iCell) / iceAreaCategory(1,iCategory,iCell) - - iceThicknessCategoryMin(iCategory) = min(iceThicknessCategoryMin(iCategory), iceThickness) - iceThicknessCategoryMax(iCategory) = max(iceThicknessCategoryMax(iCategory), iceThickness) - - if (snowThickness > snowThicknessCategoryMax(iCategory)) snowThicknessCategoryLocMax(iCategory) = iCell - - snowThicknessCategoryMin(iCategory) = min(snowThicknessCategoryMin(iCategory), snowThickness) - snowThicknessCategoryMax(iCategory) = max(snowThicknessCategoryMax(iCategory), snowThickness) - - endif - - enddo ! iCategory - enddo ! iCell - - end subroutine cice_diagnostic_min_max - -!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -! -! cice_diagnostic_global -! -!> \brief -!> \author Adrian K. Turner, LANL -!> \date August 20th 2014 -!> \details -!> -! -!----------------------------------------------------------------------- - - subroutine cice_diagnostic_global(block, clock) - - use cice_constants, only: & - iceAreaMinimum - - type(block_type), intent(inout) :: & - block !< Input/Output: - - type (MPAS_Clock_type), intent(in) :: & - clock !< Input: - - type(MPAS_pool_type), pointer :: & - mesh, & - global_diagnostics, & - tracers - - real(kind=RKIND), dimension(:,:,:), pointer :: & - iceAreaCategory, & - iceVolumeCategory, & - snowVolumeCategory, & - surfaceTemperature - - real(kind=RKIND), dimension(:), pointer :: & - globalIceArea, & - globalIceExtent, & - globalIceVolume, & - globalIceThickness, & - globalSnowVolume, & - globalSnowThickness - - real(kind=RKIND), dimension(:), pointer :: & - latCell, & - areaCell - - integer, pointer :: & - nCells, & - nCategories - - integer :: & - iCell, & - iCategory - - integer, parameter :: & - iGlobal = 1, & - iNorthern = 2, & - iSouthern = 3 - - real(kind=RKIND), parameter :: & - iceExtentThreshold = 0.15_RKIND - - call MPAS_pool_get_subpool(block % structs, "mesh", mesh) - call MPAS_pool_get_subpool(block % structs, "global_diagnostics", global_diagnostics) - call MPAS_pool_get_subpool(block % structs, "tracers", tracers) - - call MPAS_pool_get_array(global_diagnostics, "globalIceArea", globalIceArea) - call MPAS_pool_get_array(global_diagnostics, "globalIceExtent", globalIceExtent) - call MPAS_pool_get_array(global_diagnostics, "globalIceVolume", globalIceVolume) - call MPAS_pool_get_array(global_diagnostics, "globalIceThickness", globalIceThickness) - call MPAS_pool_get_array(global_diagnostics, "globalSnowVolume", globalSnowVolume) - call MPAS_pool_get_array(global_diagnostics, "globalSnowThickness", globalSnowThickness) - - call MPAS_pool_get_array(tracers, "iceAreaCategory", iceAreaCategory, 1) - call MPAS_pool_get_array(tracers, "iceVolumeCategory", iceVolumeCategory, 1) - call MPAS_pool_get_array(tracers, "snowVolumeCategory", snowVolumeCategory, 1) - call MPAS_pool_get_array(tracers, "surfaceTemperature", surfaceTemperature, 1) - - call MPAS_pool_get_dimension(mesh, "nCells", nCells) - call MPAS_pool_get_dimension(mesh, "nCategories", nCategories) - - call MPAS_pool_get_array(mesh, "latCell", latCell) - call MPAS_pool_get_array(mesh, "areaCell", areaCell) - - globalIceArea(:) = 0.0_RKIND - globalIceExtent(:) = 0.0_RKIND - globalIceVolume(:) = 0.0_RKIND - globalIceThickness(:) = 0.0_RKIND - globalSnowVolume(:) = 0.0_RKIND - globalSnowThickness(:) = 0.0_RKIND - - do iCell = 1, nCells - do iCategory = 1, nCategories - - if (iceAreaCategory(1,iCategory,iCell) > iceAreaMinimum) then - - ! global - ! global ice area - globalIceArea(iGlobal) = globalIceArea(iGlobal) + & - areaCell(iCell) * iceAreaCategory(1,iCategory,iCell) - - ! global ice extent - if (iceAreaCategory(1,iCategory,iCell) > iceExtentThreshold) & - globalIceExtent(iGlobal) = globalIceExtent(iGlobal) + areaCell(iCell) - - ! global ice volume - globalIceVolume(iGlobal) = globalIceVolume(iGlobal) + & - areaCell(iCell) * iceVolumeCategory(1,iCategory,iCell) - - ! global snow volume - globalSnowVolume(iGlobal) = globalSnowVolume(iGlobal) + & - areaCell(iCell) * snowVolumeCategory(1,iCategory,iCell) - - ! northern hemisphere - if (latCell(iCell) > 0.0_RKIND) then - - ! northern hemisphere ice area - globalIceArea(iNorthern) = globalIceArea(iNorthern) + & - areaCell(iCell) * iceAreaCategory(1,iCategory,iCell) - - ! northern hemisphere ice extent - if (iceAreaCategory(1,iCategory,iCell) > iceExtentThreshold) & - globalIceExtent(iNorthern) = globalIceExtent(iNorthern) + areaCell(iCell) - - ! northern hemisphere ice volume - globalIceVolume(iNorthern) = globalIceVolume(iNorthern) + & - areaCell(iCell) * iceVolumeCategory(1,iCategory,iCell) - - ! northern hemisphere snow volume - globalSnowVolume(iNorthern) = globalSnowVolume(iNorthern) + & - areaCell(iCell) * snowVolumeCategory(1,iCategory,iCell) - - endif ! northern hemisphere - - ! southern hemisphere - if (latCell(iCell) < 0.0_RKIND) then - - ! southern hemisphere ice area - globalIceArea(iSouthern) = globalIceArea(iSouthern) + & - areaCell(iCell) * iceAreaCategory(1,iCategory,iCell) - - ! southern hemisphere ice extent - if (iceAreaCategory(1,iCategory,iCell) > iceExtentThreshold) & - globalIceExtent(iSouthern) = globalIceExtent(iSouthern) + areaCell(iCell) - - ! southern hemisphere ice volume - globalIceVolume(iSouthern) = globalIceVolume(iSouthern) + & - areaCell(iCell) * iceVolumeCategory(1,iCategory,iCell) - - ! southern hemisphere snow volume - globalSnowVolume(iSouthern) = globalSnowVolume(iSouthern) + & - areaCell(iCell) * snowVolumeCategory(1,iCategory,iCell) - - endif ! southern hemisphere - - endif - - enddo ! iCategory - enddo ! iCell - - ! ice thickness - where (globalIceArea > 0.0_RKIND) & - globalIceThickness = globalIceVolume / globalIceArea - - ! snow thickness - where (globalIceArea > 0.0_RKIND) & - globalSnowThickness = globalSnowVolume / globalIceArea - - end subroutine cice_diagnostic_global - -!----------------------------------------------------------------------- - -end module cice_diagnostics diff --git a/src/core_cice/shared/mpas_cice_initialize.F b/src/core_cice/shared/mpas_cice_initialize.F index 1550c66dd7..d4e79c7101 100644 --- a/src/core_cice/shared/mpas_cice_initialize.F +++ b/src/core_cice/shared/mpas_cice_initialize.F @@ -50,7 +50,6 @@ subroutine cice_init(& use cice_mesh, only: cice_init_mesh use cice_advection, only: cice_init_advection use cice_velocity_solver, only: cice_init_velocity_solver - use cice_debug, only: cice_test_case_output use cice_column, only: & cice_init_column_physics_package_parameters, & cice_init_column_physics_package_variables @@ -74,11 +73,8 @@ subroutine cice_init(& call MPAS_pool_get_config(domain % configs, "config_use_advection", config_use_advection) - block => domain % blocklist - do while (associated(block)) - call init_junk_values(block) - block => block % next - end do + ! initialize junk values + call init_junk_values(domain) ! mesh initialization call cice_init_mesh(domain) @@ -110,12 +106,6 @@ subroutine cice_init(& ! init ice state call init_ice_state(domain, clock) - block => domain % blocklist - do while (associated(block)) - call cice_test_case_output(block, 0) - block => block % next - end do - ! initial halo exchange call initial_halo_exchanges(domain) @@ -173,13 +163,13 @@ end subroutine cice_init_post_clock_advance ! !----------------------------------------------------------------------- - subroutine init_junk_values(block)!{{{ + subroutine init_junk_values(domain)!{{{ - use cice_debug, only: & - cice_init_ijpop_from_ivertex + type(domain_type), intent(inout) :: & + domain !< Input/Output: - type(block_type), intent(inout) :: & - block !< Input/Output: + type(block_type), pointer :: & + block type(MPAS_pool_type), pointer :: & mesh @@ -196,17 +186,21 @@ subroutine init_junk_values(block)!{{{ real(kind=RKIND), dimension(:), pointer :: & areaCell - call MPAS_pool_get_subpool(block % structs, "mesh", mesh) + block => domain % blocklist + do while (associated(block)) - !call cice_init_ijpop_from_ivertex(mesh) + call MPAS_pool_get_subpool(block % structs, "mesh", mesh) - call MPAS_pool_get_dimension(mesh, "nCells", nCells) + call MPAS_pool_get_dimension(mesh, "nCells", nCells) - call MPAS_pool_get_array(mesh, "areaCell", areaCell) + call MPAS_pool_get_array(mesh, "areaCell", areaCell) - njunk = nCells + 1 + njunk = nCells + 1 - areaCell(njunk) = value_junk + areaCell(njunk) = value_junk + + block => block % next + end do end subroutine init_junk_values!}}} diff --git a/src/core_cice/shared/mpas_cice_time_integration.F b/src/core_cice/shared/mpas_cice_time_integration.F index 17e002899c..f9ce27210c 100644 --- a/src/core_cice/shared/mpas_cice_time_integration.F +++ b/src/core_cice/shared/mpas_cice_time_integration.F @@ -56,12 +56,7 @@ subroutine cice_timestep(& use cice_advection, only: & cice_run_advection - use cice_diagnostics, only: & - cice_run_diagnostics - use cice_debug, only: & - cice_prepare_output_variables, & - cice_test_case_output, & cice_debug_write_out_fields use cice_column, only: & @@ -148,33 +143,6 @@ subroutine cice_timestep(& call cice_column_postdynamics_time_integration(domain, clock) call mpas_timer_stop("Column") - ! prepare output variables - call mpas_timer_start("prepare out") - - block => domain % blocklist - do while (associated(block)) - call cice_prepare_output_variables(block) - block => block % next - end do - - call mpas_timer_stop("prepare out") - - ! test case output - block => domain % blocklist - do while (associated(block)) - call cice_test_case_output(block, itimestep) - block => block % next - end do - - ! diagnostics - block => domain % blocklist - do while (associated(block)) - call cice_run_diagnostics(block, clock) - block => block % next - end do - - call flush (stderrUnit) - call cice_debug_write_out_fields(domain, "cice_timestep", 2) ! reinitialize fluxes