Skip to content

Commit

Permalink
make subcycling to work with partial cells
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz committed Sep 15, 2023
1 parent 8aa79ee commit c5b5c6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/oce_ale_ssh_splitexpl_subcycl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ subroutine compute_BT_rhs_SE_vtransp(dynamics, partit, mesh)

! total ocean depth H
!PS hh = sum(helem(nzmin:nzmax, elem))
!PS hh = -zbar_e_bot(elem) + sum(eta_n(elnodes))/3.0_WP
hh = -zbar_e_bot(elem) + sum(eta_n(elnodes))/3.0_WP

vert_sum_u=vert_sum_u + Fx*hh
Expand Down Expand Up @@ -843,7 +844,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
if (dynamics%se_visc) then
!_______________________________________________________________________
! remove viscosity
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(edge, edelem, ednodes, nzmax, hh, len, &
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(edge, edelem, ednodes, hh, len, &
!$OMP vi, update_ubt, update_vbt)
!$OMP DO
do edge=1, myDim_edge2D+eDim_edge2D
Expand All @@ -854,11 +855,12 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
! elem indices that participate in edge
edelem = edge_tri(:,edge)
ednodes = edges(:,edge)
nzmax = minval(nlevels(edelem))

! total ocean depth H
!PS nzmax = minval(nlevels(edelem))
!PS hh = -zbar(nzmax)
hh = -sum(zbar_e_bot(edelem))*0.5_WP + sum(hbar(ednodes))*0.5_WP
!PS hh = minval(-zbar_e_bot(edelem))
hh = -sum(zbar_e_bot(edelem))*0.5_WP + sum(hbar(ednodes))*0.5_WP

len = sqrt(sum(elem_area(edelem)))
update_ubt=(UVBT(1, edelem(1))-UVBT(1, edelem(2)))/hh
Expand Down Expand Up @@ -907,6 +909,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
! total ocean depth H
!PS hh = -zbar(nzmax)+sum(eta_n(elnodes))/3.0_WP
!PS hh = -zbar(nzmax)
!PS hh = -zbar_e_bot(elem)
hh = -zbar_e_bot(elem) + sum(hbar(elnodes))/3.0_WP

bottomdrag(elem) = dt*C_d*sqrt(UV(1, nzmax-1, elem)**2 + UV(2, nzmax-1, elem)**2)
Expand Down Expand Up @@ -946,7 +949,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
!$OMP END PARALLEL DO

!___________________________________________________________________
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(edge, edelem, ednodes, nzmax, hh, len, &
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(edge, edelem, ednodes, hh, len, &
!$OMP vi, update_ubt, update_vbt)
!$OMP DO
do edge=1, myDim_edge2D+eDim_edge2D
Expand All @@ -957,12 +960,13 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
! elem indices that participate in edge
edelem = edge_tri(:, edge)
ednodes = edges(:, edge)
nzmax = minval(nlevels(edelem))

! total ocean depth H
! total ocean depth H
!PS nzmax = minval(nlevels(edelem))
!PS hh = -zbar(nzmax)
!PS hh = minval(-zbar_e_bot(edelem))
hh = -sum(zbar_e_bot(edelem))*0.5_WP + sum(hbar(ednodes))*0.5_WP

len = sqrt(sum(elem_area(edelem)))
update_ubt=(UVBT(1, edelem(1))-UVBT(1, edelem(2)))/hh
update_vbt=(UVBT(2, edelem(1))-UVBT(2, edelem(2)))/hh
Expand Down Expand Up @@ -1013,6 +1017,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
! total ocean depth H
!PS hh = -zbar(nlevels(elem))+sum(eta_n(elnodes))/3.0_WP ! Total fluid depth
!PS hh = -zbar(nlevels(elem)) ! Total fluid depth
!PS hh = -zbar_e_bot(elem)
hh = -zbar_e_bot(elem) + sum(hbar(elnodes))/3.0_WP

ff = mesh%coriolis(elem)
Expand Down
2 changes: 1 addition & 1 deletion src/oce_dyn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ SUBROUTINE visc_filt_bcksct(dynamics, partit, mesh)
!PS UV_rhs(1,nz,ed)=UV_rhs(1,nz,ed)+(U_b(nz,ed) -dynamics%visc_easybsreturn*sum(U_c(nz,nelem))/3.0_WP)*(zbar(nz)-zbar(nz+1))
!PS UV_rhs(2,nz,ed)=UV_rhs(2,nz,ed)+(V_b(nz,ed) -dynamics%visc_easybsreturn*sum(V_c(nz,nelem))/3.0_WP)*(zbar(nz)-zbar(nz+1))
UV_rhs(1,nz,ed)=UV_rhs(1,nz,ed)+(U_b(nz,ed) -dynamics%visc_easybsreturn*sum(U_c(nz,nelem))/3.0_WP)*helem(nz, ed)
!PS UV_rhs(2,nz,ed)=UV_rhs(2,nz,ed)+(V_b(nz,ed) -dynamics%visc_easybsreturn*sum(V_c(nz,nelem))/3.0_WP)*helem(nz, ed)
UV_rhs(2,nz,ed)=UV_rhs(2,nz,ed)+(V_b(nz,ed) -dynamics%visc_easybsreturn*sum(V_c(nz,nelem))/3.0_WP)*helem(nz, ed)
END DO
else
Do nz=nzmin, nzmax-1
Expand Down

0 comments on commit c5b5c6d

Please sign in to comment.