-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add free-slip, partial-slip and no-slip momentum BCs #49
base: master
Are you sure you want to change the base?
Changes from all commits
74540c0
bbd2b9c
7947475
e9d759a
6be1fe7
a6f60e1
548bdbf
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 |
---|---|---|
|
@@ -567,7 +567,7 @@ end subroutine ocn_diagnostic_solve!}}} | |
! routine ocn_relativeVorticity_circulation | ||
! | ||
!> \brief Computes relative vorticity and circulation | ||
!> \author Mark Petersen, Doug Jacobsen, Todd Ringler | ||
!> \author Mark Petersen, Doug Jacobsen, Todd Ringler, Darren Engwirda | ||
!> \date November 2013 | ||
!> \details | ||
!> Computes relative vorticity and circulation | ||
|
@@ -607,7 +607,7 @@ subroutine ocn_relativeVorticity_circulation(relativeVorticity, circulation, nor | |
|
||
integer :: iVertex, iEdge, i, k | ||
|
||
real (kind=RKIND) :: invAreaTri1, r_tmp | ||
real (kind=RKIND) :: invAreaTri1, r_tmp, wall_slip_factor | ||
|
||
err = 0 | ||
|
||
|
@@ -627,24 +627,36 @@ subroutine ocn_relativeVorticity_circulation(relativeVorticity, circulation, nor | |
!$omp end do | ||
#endif | ||
|
||
! no-slip = 0.0 | ||
! free-slip = 1.0 | ||
! partial-slip in-between | ||
wall_slip_factor = config_wall_slip_factor | ||
|
||
#ifdef MPAS_OPENACC | ||
!$acc parallel loop & | ||
!$acc present(circulation, relativeVorticity, areaTriangle, edgesOnVertex, & | ||
!$acc maxLevelVertexBot, dcEdge, normalVelocity, edgeSignOnVertex, & | ||
!$acc minLevelVertexTop) & | ||
!$acc private(invAreaTri1, iVertex, iEdge, k, r_tmp) | ||
!$acc present(circulation, relativeVorticity, edgesOnVertex, & | ||
!$acc maxLevelVertexBot, dcEdge, normalVelocity, & | ||
!$acc minLevelVertexTop, areaTriangle, edgeSignOnVertex) & | ||
!$acc private(invAreaTri1, i, iEdge, k, r_tmp, wall_slip_factor) | ||
#else | ||
!$omp do schedule(runtime) private(invAreaTri1, i, iEdge, k, r_tmp) | ||
!$omp do schedule(runtime) & | ||
!$omp private(invAreaTri1, i, iEdge, k, r_tmp, wall_slip_factor) | ||
#endif | ||
do iVertex = 1, nVerticesAll | ||
invAreaTri1 = 1.0_RKIND / areaTriangle(iVertex) | ||
do i = 1, vertexDegree | ||
iEdge = edgesOnVertex(i, iVertex) | ||
do k = minLevelVertexTop(iVertex), maxLevelVertexBot(iVertex) | ||
r_tmp = dcEdge(iEdge) * normalVelocity(k, iEdge) | ||
circulation(k, iVertex) = circulation(k, iVertex) + edgeSignOnVertex(i, iVertex) * r_tmp | ||
relativeVorticity(k, iVertex) = relativeVorticity(k, iVertex) + edgeSignOnVertex(i, iVertex) * r_tmp * invAreaTri1 | ||
do k = minLevelVertexTop(iVertex), maxLevelVertexBot(iVertex) | ||
do i = 1, vertexDegree | ||
iEdge = edgesOnVertex(i, iVertex) | ||
r_tmp = edgeSignOnVertex(i, iVertex) * & | ||
dcEdge(iEdge) * normalVelocity(k, iEdge) | ||
circulation(k, iVertex) = circulation(k, iVertex) + r_tmp | ||
end do | ||
! no-slip: curl(u) unchanged | ||
! free-slip: curl(u) = 0.0 | ||
! partial-slip: curl(u) reduced | ||
circulation(k, iVertex) = circulation(k, iVertex) * & | ||
(1.0_RKIND - wall_slip_factor * boundaryVertex(k, iVertex)) | ||
relativeVorticity(k, iVertex) = circulation(k, iVertex) * invAreaTri1 | ||
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. The changes in this loop are what is needed to include 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. @dengwirda, is there a reason to exchange loop order here? It seems like the order of operations issue could be avoided by applying the |
||
end do | ||
end do | ||
#ifndef MPAS_OPENACC | ||
|
@@ -1008,11 +1020,11 @@ subroutine ocn_diagnostic_solve_vorticity(dt, & | |
cell1, cell2 ! neighbor cell addresses | ||
|
||
real(kind=RKIND) :: & | ||
invAreaTri1, &! 1/triangle area | ||
invAreaCell1, &! 1/cell area | ||
invLength, &! 1/length | ||
layerThicknessVertex, &! layer thickness at vertex | ||
apvm_scale_factor ! scale factor for APVM form | ||
apvm_scale_factor, &! scale factor for APVM form | ||
areaDual ! unmaksed dual-cell overlap | ||
|
||
! Local arrays | ||
! normalizedPlanetaryVorticityVertex: earth's rotational rate | ||
|
@@ -1052,25 +1064,29 @@ subroutine ocn_diagnostic_solve_vorticity(dt, & | |
!$acc present(normalizedRelativeVorticityVertex, & | ||
!$acc normalizedPlanetaryVorticityVertex, & | ||
!$acc relativeVorticity, fVertex, layerThickness, & | ||
!$acc areaTriangle, kiteAreasOnVertex, cellsOnVertex, & | ||
!$acc maxLevelVertexBot) & | ||
!$acc private(i, k, iCell, invAreaTri1, layerThicknessVertex) | ||
!$acc kiteAreasOnVertex, cellsOnVertex, & | ||
!$acc minLevelVertexTop, maxLevelVertexBot) & | ||
!$acc private(i, k, iCell, areaDual, layerThicknessVertex) | ||
#else | ||
!$omp parallel | ||
!$omp do schedule(runtime) & | ||
!$omp private(i, k, iCell, invAreaTri1, layerThicknessVertex) | ||
!$omp private(i, k, iCell, areaDual, layerThicknessVertex) | ||
#endif | ||
do iVertex = 1, nVertices | ||
invAreaTri1 = 1.0_RKIND / areaTriangle(iVertex) | ||
do k = 1, maxLevelVertexBot(iVertex) | ||
normalizedRelativeVorticityVertex(:,iVertex) = 0.0_RKIND | ||
normalizedPlanetaryVorticityVertex(:,iVertex) = 0.0_RKIND | ||
do k = minLevelVertexTop(iVertex), maxLevelVertexBot(iVertex) | ||
layerThicknessVertex = 0.0_RKIND | ||
areaDual = 0.0_RKIND ! only the unmasked kites | ||
do i = 1, vertexDegree | ||
iCell = cellsOnVertex(i,iVertex) | ||
layerThicknessVertex = layerThicknessVertex & | ||
+ layerThickness(k,iCell) & | ||
* kiteAreasOnVertex(i,iVertex) | ||
areaDual = areaDual + cellMask(k,iCell) & | ||
* kiteAreasOnVertex(i,iVertex) | ||
end do | ||
layerThicknessVertex = layerThicknessVertex*invAreaTri1 | ||
layerThicknessVertex = layerThicknessVertex/areaDual | ||
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. @xylar I see what you are saying. This is the change where |
||
if (layerThicknessVertex == 0) cycle | ||
|
||
normalizedRelativeVorticityVertex(k,iVertex) = & | ||
|
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.
Is
boundaryVertex
also needed in thepresent()
arguments?