From b4276ddafde91a9686b805928c7c530a87488e59 Mon Sep 17 00:00:00 2001 From: Luke Van Roekel Date: Thu, 30 Apr 2020 22:20:49 -0500 Subject: [PATCH 1/5] Adds Normal velocity to eddy stats adds normalVelocityTimesTemperature and normalVelocitySquared to eddy_products AM --- .../Registry_eddy_product_variables.xml | 8 +++++- .../mpas_ocn_eddy_product_variables.F | 27 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml index 48be8b032c..f2f11d5061 100644 --- a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml +++ b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml @@ -45,7 +45,13 @@ - + + + Date: Thu, 30 Apr 2020 21:48:39 -0600 Subject: [PATCH 2/5] Fixes to eddy stats changes --- .../analysis_members/Registry_eddy_product_variables.xml | 6 ++++-- .../analysis_members/mpas_ocn_eddy_product_variables.F | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml index f2f11d5061..880f425f8e 100644 --- a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml +++ b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml @@ -68,7 +68,9 @@ - - + + + + diff --git a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F index 93b1196125..aae38822a1 100644 --- a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F +++ b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F @@ -177,10 +177,10 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ type (mpas_pool_type), pointer :: tracersPool type (mpas_pool_type), pointer :: diagnosticsPool - integer, pointer :: nVertLevels, nCellsSolve - integer :: iTracer, k, iCell, iEdge, nEdges, cell1, cell2 + integer, pointer :: nEdges, nVertLevels, nCellsSolve + integer :: iTracer, k, iCell, iEdge, cell1, cell2 integer, pointer :: index_temperature, index_salinity - integer, dimension(:), pointer :: maxLevelEdgeTop, maxLevelCell, nEdgesArray + integer, dimension(:), pointer :: maxLevelEdgeTop, maxLevelCell integer, dimension(:,:), pointer :: cellsOnEdge real (kind=RKIND), dimension(:), pointer :: ssh, SSHSquared @@ -204,6 +204,7 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_dimension(block % dimensions, 'nVertLevels', nVertLevels) call mpas_pool_get_dimension(block % dimensions, 'nCellsSolve', nCellsSolve) + call mpas_pool_get_dimension(block % dimensions, 'nEdges', nEdges) call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity) call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracers, 1) @@ -215,7 +216,6 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityZonal',GMBolusVelocityZonal) call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityMeridional', GMBolusVelocityMeridional) call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) - call mpas_pool_get_array(meshPool, 'nEdgesArray', nEdgesArray) call mpas_pool_get_array(meshPool, 'cellsOnEdge', cellsOnEdge) call mpas_pool_get_array(meshPool, 'maxLevelEdgeTop', maxLevelEdgeTop) @@ -231,7 +231,6 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocityTimesTemperature', normalVelocityTimesTemperature) call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocitySquared', normalVelocitySquared) - nEdges = nEdgesArray(2) do iEdge = 1,nEdges cell1 = cellsOnEdge(1,iEdge) cell2 = cellsOnEdge(2,iEdge) From 03da3c7fc6be1c71e59b3b63c23e3e31718a3e21 Mon Sep 17 00:00:00 2001 From: Luke Van Roekel Date: Fri, 22 May 2020 13:30:58 -0700 Subject: [PATCH 3/5] Adds bolus velocity to eddy heat flux --- .../Registry_eddy_product_variables.xml | 16 +++++++++++----- .../mpas_ocn_eddy_product_variables.F | 10 ++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml index 880f425f8e..291377e006 100644 --- a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml +++ b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml @@ -44,14 +44,20 @@ /> - + + + - + - - + + diff --git a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F index aae38822a1..7972ad751d 100644 --- a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F +++ b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F @@ -187,7 +187,7 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ real (kind=RKIND), dimension(:,:), pointer :: velocityZonal, velocityMeridional, GMBolusVelocityZonal, GMBolusVelocityMeridional, & velocityZonalSquared, velocityMeridionalSquared, velocityZonalTimesTemperature, velocityMeridionalTimesTemperature, & velocityZonalTimesTemperature_GM, velocityMeridionalTimesTemperature_GM, normalVelocity, normalVelocitySquared, & - normalVelocityTimesTemperature + normalVelocityTimesTemperature, normalGMBolusVelocity, normalGMBolusVelocityTimesTemperature, normalGMBolusVelocitySquared real (kind=RKIND), dimension(:,:,:), pointer :: activeTracers err = 0 @@ -206,7 +206,8 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_dimension(block % dimensions, 'nCellsSolve', nCellsSolve) call mpas_pool_get_dimension(block % dimensions, 'nEdges', nEdges) - call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity) + call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity, 1) + call mpas_pool_get_array(diagnosticsPool, 'normalGMBolusVelocity', normalGMBolusVelocity) call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracers, 1) call mpas_pool_get_dimension(tracersPool, 'index_temperature', index_temperature) @@ -228,6 +229,8 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityZonalTimesTemperature_GM', velocityZonalTimesTemperature_GM) call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityMeridionalTimesTemperature_GM', & velocityMeridionalTimesTemperature_GM) + call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocityTimesTemperature', normalGMBolusVelocityTimesTemperature) + call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocitySquared', normalGMBolusVelocitySquared) call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocityTimesTemperature', normalVelocityTimesTemperature) call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocitySquared', normalVelocitySquared) @@ -236,6 +239,9 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ cell2 = cellsOnEdge(2,iEdge) do k = 1, maxLevelEdgeTop(iEdge) + normalGMBolusVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & + activeTracers(index_temperature,k,cell2)) * normalGMBolusVelocity(k,iEdge) + normalGMBolusVelocitySquared(k,iEdge) = normalGMBolusVelocity(k,iEdge)**2 normalVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & activeTracers(index_temperature,k,cell2)) * normalVelocity(k,iEdge) normalVelocitySquared(k,iEdge) = normalVelocity(k,iEdge)**2 From e38047a8507e7412e5f1be5eece0568a75787ce5 Mon Sep 17 00:00:00 2001 From: Mark Petersen Date: Wed, 27 May 2020 05:49:41 -0600 Subject: [PATCH 4/5] White space --- .../Registry_eddy_product_variables.xml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml index 291377e006..6c1e2bdb56 100644 --- a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml +++ b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml @@ -39,24 +39,24 @@ - - - - - - + + + + + + - - - - + + + + From 419a282cdd0f7286f6346721eb2f7f6e8a7f2cee Mon Sep 17 00:00:00 2001 From: Mark Petersen Date: Fri, 29 May 2020 11:53:04 -0600 Subject: [PATCH 5/5] Add package to gm eddy product variables --- .../Registry_eddy_product_variables.xml | 16 ++- .../mpas_ocn_eddy_product_variables.F | 111 +++++++++++++----- 2 files changed, 89 insertions(+), 38 deletions(-) diff --git a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml index 6c1e2bdb56..696466c101 100644 --- a/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml +++ b/src/core_ocean/analysis_members/Registry_eddy_product_variables.xml @@ -39,23 +39,27 @@ + + - - diff --git a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F index 7972ad751d..35f735ebf7 100644 --- a/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F +++ b/src/core_ocean/analysis_members/mpas_ocn_eddy_product_variables.F @@ -44,6 +44,7 @@ module ocn_eddy_product_variables use mpas_stream_manager use ocn_constants + use ocn_config use ocn_diagnostics_routines implicit none @@ -207,15 +208,12 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_dimension(block % dimensions, 'nEdges', nEdges) call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity, 1) - call mpas_pool_get_array(diagnosticsPool, 'normalGMBolusVelocity', normalGMBolusVelocity) call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracers, 1) call mpas_pool_get_dimension(tracersPool, 'index_temperature', index_temperature) call mpas_pool_get_array(statePool, 'ssh',ssh, 1) call mpas_pool_get_array(diagnosticsPool, 'velocityZonal', velocityZonal) call mpas_pool_get_array(diagnosticsPool, 'velocityMeridional', velocityMeridional) - call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityZonal',GMBolusVelocityZonal) - call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityMeridional', GMBolusVelocityMeridional) call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) call mpas_pool_get_array(meshPool, 'cellsOnEdge', cellsOnEdge) call mpas_pool_get_array(meshPool, 'maxLevelEdgeTop', maxLevelEdgeTop) @@ -226,39 +224,88 @@ subroutine ocn_compute_eddy_product_variables(domain, timeLevel, err)!{{{ call mpas_pool_get_array(eddyProductVariablesAMPool, 'velocityZonalTimesTemperature', velocityZonalTimesTemperature) call mpas_pool_get_array(eddyProductVariablesAMPool, 'velocityMeridionalTimesTemperature', & velocityMeridionalTimesTemperature) - call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityZonalTimesTemperature_GM', velocityZonalTimesTemperature_GM) - call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityMeridionalTimesTemperature_GM', & - velocityMeridionalTimesTemperature_GM) - call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocityTimesTemperature', normalGMBolusVelocityTimesTemperature) - call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocitySquared', normalGMBolusVelocitySquared) call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocityTimesTemperature', normalVelocityTimesTemperature) call mpas_pool_get_array(eddyProductVariablesAMPool,'normalVelocitySquared', normalVelocitySquared) - do iEdge = 1,nEdges - cell1 = cellsOnEdge(1,iEdge) - cell2 = cellsOnEdge(2,iEdge) - - do k = 1, maxLevelEdgeTop(iEdge) - normalGMBolusVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & - activeTracers(index_temperature,k,cell2)) * normalGMBolusVelocity(k,iEdge) - normalGMBolusVelocitySquared(k,iEdge) = normalGMBolusVelocity(k,iEdge)**2 - normalVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & - activeTracers(index_temperature,k,cell2)) * normalVelocity(k,iEdge) - normalVelocitySquared(k,iEdge) = normalVelocity(k,iEdge)**2 + ! if GM is active, include the GM variables. + ! I repeated the block of code here for better performance, rather than + ! split the GM and non-GM variables into separate loops. + if (config_use_GM) then + call mpas_pool_get_array(diagnosticsPool, 'normalGMBolusVelocity', normalGMBolusVelocity) + call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityZonal',GMBolusVelocityZonal) + call mpas_pool_get_array(diagnosticsPool, 'GMBolusVelocityMeridional', GMBolusVelocityMeridional) + call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityZonalTimesTemperature_GM', velocityZonalTimesTemperature_GM) + call mpas_pool_get_array(eddyProductVariablesAMPool,'velocityMeridionalTimesTemperature_GM', & + velocityMeridionalTimesTemperature_GM) + call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocityTimesTemperature', normalGMBolusVelocityTimesTemperature) + call mpas_pool_get_array(eddyProductVariablesAMPool,'normalGMBolusVelocitySquared', normalGMBolusVelocitySquared) + + !$omp parallel + !$omp do schedule(runtime) private(cell1, cell2, k) + do iEdge = 1,nEdges + cell1 = cellsOnEdge(1,iEdge) + cell2 = cellsOnEdge(2,iEdge) + + do k = 1, maxLevelEdgeTop(iEdge) + normalVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & + activeTracers(index_temperature,k,cell2)) * normalVelocity(k,iEdge) + normalVelocitySquared(k,iEdge) = normalVelocity(k,iEdge)**2 + normalGMBolusVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & + activeTracers(index_temperature,k,cell2)) * normalGMBolusVelocity(k,iEdge) + normalGMBolusVelocitySquared(k,iEdge) = normalGMBolusVelocity(k,iEdge)**2 + end do end do - end do - - do iCell = 1,nCellsSolve - SSHSquared(iCell) = ssh(iCell)**2 - do k = 1, maxLevelCell(iCell) - velocityZonalSquared(k,iCell) = velocityZonal(k,iCell)**2 - velocityMeridionalSquared(k,iCell) = velocityMeridional(k,iCell)**2 - velocityZonalTimesTemperature(k,iCell) = velocityZonal(k,iCell)*activeTracers(index_temperature,k,iCell) - velocityMeridionalTimesTemperature(k,iCell) = velocityMeridional(k,iCell)*activeTracers(index_temperature,k,iCell) - velocityZonalTimesTemperature_GM(k,iCell) = GMBolusVelocityZonal(k,iCell)*activeTracers(index_temperature,k,iCell) - velocityMeridionalTimesTemperature_GM(k,iCell) = GMBolusVelocityMeridional(k,iCell)*activeTracers(index_temperature,k,iCell) - end do - end do + !$omp end do + !$omp end parallel + + !$omp parallel + !$omp do schedule(runtime) private(k) + do iCell = 1,nCellsSolve + SSHSquared(iCell) = ssh(iCell)**2 + do k = 1, maxLevelCell(iCell) + velocityZonalSquared(k,iCell) = velocityZonal(k,iCell)**2 + velocityMeridionalSquared(k,iCell) = velocityMeridional(k,iCell)**2 + velocityZonalTimesTemperature(k,iCell) = velocityZonal(k,iCell)*activeTracers(index_temperature,k,iCell) + velocityMeridionalTimesTemperature(k,iCell) = velocityMeridional(k,iCell)*activeTracers(index_temperature,k,iCell) + velocityZonalTimesTemperature_GM(k,iCell) = GMBolusVelocityZonal(k,iCell)*activeTracers(index_temperature,k,iCell) + velocityMeridionalTimesTemperature_GM(k,iCell) = GMBolusVelocityMeridional(k,iCell)*activeTracers(index_temperature,k,iCell) + end do + end do + !$omp end do + !$omp end parallel + + ! if GM is not active, do exactly the same computation as above but + ! without the GM variables. + else + !$omp parallel + !$omp do schedule(runtime) private(cell1, cell2, k) + do iEdge = 1,nEdges + cell1 = cellsOnEdge(1,iEdge) + cell2 = cellsOnEdge(2,iEdge) + + do k = 1, maxLevelEdgeTop(iEdge) + normalVelocityTimesTemperature(k,iEdge) = 0.5_RKIND*(activeTracers(index_temperature,k,cell1) + & + activeTracers(index_temperature,k,cell2)) * normalVelocity(k,iEdge) + normalVelocitySquared(k,iEdge) = normalVelocity(k,iEdge)**2 + end do + end do + !$omp end do + !$omp end parallel + + !$omp parallel + !$omp do schedule(runtime) private(k) + do iCell = 1,nCellsSolve + SSHSquared(iCell) = ssh(iCell)**2 + do k = 1, maxLevelCell(iCell) + velocityZonalSquared(k,iCell) = velocityZonal(k,iCell)**2 + velocityMeridionalSquared(k,iCell) = velocityMeridional(k,iCell)**2 + velocityZonalTimesTemperature(k,iCell) = velocityZonal(k,iCell)*activeTracers(index_temperature,k,iCell) + velocityMeridionalTimesTemperature(k,iCell) = velocityMeridional(k,iCell)*activeTracers(index_temperature,k,iCell) + end do + end do + !$omp end do + !$omp end parallel + endif block => block % next end do