-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate higher-order flux across grounding line #94
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -166,7 +166,8 @@ subroutine li_advection_thickness_tracers(& | |||||
layerThickness, & ! thickness of each layer | ||||||
layerThicknessOld, & ! old layer thickness | ||||||
layerThicknessEdge, & ! layer thickness on upstream edge of cell | ||||||
normalVelocity ! horizontal velocity on interfaces | ||||||
normalVelocity, & ! horizontal velocity on interfaces | ||||||
layerThicknessEdgeFlux ! higher order thickness flux on layers and edges | ||||||
|
||||||
real (kind=RKIND), dimension(:,:,:), pointer :: & | ||||||
advectedTracers, & ! values of advected tracers | ||||||
|
@@ -193,7 +194,6 @@ subroutine li_advection_thickness_tracers(& | |||||
|
||||||
! Allocatable arrays need for flux-corrected transport advection | ||||||
real (kind=RKIND), dimension(:,:,:), allocatable :: tend | ||||||
real (kind=RKIND), dimension(:,:,:), allocatable :: activeTracerHorizontalAdvectionEdgeFlux | ||||||
|
||||||
integer, dimension(:), pointer :: & | ||||||
cellMask, & ! integer bitmask for cells | ||||||
|
@@ -292,6 +292,7 @@ subroutine li_advection_thickness_tracers(& | |||||
|
||||||
! get arrays from the velocity pool | ||||||
call mpas_pool_get_array(velocityPool, 'layerNormalVelocity', layerNormalVelocity) | ||||||
call mpas_pool_get_array(velocityPool, 'layerThicknessEdgeFlux', layerThicknessEdgeFlux) | ||||||
call mpas_pool_get_array(velocityPool, 'normalVelocity', normalVelocity) | ||||||
call mpas_pool_get_array(velocityPool, 'fluxAcrossGroundingLine', fluxAcrossGroundingLine) | ||||||
call mpas_pool_get_array(velocityPool, 'fluxAcrossGroundingLineOnCells', fluxAcrossGroundingLineOnCells) | ||||||
|
@@ -413,8 +414,7 @@ subroutine li_advection_thickness_tracers(& | |||||
(trim(config_tracer_advection) .eq. 'fct' ) ) then | ||||||
allocate(tend(nTracers,nVertLevels,nCells+1)) | ||||||
tend(:,:,:) = 0.0_RKIND | ||||||
allocate(activeTracerHorizontalAdvectionEdgeFlux(nTracers,nVertLevels+1,nEdges+1)) | ||||||
activeTracerHorizontalAdvectionEdgeFlux(:,:,:) = 0.0_RKIND | ||||||
layerThicknessEdgeFlux(:,:) = 0.0_RKIND | ||||||
endif | ||||||
|
||||||
! Transport thickness and tracers | ||||||
|
@@ -481,25 +481,25 @@ subroutine li_advection_thickness_tracers(& | |||||
call li_tracer_advection_fct_tend(& | ||||||
tend, advectedTracers, layerThicknessOld, & | ||||||
layerThicknessEdge * layerNormalVelocity, 0 * normalVelocity, dt, & | ||||||
nTracers, activeTracerHorizontalAdvectionEdgeFlux, computeBudgets=.false.)!{{{ | ||||||
nTracers, layerThicknessEdgeFlux, computeBudgets=.false.)!{{{ | ||||||
elseif (trim(config_thickness_advection) .eq. 'fct') then | ||||||
! Call fct routine for thickness first, and use activeTracerHorizontalAdvectionEdgeFlux | ||||||
! Call fct routine for thickness first, and use layerThicknessEdgeFlux | ||||||
! returned by that call as normalThicknessFlux for call to tracer fct | ||||||
call li_tracer_advection_fct_tend(& | ||||||
tend(nTracers:,:,:), advectedTracers(nTracers:,:,:), layerThicknessOld * 0.0_RKIND + 1.0_RKIND, & | ||||||
layerNormalVelocity, 0.0_RKIND * normalVelocity, dt, & | ||||||
1, activeTracerHorizontalAdvectionEdgeFlux(nTracers:,:,:), computeBudgets=.false.) | ||||||
1, layerThicknessEdgeFlux, computeBudgets=.false.) | ||||||
! layerThickness is last tracer. However, for some reason | ||||||
! this: layerThickness(:,:) = advectedTracers(nTracers,:,:) does not conserve mass! | ||||||
! This does conserve mass: | ||||||
layerThickness(:,:) = layerThickness(:,:) + tend(nTracers,:,:) * dt | ||||||
|
||||||
if (trim(config_tracer_advection) .eq. 'fct') then | ||||||
! Call fct for tracers, using activeTracerHorizontalAdvectionEdgeFlux | ||||||
! Call fct for tracers, using layerThicknessEdgeFlux | ||||||
! from fct thickness advection as normalThicknessFlux | ||||||
call li_tracer_advection_fct_tend(& | ||||||
tend(1:nTracers-1,:,:), advectedTracers(1:nTracers-1,:,:), layerThicknessOld, & | ||||||
activeTracerHorizontalAdvectionEdgeFlux(nTracers,:,:), 0.0_RKIND * normalVelocity, dt, & | ||||||
layerThicknessEdgeFlux, 0.0_RKIND * normalVelocity, dt, & | ||||||
nTracers-1, computeBudgets=.false.) | ||||||
elseif (trim(config_tracer_advection) .eq. 'none') then | ||||||
! do nothing | ||||||
|
@@ -642,10 +642,16 @@ subroutine li_advection_thickness_tracers(& | |||||
GLfluxSign = -1.0_RKIND | ||||||
theGroundedCell = iCell2 | ||||||
endif | ||||||
do k = 1, nVertLevels | ||||||
thicknessFluxEdge = layerNormalVelocity(k,iEdge) * dvEdge(iEdge) * layerThicknessEdge(k,iEdge) | ||||||
fluxAcrossGroundingLine(iEdge) = fluxAcrossGroundingLine(iEdge) + GLfluxSign * thicknessFluxEdge / dvEdge(iEdge) | ||||||
enddo | ||||||
if (trim(config_thickness_advection) == 'fct') then | ||||||
do k = 1, nVertLevels | ||||||
fluxAcrossGroundingLine(iEdge) = fluxAcrossGroundingLine(iEdge) + GLfluxSign * layerThicknessEdgeFlux(k,iEdge) | ||||||
enddo | ||||||
else | ||||||
do k = 1, nVertLevels | ||||||
thicknessFluxEdge = layerNormalVelocity(k,iEdge) * dvEdge(iEdge) * layerThicknessEdge(k,iEdge) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about using the new variable here so that if we ever want to use it in output we have that field available regardless of advection scheme?
Suggested change
(and corresponding adjustment to 652) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 8be7fbb |
||||||
fluxAcrossGroundingLine(iEdge) = fluxAcrossGroundingLine(iEdge) + GLfluxSign * thicknessFluxEdge / dvEdge(iEdge) | ||||||
enddo | ||||||
endif | ||||||
! assign to grounded cell in fluxAcrossGroundingLineOnCells | ||||||
if (thickness(theGroundedCell) <= 0.0_RKIND) then | ||||||
! This should never be the case, but checking to avoid possible divide by zero | ||||||
|
@@ -714,8 +720,7 @@ subroutine li_advection_thickness_tracers(& | |||||
advCoefs3rd, & | ||||||
advMaskHighOrder, & | ||||||
advMask2ndOrder, & | ||||||
tend, & | ||||||
activeTracerHorizontalAdvectionEdgeFlux) | ||||||
tend) | ||||||
endif | ||||||
|
||||||
! clean up | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicky question - could/should this be called just
layerEdgeFlux
? I don't feel strongly about this and it's not important enough to change everywhere unless you like the idea.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MPAS-Ocean calls it
normalThicknessFlux
, so I left "thickness" in the name. I could go either way.