Skip to content

Commit

Permalink
fix minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz committed Mar 19, 2024
1 parent eed2418 commit 5a6ebee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions src/gen_modules_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module diagnostics
std_dens_UVDZ, std_dens_DIV, std_dens_DIV_fer, std_dens_Z, std_dens_H, std_dens_dVdT, std_dens_flux, &
dens_flux_e, vorticity, zisotherm, tempzavg, saltzavg, thetao, tuv, suv, &
compute_dvd, dvd_KK_tot, dvd_SD_tot, dvd_SD_chi_adv_h, dvd_SD_chi_adv_v, &
dvd_SD_chi_dif_h, dvd_SD_chi_dif_heR, dvd_SD_chi_dif_hbh, &
dvd_SD_chi_dif_he, dvd_SD_chi_dif_heR, dvd_SD_chi_dif_hbh, &
dvd_SD_chi_dif_veR, dvd_SD_chi_dif_viR, dvd_SD_chi_dif_vi, &
dvd_SD_chi_dif_ve, dvd_xdfac

Expand Down Expand Up @@ -68,7 +68,7 @@ module diagnostics
real(kind=WP), save, allocatable, target :: dvd_KK_tot(:,:,:), dvd_SD_tot(:,:,:), dvd_SD_chi_adv_h(:,:,:), &
dvd_SD_chi_adv_v( :,:,:), dvd_SD_chi_dif_heR(:,:,:), dvd_SD_chi_dif_veR(:,:,:), &
dvd_SD_chi_dif_viR(:,:,:), dvd_SD_chi_dif_vi(:,:,:), dvd_SD_chi_dif_hbh(:,:,:), &
dvd_SD_chi_dif_ve(:,:,:), dvd_SD_chi_dif_h(:,:,:), trstar(:,:)
dvd_SD_chi_dif_ve(:,:,:), dvd_SD_chi_dif_he(:,:,:), trstar(:,:)
real(kind=WP), parameter :: dvd_xdfac=0.5_WP ! Xchi distribution factor, default distribute
! equal amount (50:50) of xchi on both side of face
!_____________________________________________________________________________
Expand Down Expand Up @@ -1005,17 +1005,17 @@ subroutine compute_dvd(mode, dynamics, tracers, partit, mesh)
#include "associate_mesh_ass.h"
if (firstcall) then !allocate the stuff at the first call
allocate(trstar( nl-1, myDim_nod2D+eDim_nod2D))
allocate(dvd_KK_tot( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_tot( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_adv_h( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_adv_v( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_h( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_vi( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_KK_tot( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_tot( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_adv_h( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_adv_v( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_he(nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_vi(nl-1, myDim_nod2D+eDim_nod2D, 2))
if (tracers%data(1)%smooth_bh_tra) then
allocate(dvd_SD_chi_dif_hbh(nl-1, myDim_nod2D+eDim_nod2D, 2))
end if
if (Redi) then
allocate(dvd_SD_chi_dif_heR( nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_heR(nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_veR(nl-1, myDim_nod2D+eDim_nod2D, 2))
allocate(dvd_SD_chi_dif_viR(nl-1, myDim_nod2D+eDim_nod2D, 2))
end if
Expand All @@ -1033,7 +1033,7 @@ subroutine compute_dvd(mode, dynamics, tracers, partit, mesh)
dvd_SD_tot = 0.0_WP ! --> DVD diagnostic after Banjerjee et al. 2023 (Sergeys way!!!)
dvd_SD_chi_adv_h = 0.0_WP
dvd_SD_chi_adv_v = 0.0_WP
dvd_SD_chi_dif_h = 0.0_WP
dvd_SD_chi_dif_he = 0.0_WP
dvd_SD_chi_dif_vi = 0.0_WP ! implicite part
if (tracers%data(1)%smooth_bh_tra) then
dvd_SD_chi_dif_hbh= 0.0_WP
Expand Down Expand Up @@ -1146,7 +1146,7 @@ subroutine compute_dvd(mode, dynamics, tracers, partit, mesh)
call dvd_add_advflux_ver( .true., tr_num, dvd_SD_chi_adv_v, trflx_v, Wvel, trstar, partit, mesh)

! add contribution from horizontal diffusion
call dvd_add_difflux_horexpl( .true., tr_num, dvd_SD_chi_dif_heR, trstar, Ki, tr_xy, dump, partit, mesh)
call dvd_add_difflux_horexpl( .true., tr_num, dvd_SD_chi_dif_he, trstar, Ki, tr_xy, dump, partit, mesh)

! add contribution from vertical diffusion
if (.not. tracers%data(tr_num)%i_vert_diff) then
Expand All @@ -1168,8 +1168,8 @@ subroutine compute_dvd(mode, dynamics, tracers, partit, mesh)
end if

! compute total Xchi
dvd_SD_tot(:,:,tr_num) = dvd_SD_chi_adv_h( :,:,tr_num) + dvd_SD_chi_adv_v( :,:,tr_num) + &
dvd_SD_chi_dif_vi(:,:,tr_num)
dvd_SD_tot(:,:,tr_num) = dvd_SD_chi_adv_h( :,:,tr_num) + dvd_SD_chi_adv_v( :,:,tr_num) + &
dvd_SD_chi_dif_vi(:,:,tr_num) + dvd_SD_chi_dif_he(:,:,tr_num)
if (.not. tracers%data(tr_num)%i_vert_diff) then
dvd_SD_tot(:,:,tr_num) = dvd_SD_tot(:,:,tr_num) + dvd_SD_chi_dif_ve(:,:,tr_num)
end if
Expand Down
4 changes: 2 additions & 2 deletions src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_tot' , 'tot. temperature DVD \n (Banerjee et al. 2023)' , 'K^2/s' , dvd_SD_tot( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_advh', 'temperature DVD horiz. adv.' , 'K^2/s' , dvd_SD_chi_adv_h( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_advv', 'temperature DVD vert. adv. ' , 'K^2/s' , dvd_SD_chi_adv_v( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_difh', 'temperature DVD horiz. diff.' , 'K^2/s' , dvd_SD_chi_dif_h( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_difh', 'temperature DVD horiz. diff. expl.' , 'K^2/s' , dvd_SD_chi_dif_he( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_difvi', 'temperature DVD vert. diff. impl.' , 'K^2/s' , dvd_SD_chi_dif_vi( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
if (.not. tracers%data(1)%i_vert_diff) then
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_temp_SD_difve', 'temperature DVD vert. diff. expl.' , 'K^2/s' , dvd_SD_chi_dif_ve( :,:,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
Expand All @@ -725,7 +725,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_tot' , 'tot. salinity DVD \n (Banerjee et al. 2023)' , 'K^2/s' , dvd_SD_tot( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_advh', 'salinity DVD horiz. adv.' , 'K^2/s' , dvd_SD_chi_adv_h( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_advv', 'salinity DVD vert. adv. ' , 'K^2/s' , dvd_SD_chi_adv_v( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_difh', 'salinity DVD horiz. diff.' , 'K^2/s' , dvd_SD_chi_dif_h( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_difh', 'salinity DVD horiz. diff. expl.' , 'K^2/s' , dvd_SD_chi_dif_he( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_difvi', 'salinity DVD vert. diff. impl.' , 'K^2/s' , dvd_SD_chi_dif_vi( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
if (.not. tracers%data(1)%i_vert_diff) then
call def_stream((/nl-1, nod2D/), (/nl-1, myDim_nod2D/), 'dvd_salt_SD_difve', 'salinity DVD vert. diff. expl.' , 'K^2/s' , dvd_SD_chi_dif_ve( :,:,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
Expand Down

0 comments on commit 5a6ebee

Please sign in to comment.