Commit 442417ac authored by Karsten Bolding's avatar Karsten Bolding

numeric/physical mixing analysis added - Renneu and Hofmeister

parent aebb3bb4
......@@ -493,6 +493,9 @@
<save_taub>
False
</save_taub>
<save_mix_analysis>
False
</save_mix_analysis>
<first_2d>
0
</first_2d>
......
......@@ -608,6 +608,7 @@
<element name="save_nuh" type="bool" label="save turbulent diffusivity of heat"/>
<element name="save_ss_nn" type="bool" label="save shear stress and Brunt-Vaisala frequency"/>
<element name="save_taub" type="bool" label="save bottom friction velocity"/>
<element name="save_mix_analysis" type="bool" label="calculate/save mixing analysis"/>
<element name="first_2d" type="int" label="first time step to save 2D fields" unit="micro time steps" minInclusive="0"/>
<element name="step_2d" type="int" label="interval between saves of 2D fields" unit="micro time steps" minInclusive="1"/>
<element name="first_3d" type="int" label="first time step to save 3D fields" unit="micro time steps" minInclusive="0"/>
......
......@@ -13,7 +13,7 @@ MODSRC = m3d.F90 variables_3d.F90 advection_3d.F90 eqstate.F90 \
LIBSRC = start_macro.F90 hcc_check.F90 bdy_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 check_h.F90 bottom_friction_3d.F90 internal_pressure.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 tke_eps_advect_3d.F90 stresses_3d.F90 ss_nn.F90 gotm.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 divergence.F90 stop_macro.F90
TEXSRC = m3d.F90 variables_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 check_h.F90 hcc_check.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 tke_eps_advect_3d.F90 bottom_friction_3d.F90 internal_pressure.F90 ip_blumberg_mellor.F90 ip_blumberg_mellor_lin.F90 ip_z_interpol.F90 ip_song_wright.F90 ip_chu_fan.F90 ip_shchepetkin_mcwilliams.F90 ip_stelling_vankester.F90 advection_3d.F90 upstream_adv.F90 upstream_2dh_adv.F90 u_split_adv.F90 v_split_adv.F90 w_split_adv.F90 w_split_it_adv.F90 fct_2dh_adv.F90 temperature.F90 salinity.F90 spm.F90 eqstate.F90 ss_nn.F90 stresses_3d.F90 gotm.F90 rivers.F90 bdy_3d.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 start_macro.F90 stop_macro.F90 divergence.F90
TEXSRC = m3d.F90 variables_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 check_h.F90 hcc_check.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 tke_eps_advect_3d.F90 bottom_friction_3d.F90 internal_pressure.F90 ip_blumberg_mellor.F90 ip_blumberg_mellor_lin.F90 ip_z_interpol.F90 ip_song_wright.F90 ip_chu_fan.F90 ip_shchepetkin_mcwilliams.F90 ip_stelling_vankester.F90 numerical_mixing..F90 physical_mixing.F90 advection_3d.F90 upstream_adv.F90 upstream_2dh_adv.F90 u_split_adv.F90 v_split_adv.F90 w_split_adv.F90 w_split_it_adv.F90 fct_2dh_adv.F90 temperature.F90 salinity.F90 spm.F90 eqstate.F90 ss_nn.F90 stresses_3d.F90 gotm.F90 rivers.F90 bdy_3d.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 start_macro.F90 stop_macro.F90 divergence.F90
SRC = $(MODSRC) $(LIBSRC)
......@@ -55,6 +55,7 @@ OBJ += \
$(LIB)(structure_friction_3d.o)
endif
OBJ += \
OBJ += \
$(LIB)(uv_advect_3d.o) \
$(LIB)(uv_diffusion_3d.o)
ifneq ($(GETM_NO_BAROCLINIC),true)
......@@ -65,7 +66,9 @@ $(LIB)(ip_z_interpol.o) \
$(LIB)(ip_song_wright.o) \
$(LIB)(ip_shchepetkin_mcwilliams.o) \
$(LIB)(ip_stelling_vankester.o) \
$(LIB)(ip_chu_fan.o)
$(LIB)(ip_chu_fan.o) \
$(LIB)(numerical_mixing.o) \
$(LIB)(physical_mixing.o)
endif
OBJ += \
$(LIB)(eddyviscosity.o) \
......
......@@ -79,6 +79,30 @@
allocate(rad(I3DFIELD),stat=rc) ! Solar radiation
if (rc /= 0) stop 'init_3d: Error allocating memory (rad)'
allocate(nummix3d_S(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (nummix3d_S)'
allocate(nummix2d_S(I2DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (nummix2d_S)'
allocate(nummix3d_T(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (nummix3d_T)'
allocate(nummix2d_T(I2DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (nummix2d_T)'
allocate(phymix3d_S(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (phymix3d_S)'
allocate(phymix2d_S(I2DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (phymix2d_S)'
allocate(phymix3d_T(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (phymix3d_T)'
allocate(phymix2d_T(I2DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (phymix2d_T)'
#endif
#ifdef SPM
......
......@@ -29,6 +29,10 @@
REALTYPE, dimension(:,:,:), allocatable :: S,T,rho,buoy
REALTYPE, dimension(:,:,:), allocatable :: idpdx,idpdy
REALTYPE, dimension(:,:,:), allocatable :: rad,light
REALTYPE, dimension(:,:,:), allocatable :: nummix3d_S,nummix3d_T
REALTYPE, dimension(:,:,:), allocatable :: phymix3d_S,phymix3d_T
REALTYPE, dimension(:,:), allocatable :: nummix2d_S,nummix2d_T
REALTYPE, dimension(:,:), allocatable :: phymix2d_S,phymix2d_T
#endif
! suspended matter
......
......@@ -352,7 +352,10 @@ salt_field_no=1
use domain, only: dx,dy,ard1
#endif
use parameters, only: avmols
use getm_timers, only: tic, toc, TIM_SALT
use getm_timers, only: tic, toc, TIM_SALT, TIM_MIXANALYSIS
use variables_3d, only: do_mixing_analysis
use variables_3d, only: nummix3d_S,nummix2d_S
use variables_3d, only: phymix3d_S,phymix2d_S
!$ use omp_lib
IMPLICIT NONE
!
......@@ -371,6 +374,7 @@ salt_field_no=1
#ifdef SALTWEDGE_TEST
REALTYPE :: SRelax,kk
#endif
REALTYPE :: S2(I3DFIELD)
REALTYPE :: delxu(I2DFIELD),delxv(I2DFIELD)
REALTYPE :: delyu(I2DFIELD),delyv(I2DFIELD)
REALTYPE :: area_inv(I2DFIELD)
......@@ -410,10 +414,28 @@ salt_field_no=1
! Note: do_advection_3d is timed separately, so we
! stop the present counter
call toc(TIM_SALT)
if (do_mixing_analysis) then
call tic(TIM_MIXANALYSIS)
S2 = S**2
call toc(TIM_MIXANALYSIS)
call do_advection_3d(dt,S2,uu,vv,ww,hun,hvn,ho,hn, &
delxu,delxv,delyu,delyv,area_inv,az,au,av, &
salt_hor_adv,salt_ver_adv,salt_adv_split,salt_AH)
end if
call do_advection_3d(dt,S,uu,vv,ww,hun,hvn,ho,hn, &
delxu,delxv,delyu,delyv,area_inv,az,au,av, &
salt_hor_adv,salt_ver_adv,salt_adv_split,salt_AH)
if (do_mixing_analysis) then
call tic(TIM_MIXANALYSIS)
call numerical_mixing(S2,S,nummix3d_S,nummix2d_S)
call physical_mixing(S,nuh+avmols,phymix3d_S,phymix2d_S)
call toc(TIM_MIXANALYSIS)
end if
call tic(TIM_SALT)
#ifdef PECS_TEST
S(imin:imin,jmin:jmax,1:kmax)=10*_ONE_
......
......@@ -54,6 +54,15 @@
REALTYPE :: idpdx(I3DFIELD)
REALTYPE :: idpdy(I3DFIELD)
REALTYPE :: light(I3DFIELD)
REALTYPE :: nummix3d_S(I3DFIELD)
REALTYPE :: nummix2d_S(I2DFIELD)
REALTYPE :: nummix3d_T(I3DFIELD)
REALTYPE :: nummix2d_T(I2DFIELD)
REALTYPE :: phymix3d_S(I3DFIELD)
REALTYPE :: phymix2d_S(I2DFIELD)
REALTYPE :: phymix3d_T(I3DFIELD)
REALTYPE :: phymix2d_T(I2DFIELD)
#endif
#ifdef SPM
......
......@@ -338,7 +338,10 @@ temp_field_no=1
use domain, only: dx,dy,ard1
#endif
use parameters, only: avmolt
use getm_timers, only: tic, toc, TIM_TEMP
use getm_timers, only: tic, toc, TIM_TEMP, TIM_MIXANALYSIS
use variables_3d, only: do_mixing_analysis
use variables_3d, only: nummix3d_T,nummix2d_T
use variables_3d, only: phymix3d_T,phymix2d_T
!$ use omp_lib
IMPLICIT NONE
!
......@@ -351,6 +354,7 @@ temp_field_no=1
!
! !LOCAL VARIABLES:
integer :: i,j,k,rc
REALTYPE :: T2(I3DFIELD)
REALTYPE :: delxu(I2DFIELD),delxv(I2DFIELD)
REALTYPE :: delyu(I2DFIELD),delyv(I2DFIELD)
REALTYPE :: area_inv(I2DFIELD)
......@@ -393,9 +397,27 @@ temp_field_no=1
! Note: do_advection_3d is timed separately, so we
! stop the present counter
call toc(TIM_TEMP)
if (do_mixing_analysis) then
call tic(TIM_MIXANALYSIS)
T2 = T**2
call toc(TIM_MIXANALYSIS)
call do_advection_3d(dt,T2,uu,vv,ww,hun,hvn,ho,hn, &
delxu,delxv,delyu,delyv,area_inv,az,au,av, &
temp_hor_adv,temp_ver_adv,temp_adv_split,temp_AH)
end if
call do_advection_3d(dt,T,uu,vv,ww,hun,hvn,ho,hn, &
delxu,delxv,delyu,delyv,area_inv,az,au,av, &
temp_hor_adv,temp_ver_adv,temp_adv_split,temp_AH)
if (do_mixing_analysis) then
call tic(TIM_MIXANALYSIS)
call numerical_mixing(T2,T,nummix3d_T,nummix2d_T)
call physical_mixing(T,nuh+avmolt,phymix3d_T,phymix2d_T)
call toc(TIM_MIXANALYSIS)
end if
call tic(TIM_TEMP)
! OMP-NOTE: Pointer definitions and allocation so that each thread can
......
......@@ -119,6 +119,7 @@
REALTYPE :: dt,cnpar=0.9
REALTYPE :: avmback=_ZERO_,avhback=_ZERO_
character(len=64) :: adv_schemes(7)
logical :: do_mixing_analysis=.false.
!
#ifdef STATIC
#include "static_3d.h"
......@@ -207,6 +208,8 @@
#ifndef NO_BAROCLINIC
idpdx=_ZERO_
idpdy=_ZERO_
nummix3d_S = _ZERO_ ; nummix2d_S = _ZERO_
nummix3d_T = _ZERO_ ; nummix2d_T = _ZERO_
#endif
adv_schemes(1) = "3D first-order upstream advection"
......
......@@ -73,6 +73,7 @@
! These catch stuff that are *also* measured somewhere else:
integer, parameter :: TIM_ADVECT3DTOT = 100 ! advection_3d (uv+tracers)
integer, parameter :: TIM_CHECK3DF = 102 ! check_3d_fields
integer, parameter :: TIM_MIXANALYSIS = 103 ! (numerical) mixing analysis
! This is test timers for temporary coding purposes:
! Note: All timers with index 170+ (test_timer_first) are
! considered test timers, so dont implement your timers here
......@@ -196,6 +197,7 @@
timernames(TIM_CHECK3DF) = ' sum check_3d_fields'
timernames(TIM_ADVECT3DTOT) = ' sum do_advection_3d'
timernames(TIM_INTEGR3D) = 'integrate_3d other'
timernames(TIM_MIXANALYSIS) = 'numerical mixing analysis'
! We only really want to display halo-stuff if we compile for parallel:
#ifdef GETM_PARALLEL
......
......@@ -388,6 +388,39 @@
#endif
end if
#ifndef NO_BAROCLINIC
if (save_mix_analysis) then
fv = nummix_missing
mv = nummix_missing
vr(1) = -100.0
vr(2) = 100.0
err = nf_def_var(ncid,'nummix3d_S',NF_REAL,4,f4_dims,nm3dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm3dS_id, &
long_name='numerical mixing of salinity', &
units='psu**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'nummix3d_T',NF_REAL,4,f4_dims,nm3dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm3dT_id, &
long_name='numerical mixing of temperature', &
units='degC**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix3d_S',NF_REAL,4,f4_dims,pm3dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm3dS_id, &
long_name='physical mixing of salinity', &
units='psu**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix3d_T',NF_REAL,4,f4_dims,pm3dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm3dT_id, &
long_name='physical mixing of temperature', &
units='degC**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
#endif
#ifdef SPM
if (spm_save) then
fv = spm_missing
......
......@@ -176,6 +176,63 @@
long_name='mean temperature',units='degC',&
FillValue=fv,missing_value=mv,valid_range=vr)
if (save_mix_analysis) then
fv = nummix_missing
mv = nummix_missing
vr(1) = -100.0
vr(2) = 100.0
err = nf_def_var(ncid,'nummix3d_S',NF_REAL,4,f4_dims,nm3dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm3dS_id, &
long_name='mean numerical mixing of salinity', &
units='psu**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'nummix3d_T',NF_REAL,4,f4_dims,nm3dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm3dT_id, &
long_name='mean numerical mixing of temperature', &
units='degC**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix3d_S',NF_REAL,4,f4_dims,pm3dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm3dS_id, &
long_name='mean physical mixing of salinity', &
units='psu**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix3d_T',NF_REAL,4,f4_dims,pm3dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm3dT_id, &
long_name='mean physical mixing of temperature', &
units='degC**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'nummix2d_S',NF_REAL,3,f3_dims,nm2dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm2dS_id, &
long_name='mean, vert.integrated numerical mixing of salinity', &
units='psu**2 m/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'nummix2d_T',NF_REAL,3,f3_dims,nm2dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,nm2dT_id, &
long_name='mean, vert.integrated numerical mixing of temperature', &
units='degC**2 m/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix2d_S',NF_REAL,3,f3_dims,pm2dS_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm2dS_id, &
long_name='mean, vert.integrated physical mixing of salinity', &
units='psu**2 m/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
err = nf_def_var(ncid,'phymix2d_T',NF_REAL,3,f3_dims,pm2dT_id)
if (err .NE. NF_NOERR) go to 10
call set_attributes(ncid,pm2dT_id, &
long_name='mean, vert.integrated physical mixing of temperature', &
units='degC**2 m/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
! globals
err = nf_put_att_text(ncid,NF_GLOBAL,'title',LEN_TRIM(title),title)
if (err .NE. NF_NOERR) go to 10
......
......@@ -35,6 +35,8 @@
#ifdef GETM_BIO
integer, allocatable :: bio_ids(:)
#endif
integer :: nm3dS_id,nm3dT_id,nm2dS_id,nm2dT_id
integer :: pm3dS_id,pm3dT_id,pm2dS_id,pm2dT_id
REAL_4B, dimension(:), allocatable :: ws
......@@ -60,6 +62,7 @@
#ifdef GETM_BIO
REALTYPE, parameter :: bio_missing=-9999.0
#endif
REALTYPE, parameter :: nummix_missing=-9999.0
!
! !REVISION HISTORY:
......
......@@ -32,6 +32,9 @@
REALTYPE, parameter :: temp_missing=-9999.0
REALTYPE, parameter :: tke_missing=-9999.0
REALTYPE, parameter :: eps_missing=-9999.0
REALTYPE, parameter :: nummix_missing=-9999.0
integer :: nm3dS_id,nm3dT_id,nm2dS_id,nm2dT_id
integer :: pm3dS_id,pm3dT_id,pm2dS_id,pm2dT_id
REAL_4B, dimension(:), allocatable :: ws
!
......
......@@ -27,6 +27,7 @@
use variables_3d, only: taubx,tauby
#ifndef NO_BAROCLINIC
use variables_3d, only: S,T,rho,rad,NN
use variables_3d, only: nummix3d_S,nummix3d_T,phymix3d_S,phymix3d_T
#endif
use variables_3d, only: tke,num,nuh,eps
#ifdef SPM
......@@ -355,6 +356,27 @@
end if ! save_ss_nn
#ifndef NO_BAROCLINIC
if (save_mix_analysis) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,nummix3d_S,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, nm3dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,nummix3d_T,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, nm3dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,phymix3d_S,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, pm3dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,phymix3d_T,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, pm3dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
end if ! save_mix_analysis
#endif
#ifdef SPM
if (spm_save) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,spm,spm_missing, &
......
......@@ -132,6 +132,54 @@
err = nf_put_vara_real(ncid, tempmean_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
if (save_mix_analysis) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
nummix3d_S_mean,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, nm3dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
nummix3d_T_mean,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, nm3dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
phymix3d_S_mean,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, pm3dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
phymix3d_T_mean,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf_put_vara_real(ncid, pm3dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
start(1) = 1
start(2) = 1
start(3) = n3d
edges(1) = xlen
edges(2) = ylen
edges(3) = 1
call cnv_2d(imin,jmin,imax,jmax,az,nummix2d_S_mean,nummix_missing, &
imin,jmin,imax,jmax,ws)
err = nf_put_vara_real(ncid, nm2dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_2d(imin,jmin,imax,jmax,az,nummix2d_T_mean,nummix_missing, &
imin,jmin,imax,jmax,ws)
err = nf_put_vara_real(ncid, nm2dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_2d(imin,jmin,imax,jmax,az,phymix2d_S_mean,nummix_missing, &
imin,jmin,imax,jmax,ws)
err = nf_put_vara_real(ncid, pm2dS_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
call cnv_2d(imin,jmin,imax,jmax,az,phymix2d_T_mean,nummix_missing, &
imin,jmin,imax,jmax,ws)
err = nf_put_vara_real(ncid, pm2dT_id, start, edges, ws)
if (err .NE. NF_NOERR) go to 10
end if
err = nf_sync(ncid)
if (err .NE. NF_NOERR) go to 10
......
......@@ -15,9 +15,12 @@
use domain, only: az,au,av
use meteo, only: swr
use m3d, only: M
use variables_3d, only: do_mixing_analysis
use variables_3d, only: hn,uu,hun,vv,hvn,ww,taub
#ifndef NO_BAROCLINIC
use variables_3d, only: S,T
use variables_3d, only: nummix3d_S,nummix2d_S,nummix3d_T,nummix2d_T
use variables_3d, only: phymix3d_S,phymix2d_S,phymix3d_T,phymix2d_T
#endif
use diagnostic_variables
use getm_timers, only: tic, toc, TIM_CALCMEANF
......@@ -98,6 +101,33 @@
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (Smean)'
#endif
if (do_mixing_analysis) then
allocate(nummix3d_S_mean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix3d_S_mean)'
allocate(nummix3d_T_mean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix3d_T_mean)'
allocate(nummix2d_S_mean(I2DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix2d_S_mean)'
allocate(nummix2d_T_mean(I2DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix2d_T_mean)'
allocate(phymix3d_S_mean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix3d_S_mean)'
allocate(phymix3d_T_mean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix3d_T_mean)'
allocate(phymix2d_S_mean(I2DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix2d_S_mean)'
allocate(phymix2d_T_mean(I2DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (nummix2d_T_mean)'
end if
first = .false.
end if
......@@ -106,6 +136,12 @@
humean=_ZERO_; hvmean=_ZERO_; hmean=_ZERO_
#ifndef NO_BAROCLINIC
Tmean=_ZERO_; Smean=_ZERO_
if (do_mixing_analysis) then
nummix3d_S_mean=_ZERO_; nummix2d_S_mean=_ZERO_
nummix3d_T_mean=_ZERO_; nummix2d_T_mean=_ZERO_
phymix3d_S_mean=_ZERO_; phymix2d_S_mean=_ZERO_
phymix3d_T_mean=_ZERO_; phymix2d_T_mean=_ZERO_
end if
#endif
ustarmean=_ZERO_; ustar2mean=_ZERO_; swrmean=_ZERO_
end if
......@@ -140,8 +176,17 @@
Tmean = Tmean + T
Smean = Smean + S
hmean = hmean + hn
if (do_mixing_analysis) then
nummix3d_S_mean = nummix3d_S_mean + nummix3d_S
nummix2d_S_mean = nummix2d_S_mean + nummix2d_S
nummix3d_T_mean = nummix3d_T_mean + nummix3d_T
nummix2d_T_mean = nummix2d_T_mean + nummix2d_T
phymix3d_S_mean = phymix3d_S_mean + phymix3d_S
phymix2d_S_mean = phymix2d_S_mean + phymix2d_S
phymix3d_T_mean = phymix3d_T_mean + phymix3d_T
phymix2d_T_mean = phymix2d_T_mean + phymix2d_T
end if
#endif
! count them
step = step + 1.0
end if ! here we summed them up
......@@ -160,6 +205,16 @@
Tmean = Tmean / step
Smean = Smean / step
hmean = hmean / step
if (do_mixing_analysis) then
nummix3d_S_mean = nummix3d_S_mean / step
nummix2d_S_mean = nummix2d_S_mean / step
nummix3d_T_mean = nummix3d_T_mean / step
nummix2d_T_mean = nummix2d_T_mean / step
phymix3d_S_mean = phymix3d_S_mean / step
phymix2d_S_mean = phymix2d_S_mean / step
phymix3d_T_mean = phymix3d_T_mean / step
phymix2d_T_mean = phymix2d_T_mean / step
end if
#endif
ustarmean = ustarmean / step
......
......@@ -28,6 +28,16 @@
REALTYPE,dimension(:,:,:), allocatable :: hmean
REALTYPE,dimension(:,:,:), allocatable :: Tmean
REALTYPE,dimension(:,:,:), allocatable :: Smean
REALTYPE,dimension(:,:,:), allocatable :: nummix3d_S_mean
REALTYPE,dimension(:,:), allocatable :: nummix2d_S_mean
REALTYPE,dimension(:,:,:), allocatable :: nummix3d_T_mean
REALTYPE,dimension(:,:), allocatable :: nummix2d_T_mean
REALTYPE,dimension(:,:,:), allocatable :: phymix3d_S_mean
REALTYPE,dimension(:,:), allocatable :: phymix2d_S_mean
REALTYPE,dimension(:,:,:), allocatable :: phymix3d_T_mean
REALTYPE,dimension(:,:), allocatable :: phymix2d_T_mean
!
! !REVISION HISTORY: