Skip to content

Commit

Permalink
rename splitexpl_* flag to shorter se_*
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz committed Sep 15, 2023
1 parent 57256cf commit 2898ca2
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 86 deletions.
10 changes: 10 additions & 0 deletions config/namelist.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,15 @@ use_wsplit = .false. ! Switch for implicite/explicte splitting of vert. veloci
wsplit_maxcfl= 1.0 ! maximum allowed CFL criteria in vertical (0.5 < w_max_cfl < 1.)
! in older FESOM it used to be w_exp_max=1.e-3
ldiag_KE=.false. ! activates energy diagnostics

use_ssh_se_subcycl = .false.
se_BTsteps = 50 !50
se_BTtheta = 0.14 ! default: 0.14, core2 stability plateu@ 0.37
se_bottdrag = .true.
se_bdrag_si = .true. ! bottomdrag semi-implicite/explicite
se_visc = .true.
se_visc_gamma0 = 10 ! 150
se_visc_gamma1 = 19500 ! 150
se_visc_gamma2 = 0
/

30 changes: 15 additions & 15 deletions src/MOD_DYN.F90
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,19 @@ MODULE MOD_DYN
real(kind=WP) :: wsplit_maxcfl = 1.0

! switch between ssh computation, by solver or split explicite subcycling
! use_ssh_splitexpl_subcycl = .false. --> solver
! use_ssh_splitexpl_subcycl = .true. --> split explicite subcycling
logical :: use_ssh_splitexpl_subcycl = .false.
! use_ssh_se_subcycl = .false. --> solver
! use_ssh_se_subcycl = .true. --> split explicite subcycling
logical :: use_ssh_se_subcycl = .false.

! barotropic subcycling time-steps and dissipation parameter
integer :: splitexpl_BTsteps = 50
real(kind=WP) :: splitexpl_BTtheta = 0.14_WP
logical :: splitexpl_bottdrag = .true.
logical :: splitexpl_bdrag_si = .true.
logical :: splitexpl_visc = .true.
real(kind=WP) :: splitexpl_visc_gamma0 = 10
real(kind=WP) :: splitexpl_visc_gamma1 = 2750
real(kind=WP) :: splitexpl_visc_gamma2 = 0
integer :: se_BTsteps = 50
real(kind=WP) :: se_BTtheta = 0.14_WP
logical :: se_bottdrag = .true.
logical :: se_bdrag_si = .true.
logical :: se_visc = .true.
real(kind=WP) :: se_visc_gamma0 = 10
real(kind=WP) :: se_visc_gamma1 = 2750
real(kind=WP) :: se_visc_gamma2 = 0

!___________________________________________________________________________
! energy diagnostic part: will be computed inside the model ("hard integration"):
Expand Down Expand Up @@ -266,7 +266,7 @@ subroutine WRITE_T_DYN(dynamics, unit, iostat, iomsg)
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_freeslip
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_wsplit
write(unit, iostat=iostat, iomsg=iomsg) dynamics%wsplit_maxcfl
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_splitexpl_subcycl
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_se_subcycl

!___________________________________________________________________________
call dynamics%solverinfo%WRITE_T_SOLVERINFO(unit)
Expand All @@ -287,7 +287,7 @@ subroutine WRITE_T_DYN(dynamics, unit, iostat, iomsg)
call write_bin_array(dynamics%fer_w , unit, iostat, iomsg)
call write_bin_array(dynamics%fer_uv, unit, iostat, iomsg)
end if
if (dynamics%use_ssh_splitexpl_subcycl) then
if (dynamics%use_ssh_se_subcycl) then
call write_bin_array(dynamics%se_uvh , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_rhs , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_4AB , unit, iostat, iomsg)
Expand Down Expand Up @@ -324,7 +324,7 @@ subroutine READ_T_DYN(dynamics, unit, iostat, iomsg)
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_freeslip
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_wsplit
read(unit, iostat=iostat, iomsg=iomsg) dynamics%wsplit_maxcfl
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_splitexpl_subcycl
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_se_subcycl

