From 23932d22104218049497ed5526b52b0a73cf728b Mon Sep 17 00:00:00 2001 From: Zhendong Cao Date: Thu, 28 Feb 2019 09:32:32 -0700 Subject: [PATCH 01/59] SedimentCalculation_PhaseI SedimentFluxIndex - I SedimentFluxIndex -I add the following files - Registry_sediment_flux_index.xml - mpas_con_sediment_flux_index.F sedimentFluxIndex - I update add four variables - sedimentFluxIndexVAX : Vertically-Averaged sFI in X-direction - sedimentFluxIndexVAY : Vertically-Averaged sFI in Y-direction - sedimentFluxIndexBX: Bottom sFI in X-direction - sedimentFluxIndexBY: Bottom sFI in Y-direction Adds sediment flux calculation calculate sediment fall velocity by Goldstein and Coco 2013 calculate ratio "a" of sediment flux Q and U3 by Grawe et al 2014 calculate vertically-averaged and close bottom sediment flux (kg/m/s) test the AM on the case ziso/2.5km/default Add Soulsby and Damgaard bedload transport formulae Goldstein and Coco's fall velocity equation seems to overestimate Ws, might be repaced by VanRijn [1989] or Zhu & Cheng [1993] in next commit --- src/core_ocean/analysis_members/Makefile | 4 +- .../Registry_analysis_members.xml | 2 + .../Registry_sediment_flux_index.xml | 101 +++++ .../Registry_sediment_transport.xml | 225 ++++++++++ .../mpas_ocn_analysis_driver.F | 22 + .../mpas_ocn_sediment_flux_index.F | 346 +++++++++++++++ .../mpas_ocn_sediment_transport.F | 408 ++++++++++++++++++ .../compass/general.config.ocean.r4 | 52 +++ .../analysis_members/sediment_flux_index.xml | 32 ++ .../analysis_members/sediment_transport.xml | 50 +++ .../ziso/2.5km/default/config_forward.xml | 2 + 11 files changed, 1243 insertions(+), 1 deletion(-) create mode 100644 src/core_ocean/analysis_members/Registry_sediment_flux_index.xml create mode 100644 src/core_ocean/analysis_members/Registry_sediment_transport.xml create mode 100644 src/core_ocean/analysis_members/mpas_ocn_sediment_flux_index.F create mode 100644 src/core_ocean/analysis_members/mpas_ocn_sediment_transport.F create mode 100755 testing_and_setup/compass/general.config.ocean.r4 create mode 100644 testing_and_setup/compass/ocean/templates/analysis_members/sediment_flux_index.xml create mode 100644 testing_and_setup/compass/ocean/templates/analysis_members/sediment_transport.xml diff --git a/src/core_ocean/analysis_members/Makefile b/src/core_ocean/analysis_members/Makefile index e12898e700..2b69d8da6d 100644 --- a/src/core_ocean/analysis_members/Makefile +++ b/src/core_ocean/analysis_members/Makefile @@ -27,7 +27,9 @@ MEMBERS = mpas_ocn_global_stats.o \ mpas_ocn_eddy_product_variables.o\ mpas_ocn_moc_streamfunction.o\ mpas_ocn_ocean_heat_content.o\ - mpas_ocn_mixed_layer_heat_budget.o + mpas_ocn_mixed_layer_heat_budget.o\ + mpas_ocn_sediment_flux_index.o\ + mpas_ocn_sediment_transport.o all: $(OBJS) diff --git a/src/core_ocean/analysis_members/Registry_analysis_members.xml b/src/core_ocean/analysis_members/Registry_analysis_members.xml index 670f420288..c0a6b6bb43 100644 --- a/src/core_ocean/analysis_members/Registry_analysis_members.xml +++ b/src/core_ocean/analysis_members/Registry_analysis_members.xml @@ -31,3 +31,5 @@ #include "Registry_moc_streamfunction.xml" #include "Registry_ocean_heat_content.xml" #include "Registry_mixed_layer_heat_budget.xml" +#include "Registry_sediment_flux_index.xml" +#include "Registry_sediment_transport.xml" diff --git a/src/core_ocean/analysis_members/Registry_sediment_flux_index.xml b/src/core_ocean/analysis_members/Registry_sediment_flux_index.xml new file mode 100644 index 0000000000..1e61faefa4 --- /dev/null +++ b/src/core_ocean/analysis_members/Registry_sediment_flux_index.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + +▸\ + + + + + + + + + + + + + + + + diff --git a/src/core_ocean/analysis_members/Registry_sediment_transport.xml b/src/core_ocean/analysis_members/Registry_sediment_transport.xml new file mode 100644 index 0000000000..2bc2350e3c --- /dev/null +++ b/src/core_ocean/analysis_members/Registry_sediment_transport.xml @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +▸\ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/core_ocean/analysis_members/mpas_ocn_analysis_driver.F b/src/core_ocean/analysis_members/mpas_ocn_analysis_driver.F index 86157ce16d..c3337ad25e 100644 --- a/src/core_ocean/analysis_members/mpas_ocn_analysis_driver.F +++ b/src/core_ocean/analysis_members/mpas_ocn_analysis_driver.F @@ -51,6 +51,8 @@ module ocn_analysis_driver use ocn_moc_streamfunction use ocn_ocean_heat_content use ocn_mixed_layer_heat_budget + use ocn_sediment_flux_index + use ocn_sediment_transport ! use ocn_TEM_PLATE implicit none @@ -198,6 +200,8 @@ subroutine ocn_analysis_setup_packages(configPool, packagePool, iocontext, err)! call mpas_pool_add_config(analysisMemberList, 'eddyProductVariables', 1) call mpas_pool_add_config(analysisMemberList, 'mocStreamfunction', 1) call mpas_pool_add_config(analysisMemberList, 'oceanHeatContent', 1) + call mpas_pool_add_config(analysisMemberList, 'sedimentFluxIndex', 1) + call mpas_pool_add_config(analysisMemberList, 'sedimentTransport', 1) ! call mpas_pool_add_config(analysisMemberList, 'temPlate', 1) ! DON'T EDIT BELOW HERE @@ -1057,6 +1061,8 @@ subroutine ocn_bootstrap_analysis_members(domain, analysisMemberName, iErr)!{{{ call ocn_bootstrap_pointwise_stats(domain, err_tmp) else if ( analysisMemberName(1:nameLength) == 'transectTransport' ) then call ocn_init_transect_transport(domain, err_tmp) +! else if ( analysisMemberName(1:nameLength) == 'sedimentFluxIndex' ) then +! call ocn_init_sediment_flux_index(domain, err_tmp) ! else if ( analysisMemberName(1:nameLength) == 'temPlate' ) then ! call ocn_init_TEM_PLATE(domain, err_tmp) end if @@ -1128,6 +1134,10 @@ subroutine ocn_init_analysis_members(domain, analysisMemberName, iErr)!{{{ call ocn_init_ocean_heat_content(domain, err_tmp) else if ( analysisMemberName(1:nameLength) == 'mixedLayerHeatBudget' ) then call ocn_init_mixed_layer_heat_budget(domain,err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentFluxIndex' ) then + call ocn_init_sediment_flux_index(domain, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentTransport' ) then + call ocn_init_sediment_transport(domain, err_tmp) ! else if ( analysisMemberName(1:nameLength) == 'temPlate' ) then ! call ocn_init_TEM_PLATE(domain, err_tmp) ! rpn is third to last @@ -1224,6 +1234,10 @@ subroutine ocn_compute_analysis_members(domain, timeLevel, analysisMemberName, i call ocn_compute_ocean_heat_content(domain, timeLevel, err_tmp) else if ( analysisMemberName(1:nameLength) == 'mixedLayerHeatBudget' ) then call ocn_compute_mixed_layer_heat_budget(domain, timeLevel, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentFluxIndex' ) then + call ocn_compute_sediment_flux_index(domain, timeLevel, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentTransport' ) then + call ocn_compute_sediment_transport(domain, timeLevel, err_tmp) ! else if ( analysisMemberName(1:nameLength) == 'temPlate' ) then ! call ocn_compute_TEM_PLATE(domain, timeLevel, err_tmp) ! rpn is third to last @@ -1325,6 +1339,10 @@ subroutine ocn_restart_analysis_members(domain, analysisMemberName, iErr)!{{{ call ocn_restart_ocean_heat_content(domain, err_tmp) else if ( analysisMemberName(1:nameLength) == 'mixedLayerHeatBudget' ) then call ocn_restart_mixed_layer_heat_budget(domain, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentFluxIndex' ) then + call ocn_restart_sediment_flux_index(domain, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentTransport' ) then + call ocn_restart_sediment_transport(domain, err_tmp) ! else if ( analysisMemberName(1:nameLength) == 'temPlate' ) then ! call ocn_restart_TEM_PLATE(domain, err_tmp) ! rpn is third to last @@ -1420,6 +1438,10 @@ subroutine ocn_finalize_analysis_members(domain, analysisMemberName, iErr)!{{{ call ocn_finalize_ocean_heat_content(domain,err_tmp) else if ( analysisMemberName(1:nameLength) == 'mixedLayerHeatBudget' ) then call ocn_finalize_mixed_layer_heat_budget(domain, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentFluxIndex' ) then + call ocn_finalize_sediment_flux_index(domain, err_tmp) + else if ( analysisMemberName(1:nameLength) == 'sedimentTransport' ) then + call ocn_finalize_sediment_transport(domain, err_tmp) ! else if ( analysisMemberName(1:nameLength) == 'temPlate' ) then ! call ocn_finalize_TEM_PLATE(domain, err_tmp) ! rpn is third to last diff --git a/src/core_ocean/analysis_members/mpas_ocn_sediment_flux_index.F b/src/core_ocean/analysis_members/mpas_ocn_sediment_flux_index.F new file mode 100644 index 0000000000..1531572b4c --- /dev/null +++ b/src/core_ocean/analysis_members/mpas_ocn_sediment_flux_index.F @@ -0,0 +1,346 @@ +! Copyright (c) 2013, Los Alamos National Security, LLC (LANS) +! and the University Corporation for Atmospheric Research (UCAR). +! +! Unless noted otherwise source code is licensed under the BSD license. +! Additional copyright and license information can be found in the LICENSE file +! distributed with this code, or at http://mpas-dev.github.com/license.html +! +!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +! +! ocn_sediment_flux_index +! +!> \brief MPAS ocean analysis mode member: sediment_flux_index +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/02/26 +!> \details +!> MPAS ocean analysis mode member: sediment_flux_index +!> In order to add a new analysis member, do the following: +!> 1. Copy these to your new analysis member name: +!> cp mpas_ocn_TEMPLATE.F mpas_ocn_your_new_name.F +!> cp Registry_TEMPLATE.xml Registry_your_new_name.xml +!> +!> 2. In those two new files, replace the following text: +!> temPlate, TEM_PLATE, FILL_IN_AUTHOR, FILL_IN_DATE +!> Typically temPlate uses camel case (variable names), like yourNewName, +!> while TEM_PLATE uses underscores (subroutine names), like your_new_name. +!> note: do not replace 'filename_template' in Registry_yourNewName.xml +!> +!> 3. Add a #include line for your registry to +!> Registry_analysis_members.xml +!> +!> 4. In mpas_ocn_analysis_driver.F, add a use statement for your new analysis member. +!> In addition, add lines for your analysis member, and replace TEM_PLATE +!> and temPlate as described in step 2. There should be 5 places that need additions: +!> - Adding the analysis member name to the analysis member list +!> - Adding an init if test can subroutine call +!> - Adding a compute if test can subroutine call +!> - Adding a restart if test can subroutine call +!> - Adding a finalize if test can subroutine call +!> +!> 5. In src/core_ocean/analysis_members/Makefile, add your +!> new analysis member to the list of members. See another analysis member +!> in that file for an example. +!> NOTE: If your analysis member depends on other files, add a dependency +!> line for the member and list them there. See okubo weiss for an example. +!> +!----------------------------------------------------------------------- + +module ocn_sediment_flux_index + + use mpas_derived_types + use mpas_pool_routines + use mpas_dmpar + use mpas_timekeeping + use mpas_stream_manager + + use ocn_constants + use ocn_diagnostics_routines + + implicit none + private + save + + !-------------------------------------------------------------------- + ! + ! Public parameters + ! + !-------------------------------------------------------------------- + + !-------------------------------------------------------------------- + ! + ! Public member functions + ! + !-------------------------------------------------------------------- + + public :: ocn_init_sediment_flux_index, & + ocn_compute_sediment_flux_index, & + ocn_restart_sediment_flux_index, & + ocn_finalize_sediment_flux_index + + !-------------------------------------------------------------------- + ! + ! Private module variables + ! + !-------------------------------------------------------------------- + +!*********************************************************************** + +contains + +!*********************************************************************** +! +! routine ocn_init_sediment_flux_index +! +!> \brief Initialize MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/02/26 +!> \details +!> This routine conducts all initializations required for the +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_init_sediment_flux_index(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_init_sediment_flux_index!}}} + +!*********************************************************************** +! +! routine ocn_compute_sediment_flux_index +! +!> \brief Compute MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/02/26 +!> \details +!> This routine conducts all computation required for this +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_compute_sediment_flux_index(domain, timeLevel, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + integer, intent(in) :: timeLevel + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + type (mpas_pool_type), pointer :: sedimentFluxIndexAMPool + type (dm_info) :: dminfo + type (block_type), pointer :: block + type (mpas_pool_type), pointer :: statePool + type (mpas_pool_type), pointer :: meshPool + type (mpas_pool_type), pointer :: diagnosticsPool + + real (kind=RKIND), dimension(:,:), pointer :: velX, velY, velZ + real (kind=RKIND), dimension(:), pointer :: posX, posY + real (kind=RKIND), dimension(:), pointer :: sfiVAx, sfiVAy, sfiBx, sfiBy + logical, pointer :: on_a_sphere, use_lat_lon_coords + integer, pointer :: nCells, nVertLevels, nCellsSolve + integer k, iCell, i + err = 0 + + dminfo = domain % dminfo + + block => domain % blocklist + do while (associated(block)) + ! get dimensions + call mpas_pool_get_dimension(block % dimensions, 'nCells', nCells) + call mpas_pool_get_dimension(block % dimensions, 'nCellsSolve', nCellsSolve) + call mpas_pool_get_dimension(block % dimensions, 'nVertLevels', nVertLevels) + + ! get pointers to pools + call mpas_pool_get_subpool(block % structs, 'state', statePool) + call mpas_pool_get_subpool(block % structs, 'mesh', meshPool) + call mpas_pool_get_subpool(block % structs, 'diagnostics', diagnosticsPool) + call mpas_pool_get_subpool(block % structs, 'sedimentFluxIndexAM', sedimentFluxIndexAMPool) + + call mpas_pool_get_config(meshPool, 'on_a_sphere', on_a_sphere) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentFluxIndex_use_lat_lon_coords', use_lat_lon_coords) + + if (.not. on_a_sphere) then + use_lat_lon_coords = .false. + end if + + if (use_lat_lon_coords) then + call mpas_pool_get_array(meshPool, 'lonCell', posX) + call mpas_pool_get_array(meshPool, 'latCell', posY) + call mpas_pool_get_array(diagnosticsPool, 'velocityZonal', velX) + call mpas_pool_get_array(diagnosticsPool, 'velocityMeridional', velY) + else + call mpas_pool_get_array(meshPool, 'xCell', posX) + call mpas_pool_get_array(meshPool, 'yCell', posY) + call mpas_pool_get_array(diagnosticsPool, 'velocityX', velX) + call mpas_pool_get_array(diagnosticsPool, 'velocityY', velY) + end if + + call mpas_pool_get_array(sedimentFluxIndexAMPool, 'sedimentFluxIndexVAX', sfiVAx) + call mpas_pool_get_array(sedimentFluxIndexAMPool, 'sedimentFluxIndexVAY', sfiVAy) + call mpas_pool_get_array(sedimentFluxIndexAMPool, 'sedimentFluxIndexBX', sfiBx) + call mpas_pool_get_array(sedimentFluxIndexAMPool, 'sedimentFluxIndexBY', sfiBy) + ! Computations which are functions of nCells, nEdges, or nVertices + ! must be placed within this block loop + ! Here are some example loops + do iCell = 1,nCellsSolve + sfiVAx(iCell) = (sum(velX(:,iCell))/float(nVertLevels))**3.0_RKIND + sfiVAy(iCell) = (sum(velY(:,iCell))/float(nVertLevels))**3.0_RKIND + sfiBx(iCell) = velX(1,iCell)**3.0_RKIND + sfiBy(iCell) = velY(1,iCell)**3.0_RKIND + end do + + block => block % next + end do + + end subroutine ocn_compute_sediment_flux_index!}}} + +!*********************************************************************** +! +! routine ocn_restart_sediment_flux_index +! +!> \brief Save restart for MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/02/26 +!> \details +!> This routine conducts computation required to save a restart state +!> for the MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_restart_sediment_flux_index(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_restart_sediment_flux_index!}}} + +!*********************************************************************** +! +! routine ocn_finalize_sediment_flux_index +! +!> \brief Finalize MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/02/26 +!> \details +!> This routine conducts all finalizations required for this +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_finalize_sediment_flux_index(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_finalize_sediment_flux_index!}}} + +end module ocn_sediment_flux_index + +! vim: foldmethod=marker diff --git a/src/core_ocean/analysis_members/mpas_ocn_sediment_transport.F b/src/core_ocean/analysis_members/mpas_ocn_sediment_transport.F new file mode 100644 index 0000000000..efd292cfea --- /dev/null +++ b/src/core_ocean/analysis_members/mpas_ocn_sediment_transport.F @@ -0,0 +1,408 @@ +! Copyright (c) 2013, Los Alamos National Security, LLC (LANS) +! and the University Corporation for Atmospheric Research (UCAR). +! +! Unless noted otherwise source code is licensed under the BSD license. +! Additional copyright and license information can be found in the LICENSE file +! distributed with this code, or at http://mpas-dev.github.com/license.html +! +!||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +! +! ocn_sediment_transport +! +!> \brief MPAS ocean analysis mode member: sediment_transport +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/03/07 +!> \details +!> MPAS ocean analysis mode member: sediment_transport +!----------------------------------------------------------------------- + +module ocn_sediment_transport + + use mpas_derived_types + use mpas_pool_routines + use mpas_dmpar + use mpas_timekeeping + use mpas_stream_manager + + use ocn_constants + use ocn_diagnostics_routines + + implicit none + private + save + + !-------------------------------------------------------------------- + ! + ! Public parameters + ! + !-------------------------------------------------------------------- + + !-------------------------------------------------------------------- + ! + ! Public member functions + ! + !-------------------------------------------------------------------- + + public :: ocn_init_sediment_transport, & + ocn_compute_sediment_transport, & + ocn_restart_sediment_transport, & + ocn_finalize_sediment_transport + + !-------------------------------------------------------------------- + ! + ! Private module variables + ! + !-------------------------------------------------------------------- + +!*********************************************************************** + +contains + +!*********************************************************************** +! +! routine ocn_init_sediment_transport +! +!> \brief Initialize MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/03/07 +!> \details +!> This routine conducts all initializations required for the +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_init_sediment_transport(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_init_sediment_transport!}}} + +!*********************************************************************** +! +! routine ocn_compute_sediment_transport +! +!> \brief Compute MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/03/07 +!> \details +!> This routine conducts all computation required for this +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_compute_sediment_transport(domain, timeLevel, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + integer, intent(in) :: timeLevel + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + type (mpas_pool_type), pointer :: sedimentTransportAMPool + type (dm_info) :: dminfo + type (block_type), pointer :: block + type (mpas_pool_type), pointer :: statePool + type (mpas_pool_type), pointer :: meshPool + type (mpas_pool_type), pointer :: diagnosticsPool + + real (kind=RKIND), pointer :: salpha, SD50, rho0, rhoS, Vh, Dv,Ws + real (kind=RKIND), pointer :: tau_ce, Erate, poro, tau_cd, Cd + !! real (kind=RKIND), dimension(:,:) :: tau_bot + real (kind=RKIND), dimension(:,:), pointer :: velX, velY, velZ + real (kind=RKIND), dimension(:), pointer :: posX, posY + real (kind=RKIND), dimension(:), pointer :: sedFluxVAx, sedFluxVAy, sedFluxBx, sedFluxBy + real (kind=RKIND), dimension(:), pointer :: ero_flux, dep_flux + real (kind=RKIND), dimension(:), pointer :: bedld_x, bedld_y + logical, pointer :: on_a_sphere, use_lat_lon_coords + logical, pointer :: bedload, suspended + integer, pointer :: nCells, nVertLevels, nCellsSolve + integer k, iCell, i + real ratio1, rho_R, ND50, Umag + real cff1, cff2, cff3 + real phicw, w_asym !! parameters related to waves, assigned ZEROs for just now + real tau_tide, tau_wave, tau_mean, theta_mean, theta_wave, theta_ce + real phi_x1, phi_x2, phi_x, phi_y + real, parameter :: g = 9.81_RKIND + real, parameter :: eps = 1.0E-14_RKIND + + err = 0 + + dminfo = domain % dminfo + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_alpha',salpha) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_grain_size',SD50) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_drag_coefficient',Cd) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_grain_porosity',poro) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_erate',Erate) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_tau_ce',tau_ce) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_tau_cd',tau_cd) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_water_density',rho0) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_grain_density',rhoS) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_kinematic_viscosity',Vh) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_vertical_diffusion_coefficient',Dv) + + block => domain % blocklist + do while (associated(block)) + ! get dimensions + call mpas_pool_get_dimension(block % dimensions, 'nCells', nCells) + call mpas_pool_get_dimension(block % dimensions, 'nCellsSolve', nCellsSolve) + call mpas_pool_get_dimension(block % dimensions, 'nVertLevels', nVertLevels) + + ! get pointers to pools + call mpas_pool_get_subpool(block % structs, 'state', statePool) + call mpas_pool_get_subpool(block % structs, 'mesh', meshPool) + call mpas_pool_get_subpool(block % structs, 'diagnostics', diagnosticsPool) + call mpas_pool_get_subpool(block % structs, 'sedimentTransportAM', sedimentTransportAMPool) + + call mpas_pool_get_config(meshPool, 'on_a_sphere', on_a_sphere) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_use_lat_lon_coords', use_lat_lon_coords) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_bedload', bedload) + call mpas_pool_get_config(ocnConfigs, 'config_AM_sedimentTransport_suspended', suspended) + + if (.not. on_a_sphere) then + use_lat_lon_coords = .false. + end if + + if (use_lat_lon_coords) then + call mpas_pool_get_array(meshPool, 'lonCell', posX) + call mpas_pool_get_array(meshPool, 'latCell', posY) + call mpas_pool_get_array(diagnosticsPool, 'velocityZonal', velX) + call mpas_pool_get_array(diagnosticsPool, 'velocityMeridional', velY) + else + call mpas_pool_get_array(meshPool, 'xCell', posX) + call mpas_pool_get_array(meshPool, 'yCell', posY) + call mpas_pool_get_array(diagnosticsPool, 'velocityX', velX) + call mpas_pool_get_array(diagnosticsPool, 'velocityY', velY) + end if + + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentFallVelocity', Ws) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentErosionFlux', ero_flux) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentDepositionFlux', dep_flux) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentFluxVAX', sedFluxVAx) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentFluxVAY', sedFluxVAy) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentFluxBX', sedFluxBx) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentFluxBY', sedFluxBy) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentBedloadX', bedld_x) + call mpas_pool_get_array(sedimentTransportAMPool, 'sedimentBedloadY', bedld_y) + + ! compute sedimentFallVelocity + ! sieve diameter (SD50) to nominal diameter (ND50), Raudkivi [1990] + ND50 = SD50*1.1_RKIND + ! sediment/water density comparsion -> specific graivity + rho_R = rhoS/rho0-1 + ! sedimentFallVelocity formula GP technique, Goldstein & Coco [2013] + Ws = (37.8_RKIND*ND50*rho_R*(1+100.0_RKIND*ND50))/ & + (0.383_RKIND+1E4*rho_R*Vh+1E2*ND50*rho_R**2) + ! compute ratio1 in sedFlux = ratio1*U^3, Grawe et al. [2014] + ratio1 = salpha*Dv/Ws**2 + do iCell = 1,nCellsSolve + sedFluxVAx(iCell) = ratio1*(sum(velX(:,iCell))/float(nVertLevels))**3.0_RKIND + sedFluxVAy(iCell) = ratio1*(sum(velY(:,iCell))/float(nVertLevels))**3.0_RKIND + sedFluxBx(iCell) = ratio1*velX(size(velX,1),iCell)**3.0_RKIND + sedFluxBy(iCell) = ratio1*velY(size(velY,1),iCell)**3.0_RKIND + end do + + ! compute bedload and suspended transport + cff1 = rho_R*g*SD50 + cff2 = sqrt(rho_R*g*SD50)*SD50*rhoS + !wave-related parameters + w_asym = 0.0_RKIND + phicw = 0.0_RKIND + + do iCell = 1,nCellsSolve + Umag = sqrt(velX(size(velX,1),iCell)**2 + velY(size(velY,1),iCell)**2) + tau_tide = rho0*Cd*Umag**2 + tau_wave = 0.0_RKIND + tau_mean = tau_tide*(1.0_RKIND+1.2_RKIND*(tau_wave/(tau_wave+tau_tide))**1.5_RKIND) + + ! compute suspended transport <--- to be continued + if (suspended) then + if (tau_mean .gt. tau_ce ) then + ero_flux(iCell) = (1.0_RKIND-poro)*Erate*(tau_mean/tau_ce -1.0_RKIND) + else + ero_flux(iCell) = 0.0_RKIND + endif + end if + + ! compute bedload transport, using formulae by Soulsby and Damgaard [2005] + if (bedload) then + theta_mean = tau_mean/cff1 + theta_wave = tau_wave/cff1 + theta_ce = tau_ce/cff1 + + cff3 = 0.5*(1.0_RKIND+SIGN(1.0_RKIND,theta_mean/theta_ce-1.0_RKIND)) + + phi_x1 = 12.0_RKIND*sqrt(theta_mean)*MAX(theta_mean-theta_ce,0.0_RKIND) + phi_x2 = 12.0_RKIND*(0.9534_RKIND+0.1907_RKIND*COS(2.0_RKIND*phicw))* & + sqrt(theta_wave)*theta_mean + & + 12.0_RKIND*(0.229_RKIND*w_asym*theta_wave**1.5_RKIND*COS(phicw)) + + if (ABS(phi_x2) .gt. phi_x1) then + phi_x = phi_x2 + else + phi_x = phi_x1 + end if + + bedld_x(iCell) = phi_x*cff2*cff3 + + phi_y = 12.0_RKIND*0.1907_RKIND*theta_wave**2* & + (theta_mean*SIN(2.0_RKIND*phicw)+1.2_RKIND*w_asym*theta_wave*SIN(phicw)) & + /(theta_wave**1.5_RKIND + 1.5_RKIND*theta_mean**1.5_RKIND+eps) + bedld_y = phi_y*cff2*cff3 + + end if + end do + + block => block % next + end do + + end subroutine ocn_compute_sediment_transport!}}} + +!*********************************************************************** +! +! routine ocn_restart_sediment_transport +! +!> \brief Save restart for MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/03/07 +!> \details +!> This routine conducts computation required to save a restart state +!> for the MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_restart_sediment_transport(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_restart_sediment_transport!}}} + +!*********************************************************************** +! +! routine ocn_finalize_sediment_transport +! +!> \brief Finalize MPAS-Ocean analysis member +!> \author Zhendong Cao and Phillip J. Wolfram +!> \date 2019/03/07 +!> \details +!> This routine conducts all finalizations required for this +!> MPAS-Ocean analysis member. +! +!----------------------------------------------------------------------- + + subroutine ocn_finalize_sediment_transport(domain, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + type (domain_type), intent(inout) :: domain + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + end subroutine ocn_finalize_sediment_transport!}}} + +end module ocn_sediment_transport + +! vim: foldmethod=marker diff --git a/testing_and_setup/compass/general.config.ocean.r4 b/testing_and_setup/compass/general.config.ocean.r4 new file mode 100755 index 0000000000..b2b56ad5c8 --- /dev/null +++ b/testing_and_setup/compass/general.config.ocean.r4 @@ -0,0 +1,52 @@ +# This file is the ocean core's configuration file. It is specific to the ocean +# core, and a specific machine. Each machine will configure this file +# differently, but it can be used to point on version of the testing +# infrastructure at a different version of the model. + + +# The namelists section defines paths to template namelists that will be used +# to generate specific namelists. Typically these will point to the forward and +# init namelists in the default_inputs directory after a successful build of +# the ocean model. +[namelists] +forward = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/default_inputs/namelist.ocean.forward +init = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/default_inputs/namelist.ocean.init + +# The streams section defines paths to template streams files that will be used +# to generate specific streams files. Typically these will point to the forward and +# init streams files in the default_inputs directory after a successful build of +# the ocean model. +[streams] +forward = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/default_inputs/streams.ocean.forward +init = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/default_inputs/streams.ocean.init + +# The executables section defines paths to required executables. These +# executables are provided for use by specific test cases. +# Full paths should be provided in order to access the executables from +# anywhere on the machine. +[executables] +model = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/ocean_model +metis = /lustre/scratch4/turquoise/zhendong/metis/gpmetis +mesh_converter = /lustre/scratch4/turquoise/zhendong/MPAS-Tools/mesh_tools/mesh_conversion_tools/MpasMeshConverter.x +cell_culler = /lustre/scratch4/turquoise/zhendong/MPAS-Tools/mesh_tools/mesh_conversion_tools/MpasCellCuller.x +mask_creator = /lustre/scratch4/turquoise/zhendong/MPAS-Tools/mesh_tools/mesh_conversion_tools/MpasMaskCreator.x +mesh_generator = FULL_PATH_TO_EXECUTABLE_MESH_GENERATION_SCRIPT +mpi_runtime = /usr/bin/srun + +# The paths section describes paths that are used within the ocean core test +# cases. +[paths] + +# The mesh_database and the initial_condition_database are locations where +# meshes / initial conditions might be found on a specific machine. They can be +# the same directory, or different directory. Additionally, if they are empty +# some test cases might download data into them, which will then be reused if +# the test case is run again later. +mpas_model = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/ +mpas_tools = /lustre/scratch4/turquoise/zhendong/MPAS-Tools +geometric_features = /turquoise/usr/projects/climate/mpeterse/repos/geometric_features/master +jigsaw-geo-matlab = /lustre/scratch4/turquoise/zhendong/jigsaw-geo-matlab +mesh_database = /usr/projects/regionalclimate/COMMON_MPAS/ocean/grids/mesh_database +initial_condition_database = /usr/projects/regionalclimate/COMMON_MPAS/ocean/grids/initial_condition_database +bathymetry_database = /lustre/scratch4/turquoise/sbrus/bathy_data +jigsaw_to_MPAS = /lustre/scratch4/turquoise/zhendong/MPAS-Model_PRs/testing_and_setup/compass/ocean/jigsaw_to_MPAS diff --git a/testing_and_setup/compass/ocean/templates/analysis_members/sediment_flux_index.xml b/testing_and_setup/compass/ocean/templates/analysis_members/sediment_flux_index.xml new file mode 100644 index 0000000000..b9c2c89c08 --- /dev/null +++ b/testing_and_setup/compass/ocean/templates/analysis_members/sediment_flux_index.xml @@ -0,0 +1,32 @@ + diff --git a/testing_and_setup/compass/ocean/templates/analysis_members/sediment_transport.xml b/testing_and_setup/compass/ocean/templates/analysis_members/sediment_transport.xml new file mode 100644 index 0000000000..a74bdf90b5 --- /dev/null +++ b/testing_and_setup/compass/ocean/templates/analysis_members/sediment_transport.xml @@ -0,0 +1,50 @@ + diff --git a/testing_and_setup/compass/ocean/ziso/2.5km/default/config_forward.xml b/testing_and_setup/compass/ocean/ziso/2.5km/default/config_forward.xml index e9e8d42ddc..463d134b2d 100644 --- a/testing_and_setup/compass/ocean/ziso/2.5km/default/config_forward.xml +++ b/testing_and_setup/compass/ocean/ziso/2.5km/default/config_forward.xml @@ -15,6 +15,7 @@