From 2a6ff8ae73f3437a849c0b73fca68089d046002a Mon Sep 17 00:00:00 2001 From: bderembl Date: Mon, 19 May 2025 19:27:49 +0200 Subject: [PATCH 1/2] no stress bottom --- src/meanflow/friction.F90 | 46 ++++++++++++++++++++++----------------- src/meanflow/meanflow.F90 | 6 ++++- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/meanflow/friction.F90 b/src/meanflow/friction.F90 index d5575864..496aba6d 100644 --- a/src/meanflow/friction.F90 +++ b/src/meanflow/friction.F90 @@ -58,6 +58,7 @@ subroutine friction(nlev,kappa,avmolu,tx,ty,plume_type) use meanflow, only: h,z0b,h0b,MaxItz0b,z0s,za use meanflow, only: u,v,gravity use meanflow, only: u_taub,u_taubo,u_taus,drag,taub + use meanflow, only: bottom_stress use meanflow, only: charnock,charnock_val,z0s_min ! IMPLICIT NONE @@ -83,6 +84,8 @@ subroutine friction(nlev,kappa,avmolu,tx,ty,plume_type) !BOC drag = _ZERO_ + rr_s = _ZERO_ + rr_b = _ZERO_ ! use the Charnock formula to compute the surface roughness if (charnock) then @@ -92,32 +95,35 @@ subroutine friction(nlev,kappa,avmolu,tx,ty,plume_type) z0s=z0s_min end if - if (first) then - u_taub = u_taubo - first = .false. - else - u_taubo = u_taub - end if -! iterate bottom roughness length MaxItz0b times - do i=1,MaxItz0b - - if (avmolu.le.0) then - z0b=0.03*h0b + za + if (bottom_stress) then + if (first) then + u_taub = u_taubo + first = .false. else - z0b=0.1*avmolu/max(avmolu,u_taub)+0.03*h0b + za + u_taubo = u_taub end if +! iterate bottom roughness length MaxItz0b times + do i=1,MaxItz0b -! compute the factor r (version 1, with log-law) - rr_b=kappa/(log((z0b+h(1)/2)/z0b)) + if (avmolu.le.0) then + z0b=0.03*h0b + za + else + z0b=0.1*avmolu/max(avmolu,u_taub)+0.03*h0b + za + end if -! compute the factor r (version 2, with meanvalue log-law) -! frac=(z0b+h(1))/z0b -! rr=kappa/((z0b+h(1))/h(1)*log(frac)-1.) +! compute the factor r (version 1, with log-law) + rr_b=kappa/(log((z0b+h(1)/2)/z0b)) -! compute the friction velocity at the bottom - u_taub = rr_b*sqrt( u(1)*u(1) + v(1)*v(1) ) +! compute the factor r (version 2, with meanvalue log-law) +! frac=(z0b+h(1))/z0b +! rr=kappa/((z0b+h(1))/h(1)*log(frac)-1.) + +! compute the friction velocity at the bottom + u_taub = rr_b*sqrt( u(1)*u(1) + v(1)*v(1) ) + + end do + end if - end do ! compute the factor r (version 1, with log-law) if (plume_type .eq. 1) rr_s=kappa/(log((z0s+h(nlev)/2)/z0s)) diff --git a/src/meanflow/meanflow.F90 b/src/meanflow/meanflow.F90 index ec1a888d..44434d22 100644 --- a/src/meanflow/meanflow.F90 +++ b/src/meanflow/meanflow.F90 @@ -90,6 +90,7 @@ module meanflow ! the 'meanflow' configuration REALTYPE, public :: h0b + logical, public :: bottom_stress REALTYPE, public :: z0s_min logical, public :: charnock REALTYPE, public :: charnock_val @@ -168,6 +169,8 @@ subroutine init_meanflow_yaml() LEVEL1 'init_meanflow_yaml' branch => settings_store%get_typed_child('bottom') + call branch%get(bottom_stress, 'bottom_stress', 'compute bottom stress (default: true)', & + default=.true.) call branch%get(h0b, 'h0b', 'physical bottom roughness', 'm', & minimum=0._rk,default=0.05_rk, description='physical bottom roughness or bed roughness. This variable, h0b, relates to the hydrodynamic bottom roughness z0b as z0b = 0.03*h0b + 0.1*nu/ustar.') call branch%get(MaxItz0b, 'max_it_z0b', 'number of iterations for hydrodynamic bottom roughness', & @@ -238,6 +241,7 @@ subroutine post_init_meanflow(nlev,latitude) ! Initialize bottom and surface stress to zero ! They will be set in friction, but also used as input in the same routine. u_taub = _ZERO_ + u_taubo = _ZERO_ u_taus = _ZERO_ taub = _ZERO_ @@ -551,7 +555,7 @@ subroutine print_state_meanflow() grid_method,c1ad,c2ad,c3ad,c4ad,Tgrid,NNnorm, & SSnorm,dsurf,dtgrid,grid_file,gravity, & rotation_period,rho_0,avmolu,avmolT, avmolS, & - MaxItz0b,no_shear + MaxItz0b,no_shear,bottom_stress LEVEL2 'z0b,z0s,za',z0b,z0s,za LEVEL2 'cori',cori From bc7bc62a57523f8a1cf096c72667d274e2161f78 Mon Sep 17 00:00:00 2001 From: bderembl Date: Wed, 21 May 2025 17:49:42 +0200 Subject: [PATCH 2/2] change name for calc_bottom_stress --- src/meanflow/friction.F90 | 4 ++-- src/meanflow/meanflow.F90 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/meanflow/friction.F90 b/src/meanflow/friction.F90 index 496aba6d..8a9a8ea8 100644 --- a/src/meanflow/friction.F90 +++ b/src/meanflow/friction.F90 @@ -58,7 +58,7 @@ subroutine friction(nlev,kappa,avmolu,tx,ty,plume_type) use meanflow, only: h,z0b,h0b,MaxItz0b,z0s,za use meanflow, only: u,v,gravity use meanflow, only: u_taub,u_taubo,u_taus,drag,taub - use meanflow, only: bottom_stress + use meanflow, only: calc_bottom_stress use meanflow, only: charnock,charnock_val,z0s_min ! IMPLICIT NONE @@ -95,7 +95,7 @@ subroutine friction(nlev,kappa,avmolu,tx,ty,plume_type) z0s=z0s_min end if - if (bottom_stress) then + if (calc_bottom_stress) then if (first) then u_taub = u_taubo first = .false. diff --git a/src/meanflow/meanflow.F90 b/src/meanflow/meanflow.F90 index 44434d22..9623293b 100644 --- a/src/meanflow/meanflow.F90 +++ b/src/meanflow/meanflow.F90 @@ -90,7 +90,7 @@ module meanflow ! the 'meanflow' configuration REALTYPE, public :: h0b - logical, public :: bottom_stress + logical, public :: calc_bottom_stress REALTYPE, public :: z0s_min logical, public :: charnock REALTYPE, public :: charnock_val @@ -169,7 +169,7 @@ subroutine init_meanflow_yaml() LEVEL1 'init_meanflow_yaml' branch => settings_store%get_typed_child('bottom') - call branch%get(bottom_stress, 'bottom_stress', 'compute bottom stress (default: true)', & + call branch%get(calc_bottom_stress, 'calc_bottom_stress', 'compute bottom stress (default: true)', & default=.true.) call branch%get(h0b, 'h0b', 'physical bottom roughness', 'm', & minimum=0._rk,default=0.05_rk, description='physical bottom roughness or bed roughness. This variable, h0b, relates to the hydrodynamic bottom roughness z0b as z0b = 0.03*h0b + 0.1*nu/ustar.') @@ -555,7 +555,7 @@ subroutine print_state_meanflow() grid_method,c1ad,c2ad,c3ad,c4ad,Tgrid,NNnorm, & SSnorm,dsurf,dtgrid,grid_file,gravity, & rotation_period,rho_0,avmolu,avmolT, avmolS, & - MaxItz0b,no_shear,bottom_stress + MaxItz0b,no_shear,calc_bottom_stress LEVEL2 'z0b,z0s,za',z0b,z0s,za LEVEL2 'cori',cori