!___________________________________________________________________________
call dynamics%solverinfo%READ_T_SOLVERINFO(unit)
Expand All @@ -345,7 +345,7 @@ subroutine READ_T_DYN(dynamics, unit, iostat, iomsg)
call read_bin_array(dynamics%fer_w , unit, iostat, iomsg)
call read_bin_array(dynamics%fer_uv , unit, iostat, iomsg)
end if
if (dynamics%use_ssh_splitexpl_subcycl) then
if (dynamics%use_ssh_se_subcycl) then
call read_bin_array(dynamics%se_uvh , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_rhs , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_4AB , unit, iostat, iomsg)
Expand Down
2 changes: 1 addition & 1 deletion src/io_blowup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ subroutine ini_blowup_io(year, ice, dynamics, tracers, partit, mesh)
!___ALE related fields______________________________________________________
call def_variable(bid, 'hbar' , (/nod2D/) , 'ALE surface elevation hbar_n+0.5', 'm', hbar);
!!PS call def_variable(bid, 'hbar_old' , (/nod2D/) , 'ALE surface elevation hbar_n-0.5', 'm', hbar_old);
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
call def_variable(bid, 'd_eta' , (/nod2D/) , 'change in ssh from solver', 'm', dynamics%d_eta);
call def_variable(bid, 'ssh_rhs' , (/nod2D/) , 'RHS for the elevation', '?', dynamics%ssh_rhs);
call def_variable(bid, 'ssh_rhs_old', (/nod2D/) , 'RHS for the elevation', '?', dynamics%ssh_rhs_old);
Expand Down
2 changes: 1 addition & 1 deletion src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
!_______________________________________________________________________________
! Split-Explicite subcycling varaibles
CASE ('SPLIT-EXPL')
if (dynamics%use_ssh_splitexpl_subcycl) then
if (dynamics%use_ssh_se_subcycl) then
call def_stream(elem2D, myDim_elem2D , 'ubt' , 'zonal barotrop. transport' , '?' , dynamics%se_uvBT(1,:), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream(elem2D, myDim_elem2D , 'vbt' , 'merid. barotrop. transport', '?' , dynamics%se_uvBT(2,:), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream(elem2D, myDim_elem2D , 'ubt_rhs', 'zonal barotrop. transport RHS' , '?' , dynamics%se_uvBT_rhs(1,:), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
Expand Down
20 changes: 10 additions & 10 deletions src/oce_ale.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ subroutine vert_vel_ale(dynamics, partit, mesh)
fer_Wvel=> dynamics%fer_w(:,:)
end if

if ( .not. dynamics%use_ssh_splitexpl_subcycl) then
if ( .not. dynamics%use_ssh_se_subcycl) then
d_eta => dynamics%d_eta(:)
ssh_rhs => dynamics%ssh_rhs(:)
ssh_rhs_old => dynamics%ssh_rhs_old(:)
Expand Down Expand Up @@ -2535,7 +2535,7 @@ subroutine vert_vel_ale(dynamics, partit, mesh)
write(*,*) 'water_flux = ', water_flux(n)
write(*,*)
write(*,*) "eta_n = ", eta_n(n)
if ( .not. dynamics%use_ssh_splitexpl_subcycl) then
if ( .not. dynamics%use_ssh_se_subcycl) then
write(*,*) "d_eta = ", d_eta(n)
write(*,*) "ssh_rhs = ", ssh_rhs(n)
write(*,*) "ssh_rhs_old = ", ssh_rhs_old(n)
Expand Down Expand Up @@ -3467,7 +3467,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
! Energy diagnostic contribution
if (dynamics%ldiag_ke) then
! if use solver
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(elem, nz, nzmin, nzmax)
do elem=1, myDim_elem2D
nzmax = nlevels(elem)
Expand Down Expand Up @@ -3503,7 +3503,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
! Energy diagnostic contribution
if (dynamics%ldiag_ke) then
! if use solver
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(elem, nz, nzmin, nzmax)
do elem=1, myDim_elem2D
nzmax = nlevels(elem)
Expand Down Expand Up @@ -3550,7 +3550,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
!___________________________________________________________________________
if (flag_debug .and. mype==0) print *, achar(27)//'[36m'//' --> call impl_vert_visc_ale'//achar(27)//'[0m'
if(dynamics%use_ivertvisc) then
if ( .not. dynamics%use_ssh_splitexpl_subcycl ) then
if ( .not. dynamics%use_ssh_se_subcycl ) then
call impl_vert_visc_ale(dynamics,partit, mesh)
else
call impl_vert_visc_ale_vtransp(dynamics, partit, mesh)
Expand All @@ -3560,7 +3560,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
!___________________________________________________________________________
if (dynamics%ldiag_ke) then
! if use solver
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(elem, nz, nzmin, nzmax)
do elem=1, myDim_elem2D
nzmax = nlevels(elem)
Expand Down Expand Up @@ -3592,7 +3592,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
! Compute SSH via solver
! Update stiffness matrix by dhe=hbar(n+1/2)-hbar(n-1/2) on elements, only
! needed for zlevel and zstar
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
if (.not. trim(which_ale)=='linfs') call update_stiff_mat_ale(partit, mesh)
if (flag_debug .and. mype==0) print *, achar(27)//'[36m'//' --> call compute_ssh_rhs_ale'//achar(27)//'[0m'
! ssh_rhs=-alpha*\nabla\int(U_n+U_rhs)dz-(1-alpha)*...
Expand Down Expand Up @@ -3658,7 +3658,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
call update_trim_vel_ale_vtransp(1, dynamics, partit, mesh)
t4=MPI_Wtime()
t5=t4
end if ! --> if (.not. dynamics%use_ssh_splitexpl_subcycl) then
end if ! --> if (.not. dynamics%use_ssh_se_subcycl) then

!___________________________________________________________________________
! Do horizontal and vertical scaling of GM/Redi diffusivity
Expand Down Expand Up @@ -3689,7 +3689,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
! The main step of ALE procedure --> this is were the magic happens --> here
! is decided how change in hbar is distributed over the vertical layers
if (flag_debug .and. mype==0) print *, achar(27)//'[36m'//' --> call vert_vel_ale'//achar(27)//'[0m'
if ( .not. dynamics%use_ssh_splitexpl_subcycl) then
if ( .not. dynamics%use_ssh_se_subcycl) then
call vert_vel_ale(dynamics, partit, mesh)
else
if (trim(which_ale)=='zstar' ) then
Expand Down Expand Up @@ -3723,7 +3723,7 @@ subroutine oce_timestep_ale(n, ice, dynamics, tracers, partit, mesh)
!___________________________________________________________________________
! Trim to make velocity consistent with BT velocity at n+1/2
! Velocity will be used to advance momentum
if (dynamics%use_ssh_splitexpl_subcycl) then
if (dynamics%use_ssh_se_subcycl) then
call update_trim_vel_ale_vtransp(2, dynamics, partit, mesh)
end if

Expand Down
42 changes: 21 additions & 21 deletions src/oce_ale_ssh_splitexpl_subcycl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -809,22 +809,22 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
UVBT_theta=>dynamics%se_uvBT_theta(:,:)
UVBT_mean =>dynamics%se_uvBT_mean(:,:)
UVBT_12 =>dynamics%se_uvBT_12(:,:)
if (dynamics%splitexpl_bottdrag) then
if (dynamics%se_bottdrag) then
UV =>dynamics%uv(:,:,:)
bottomdrag =>dynamics%se_uvBT_stab_bdrag(:)
end if
if (dynamics%splitexpl_visc) then
if (dynamics%se_visc) then
UVBT_harmvisc=>dynamics%se_uvBT_stab_hvisc(:,:)
end if

!___________________________________________________________________________
! Dissipation parameter of FB dissipative method 0.14 is the default value
! from Demange et al.
thetaBT= dynamics%splitexpl_BTtheta
thetaBT= dynamics%se_BTtheta

! BTsteps should be 30 or 40.
dtBT = dt/dynamics%splitexpl_BTsteps
BT_inv = 1.0_WP/(1.0_WP*dynamics%splitexpl_BTsteps)
dtBT = dt/dynamics%se_BTsteps
BT_inv = 1.0_WP/(1.0_WP*dynamics%se_BTsteps)

!___SPLIT-EXPLICITE STABILIZATION___________________________________________
! trim R (UVBT_rhs):
Expand All @@ -834,7 +834,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
! compute_BT_step_SE_ale)
! --> use only harmonmic viscosity operator applied to the barotropic
! velocity
if (dynamics%splitexpl_visc) then
if (dynamics%se_visc) then
!_______________________________________________________________________
! remove viscosity
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(edge, edelem, nzmax, hh, len, &
Expand All @@ -854,9 +854,9 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
update_ubt=(UVBT(1, edelem(1))-UVBT(1, edelem(2)))/hh
update_vbt=(UVBT(2, edelem(1))-UVBT(2, edelem(2)))/hh
vi=update_ubt*update_ubt + update_vbt*update_vbt
vi=-dt*sqrt(max(dynamics%splitexpl_visc_gamma0, &
max(dynamics%splitexpl_visc_gamma1*sqrt(vi), &
dynamics%splitexpl_visc_gamma2*vi) &
vi=-dt*sqrt(max(dynamics%se_visc_gamma0, &
max(dynamics%se_visc_gamma1*sqrt(vi), &
dynamics%se_visc_gamma2*vi) &
)*len)
update_ubt=update_ubt*vi
update_vbt=update_vbt*vi
Expand All @@ -883,11 +883,11 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
end do ! --> do edge=1, myDim_edge2D+eDim_edge2D
!$OMP END DO
!$OMP END PARALLEL
end if ! --> if (dynamics%splitexpl_visc) then
end if ! --> if (dynamics%se_visc) then

!___________________________________________________________________________
! remove bottom drag
if (dynamics%splitexpl_bottdrag) then
if (dynamics%se_bottdrag) then
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(elem, elnodes, nzmax, hh)
!$OMP DO
do elem=1, myDim_elem2D
Expand All @@ -901,7 +901,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
end do
!$OMP END DO
!$OMP END PARALLEL
end if ! --> if (dynamics%splitexpl_bottdrag) then
end if ! --> if (dynamics%se_bottdrag) then

!___________________________________________________________________________
! initialise UVBT_mean with zeros --> OMP style
Expand All @@ -914,14 +914,14 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
!___________________________________________________________________________
! eta_n elevation used in BT stepping, it is just a copy of eta_n
! UBT and VBT are transport velocities
do step=1, dynamics%splitexpl_BTsteps
do step=1, dynamics%se_BTsteps
!#######################################################################
!########## Dissipative forward--backward time stepping ##########
!#######################################################################

!_______________________________________________________________________
! compute harmonic viscosity for stability
if (dynamics%splitexpl_visc) then
if (dynamics%se_visc) then

!___________________________________________________________________
! initialise UVBT_harmvisc with zeros --> OMP style
Expand Down Expand Up @@ -950,9 +950,9 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
update_ubt=(UVBT(1, edelem(1))-UVBT(1, edelem(2)))/hh
update_vbt=(UVBT(2, edelem(1))-UVBT(2, edelem(2)))/hh
vi=update_ubt*update_ubt + update_vbt*update_vbt
vi=dt*sqrt(max(dynamics%splitexpl_visc_gamma0, &
max(dynamics%splitexpl_visc_gamma1*sqrt(vi), &
dynamics%splitexpl_visc_gamma2*vi) &
vi=dt*sqrt(max(dynamics%se_visc_gamma0, &
max(dynamics%se_visc_gamma1*sqrt(vi), &
dynamics%se_visc_gamma2*vi) &
)*len)
update_ubt=update_ubt*vi
update_vbt=update_vbt*vi
Expand All @@ -979,7 +979,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
end do ! --> do edge=1, myDim_edge2D+eDim_edge2D
!$OMP END DO
!$OMP END PARALLEL
end if ! -> if (dynamics%splitexpl_visc) then
end if ! -> if (dynamics%se_visc) then

!_______________________________________________________________________
! Advance velocities. I use SI stepping for the Coriolis
Expand Down Expand Up @@ -1046,7 +1046,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
!
! Semi-Implicit Coriolis
a = dtBT*ff*0.5_WP
if (dynamics%splitexpl_bdrag_si) then
if (dynamics%se_bdrag_si) then
b = 1.0_WP+BT_inv*bottomdrag(elem)/hh
else
b = 1.0_WP
Expand Down Expand Up @@ -1094,7 +1094,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)

!_______________________________________________________________________
! Store mid-step velocity (to trim 3D velocities in momentum)
if(step==dynamics%splitexpl_BTsteps/2) then
if(step==dynamics%se_BTsteps/2) then
UVBT_12=UVBT
end if

Expand Down Expand Up @@ -1161,7 +1161,7 @@ subroutine compute_BT_step_SE_ale(dynamics, partit, mesh)
!$OMP END MASTER
!$OMP BARRIER

end do ! --> do step=1, dynamics%splitexpl_BTsteps
end do ! --> do step=1, dynamics%se_BTsteps

!___________________________________________________________________________
hbar_old = hbar
Expand Down
6 changes: 3 additions & 3 deletions src/oce_ale_vel_rhs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ subroutine compute_vel_rhs(ice, dynamics, partit, mesh)
inv_rhowat=> ice%thermo%inv_rhowat

! if split-explicite ssh subcycling is used
if (dynamics%use_ssh_splitexpl_subcycl) then
if (dynamics%use_ssh_se_subcycl) then
UVh => dynamics%se_uvh
UVBT_4AB => dynamics%se_uvBT_4AB
end if
Expand Down Expand Up @@ -160,7 +160,7 @@ subroutine compute_vel_rhs(ice, dynamics, partit, mesh)
!_______________________________________________________________________
! when ssh split-explicite subcycling method is setted use transport velocities
! u*h, v*h instead of u,v
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
do nz=nzmin, nzmax-1
! add pressure gradient terms
UV_rhs( 1, nz, elem) = UV_rhs(1, nz, elem) + (Fx-pgf_x(nz, elem))*elem_area(elem)
Expand Down Expand Up @@ -216,7 +216,7 @@ subroutine compute_vel_rhs(ice, dynamics, partit, mesh)
if (mype==0) write(*,*) 'in moment not adapted mom_adv advection typ for ALE, check your namelist'
call par_ex(partit%MPI_COMM_FESOM, partit%mype, 1)
elseif (dynamics%momadv_opt==2) then
if (.not. dynamics%use_ssh_splitexpl_subcycl) then
if (.not. dynamics%use_ssh_se_subcycl) then
call momentum_adv_scalar(dynamics, partit, mesh)
else
call momentum_adv_scalar_transpv(dynamics, partit, mesh)
Expand Down
Loading

0 comments on commit 2898ca2

Please sign in to comment.