Skip to content
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

Rrfs ideal #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions model/dyn_core.F90
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ module dyn_core_mod
! </tr>
! </table>

use constants_mod, only: rdgas, radius, cp_air, pi
use constants_mod, only: rdgas, cp_air, pi
use fv_arrays_mod, only: radius !scaled for small earth
use mpp_mod, only: mpp_pe
use mpp_domains_mod, only: CGRID_NE, DGRID_NE, mpp_get_boundary, mpp_update_domains, &
domain2d
Expand All @@ -118,7 +119,7 @@ module dyn_core_mod
use nh_core_mod, only: Riem_Solver3, Riem_Solver_C, update_dz_c, update_dz_d, nh_bc
use tp_core_mod, only: copy_corners
use fv_timing_mod, only: timing_on, timing_off
use fv_diagnostics_mod, only: prt_maxmin, fv_time, prt_mxm
use fv_diagnostics_mod, only: prt_maxmin, fv_time, prt_mxm, is_ideal_case
use fv_diag_column_mod, only: do_diag_debug_dyn, debug_column_dyn
#ifdef ROT3
use fv_update_phys_mod, only: update_dwinds_phys
Expand Down Expand Up @@ -770,7 +771,7 @@ subroutine dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_map, n_split, zvir, cp,
!$OMP is,ie,js,je,isd,ied,jsd,jed,omga,delp,gridstruct,npx,npy, &
!$OMP ng,zh,vt,ptc,pt,u,v,w,uc,vc,ua,va,divgd,mfx,mfy,cx,cy, &
!$OMP crx,cry,xfx,yfx,q_con,zvir,sphum,nq,q,dt,bd,rdt,iep1,jep1, &
!$OMP heat_source,diss_est,ptop,first_call) &
!$OMP heat_source,diss_est,ptop,first_call, is_ideal_case, radius) &
!$OMP private(nord_k, nord_w, nord_t, damp_w, damp_t, d2_divg, &
!$OMP d_con_k,kgb, hord_m, hord_v, hord_t, hord_p, wk, heat_s,diss_e, z_rat)
do k=1,npz
Expand Down Expand Up @@ -813,7 +814,12 @@ subroutine dyn_core(npx, npy, npz, ng, sphum, nq, bdt, n_map, n_split, zvir, cp,

if ( k==1 ) then
! Divergence damping:
nord_k=0; d2_divg = max(0.01, flagstruct%d2_bg, flagstruct%d2_bg_k1)
nord_k=0;
if ( is_ideal_case ) then
d2_divg = max(flagstruct%d2_bg, flagstruct%d2_bg_k1)
else
d2_divg = max(0.01, flagstruct%d2_bg, flagstruct%d2_bg_k1)
endif
! Vertical velocity:
nord_w=0; damp_w = d2_divg
if ( flagstruct%do_vort_damp ) then
Expand Down
5 changes: 4 additions & 1 deletion model/fv_arrays.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ module fv_arrays_mod
use horiz_interp_type_mod, only: horiz_interp_type
use mpp_mod, only: mpp_broadcast
use platform_mod, only: r8_kind

use constants_mod, only: cnst_radius => radius, cnst_omega => omega

public

real(kind=r8_kind), public :: radius = cnst_radius
real(kind=r8_kind), public :: omega = cnst_omega

integer, public, parameter :: R_GRID = r8_kind

!Several 'auxiliary' structures are introduced here. These are for
Expand Down
16 changes: 6 additions & 10 deletions model/fv_dynamics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ module fv_dynamics_mod
use fv_mp_mod, only: start_group_halo_update, complete_group_halo_update
use fv_timing_mod, only: timing_on, timing_off
use diag_manager_mod, only: send_data
use fv_diagnostics_mod, only: fv_time, prt_mxm, range_check, prt_minmax
use fv_diagnostics_mod, only: fv_time, prt_mxm, range_check, prt_minmax, is_ideal_case
use mpp_domains_mod, only: DGRID_NE, CGRID_NE, mpp_update_domains, domain2D
use mpp_mod, only: mpp_pe
use field_manager_mod, only: MODEL_ATMOS
Expand Down Expand Up @@ -169,9 +169,7 @@ module fv_dynamics_mod
integer :: k_rf = 0

real :: agrav
#ifdef HIWPP
real, allocatable:: u00(:,:,:), v00(:,:,:)
#endif
private
public :: fv_dynamics

Expand Down Expand Up @@ -541,7 +539,7 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill,
endif

if( .not.flagstruct%RF_fast .and. flagstruct%tau .ne. 0. ) then
if ( gridstruct%grid_type<4 .or. gridstruct%bounded_domain ) then
if ( gridstruct%grid_type<4 .or. gridstruct%bounded_domain .or. is_ideal_case) then
! if ( flagstruct%RF_fast ) then
! call Ray_fast(abs(dt), npx, npy, npz, pfull, flagstruct%tau, u, v, w, &
! dp_ref, ptop, hydrostatic, flagstruct%rf_cutoff, bd)
Expand All @@ -551,7 +549,7 @@ subroutine fv_dynamics(npx, npy, npz, nq_tot, ng, bdt, consv_te, fill,
q, ncnst, &
#endif
ua, va, delz, gridstruct%agrid, cp_air, rdgas, ptop, hydrostatic, &
.not. gridstruct%bounded_domain, flagstruct%molecular_diffusion, consv_te, flagstruct%rf_cutoff, gridstruct, domain, bd)
.not. (gridstruct%bounded_domain .or. is_ideal_case), flagstruct%molecular_diffusion, consv_te, flagstruct%rf_cutoff, gridstruct, domain, bd)
! endif
else
call Rayleigh_Friction(abs(bdt), npx, npy, npz, ks, pfull, flagstruct%tau, u, v, w, pt, &
Expand Down Expand Up @@ -1257,7 +1255,7 @@ subroutine Rayleigh_Super(dt, npx, npy, npz, ks, pm, phis, tau, tau_w, u, v, w,


if ( .not. RF_initialized ) then
#ifdef HIWPP
if ( is_ideal_case )then
allocate ( u00(is:ie, js:je+1,npz) )
allocate ( v00(is:ie+1,js:je ,npz) )
!$OMP parallel do default(none) shared(is,ie,js,je,npz,u00,u,v00,v)
Expand All @@ -1273,7 +1271,7 @@ subroutine Rayleigh_Super(dt, npx, npy, npz, ks, pm, phis, tau, tau_w, u, v, w,
enddo
enddo
enddo
#endif
endif
#ifdef SMALL_EARTH_TEST ! changed!!!
tau0 = abs( tau )
tau1 = abs( tau_w )
Expand Down Expand Up @@ -1332,9 +1330,7 @@ subroutine Rayleigh_Super(dt, npx, npy, npz, ks, pm, phis, tau, tau_w, u, v, w,
call timing_off('COMM_TOTAL')

!$OMP parallel do default(none) shared(is,ie,js,je,kmax,pm,rf_cutoff,w,rf,u,v, &
#ifdef HIWPP
!$OMP u00,v00, &
#endif
!$OMP u00,v00, is_ideal_case, &
#ifdef MULTI_GASES
!$OMP q, &
#endif
Expand Down
3 changes: 2 additions & 1 deletion tools/fv_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ module fv_diagnostics_mod
character(len=256) :: tlongname, tunits
real :: sphum_ll_fix = 0.
real :: qcly0 ! initial value for terminator test
logical :: is_ideal_case = .false.

public :: fv_diag_init, fv_time, fv_diag, prt_mxm, prt_maxmin, range_check!, id_divg, id_te
public :: prt_mass, prt_minmax, ppme, fv_diag_init_gn, z_sum, sphum_ll_fix, eqv_pot, qcly0, gn
public :: prt_height, prt_gb_nh_sh, interpolate_vertical, rh_calc, get_height_field, dbzcalc
public :: max_vv, get_vorticity, max_uh
public :: max_vorticity, max_vorticity_hy1, bunkers_vector, helicity_relative_CAPS
public :: cs3_interpolator, get_height_given_pressure
public :: cs3_interpolator, get_height_given_pressure, is_ideal_case
#ifdef MOVING_NEST
public :: interpolate_z, get_pressure_given_height
public :: fv_diag_reinit
Expand Down
Loading