Commit 4913c552 authored by Knut's avatar Knut
Browse files

use of save_[s|t|rho]

parent e2e9da51
......@@ -53,8 +53,8 @@
integer :: vel3d_adv_split=0
integer :: vel3d_adv_hor=1
integer :: vel3d_adv_ver=1
logical :: calc_temp=.true.
logical :: calc_salt=.true.
logical :: calc_temp=.false.
logical :: calc_salt=.false.
logical :: bdy3d=.false.
integer :: bdyfmt_3d,bdy3d_ramp
character(len=PATH_MAX) :: bdyfile_3d
......@@ -86,10 +86,12 @@
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
REALTYPE, intent(in) :: timestep
logical, intent(in) :: hotstart
!
! !INPUT/OUTPUT PARAMETERS:
integer, intent(inout) :: runtype
!
!
! !DESCRIPTION:
! Here, the {\tt m3d} namelist is read from {\tt getm.inp}, and the
......@@ -137,6 +139,11 @@
read(NAMLST,m3d)
! rewind(NAMLST)
if (runtype.ge.3 .and. .not.calc_temp .and. .not.calc_salt) then
LEVEL2 'reset runtype to 2 because neither temp nor salt are calculated'
runtype = 2
end if
LEVEL2 "splitting factor M: ",M
if (avmback .lt. _ZERO_) then
......
......@@ -282,41 +282,40 @@
#endif
end if
if (save_strho) then
if (calc_salt .and. save_s) then
fv = salt_missing
mv = salt_missing
vr(1) = 0.
vr(2) = 40.
err = nf90_def_var(ncid,'salt',NCDF_FLOAT_PRECISION,f4_dims,salt_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,salt_id,long_name='salinity',units='PSU', &
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_s) then
fv = salt_missing
mv = salt_missing
vr(1) = 0.
vr(2) = 40.
err = nf90_def_var(ncid,'salt',NCDF_FLOAT_PRECISION,f4_dims,salt_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,salt_id,long_name='salinity',units='PSU', &
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (calc_temp .and. save_t) then
fv = temp_missing
mv = temp_missing
vr(1) = -2.
vr(2) = 40.
err = nf90_def_var(ncid,'temp',NCDF_FLOAT_PRECISION,f4_dims,temp_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,temp_id,long_name='temperature',units='degC',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_t) then
fv = temp_missing
mv = temp_missing
vr(1) = -2.
vr(2) = 40.
err = nf90_def_var(ncid,'temp',NCDF_FLOAT_PRECISION,f4_dims,temp_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,temp_id,long_name='temperature',units='degC',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_rho) then
fv = rho_missing
mv = rho_missing
vr(1) = 0.
vr(2) = 30.
err = nf90_def_var(ncid,'sigma_t',NCDF_FLOAT_PRECISION,f4_dims,sigma_t_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,sigma_t_id,long_name='sigma_t',units='kg/m3',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_rho) then
fv = rho_missing
mv = rho_missing
vr(1) = 0.
vr(2) = 30.
err = nf90_def_var(ncid,'sigma_t',NCDF_FLOAT_PRECISION,f4_dims,sigma_t_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,sigma_t_id,long_name='sigma_t',units='kg/m3',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_strho) then
if (save_rad) then
fv = rad_missing
mv = rad_missing
......@@ -327,7 +326,6 @@
call set_attributes(ncid,rad_id,long_name='radiation',units='W/m2',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
end if
if (save_turb) then
......
......@@ -145,7 +145,8 @@
FillValue=fv,missing_value=mv,valid_range=vr)
#ifndef NO_BAROCLINIC
if (calc_salt) then
if (save_s) then
fv = salt_missing
mv = salt_missing
vr(1) = 0.
......@@ -157,7 +158,7 @@
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (calc_temp) then
if (save_t) then
fv = temp_missing
mv = temp_missing
vr(1) = 0.
......@@ -168,6 +169,19 @@
long_name='mean temperature',units='degC',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
if (save_rho) then
fv = rho_missing
mv = rho_missing
vr(1) = 0.
vr(2) = 30.
err = nf90_def_var(ncid,'sigma_tmean',NCDF_FLOAT_PRECISION,f4_dims,sigma_tmean_id)
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,sigma_tmean_id, &
long_name='mean sigma_t',units='kg/m3',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
#endif
if (save_numerical_analyses) then
......
......@@ -44,8 +44,10 @@
#if defined(CURVILINEAR)
integer :: uurot_id,vvrot_id
#endif
integer :: salt_id,temp_id,sigma_t_id
integer :: rad_id
integer :: salt_id=-1
integer :: temp_id=-1
integer :: sigma_t_id=-1
integer :: rad_id=-1
integer :: tke_id,num_id,nuh_id,eps_id
integer :: SS_id,NN_id
#ifdef SPM
......
......@@ -22,7 +22,10 @@
integer :: swrmean_id,ustarmean_id,ustar2mean_id
integer :: uumean_id,vvmean_id,wmean_id
integer :: saltmean_id,tempmean_id,hmean_id
integer :: hmean_id
integer :: saltmean_id=-1
integer :: tempmean_id=-1
integer :: sigma_tmean_id=-1
integer :: nm3dS_id,nm3dT_id,nm2dS_id,nm2dT_id
integer :: pm3dS_id,pm3dT_id,pm2dS_id,pm2dT_id
integer :: nm3d_id,nm2d_id
......@@ -41,6 +44,7 @@
REALTYPE, parameter :: vel_missing=-9999.0
REALTYPE, parameter :: salt_missing=-9999.0
REALTYPE, parameter :: temp_missing=-9999.0
REALTYPE, parameter :: rho_missing=-9999.0
REALTYPE, parameter :: tke_missing=-9999.0
REALTYPE, parameter :: eps_missing=-9999.0
REALTYPE, parameter :: nummix_missing=-9999.0
......
......@@ -280,37 +280,35 @@
end if
#ifndef NO_BAROCLINIC
if (save_strho) then
if (calc_salt .and. save_s) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,S,salt_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,salt_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (salt_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,S,salt_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,salt_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (calc_temp .and. save_t) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,T,temp_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,temp_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (temp_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,T,temp_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,temp_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (save_rho) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,rho-1000.,rho_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,sigma_t_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (sigma_t_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,rho-1000.,rho_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,sigma_t_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (save_rad) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,rad,rad_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,rad_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (rad_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,rad,rad_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,rad_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
end if ! save_strho
#endif
if (save_turb) then
......
......@@ -121,7 +121,7 @@
#ifndef NO_BAROCLINIC
! salt mean
if (calc_salt) then
if (saltmean_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,Smean,salt_missing, &
imin,imax,jmin,jmax,0,kmax,ws3d)
err = nf90_put_var(ncid, saltmean_id,ws3d(_3D_W_),start,edges)
......@@ -129,12 +129,20 @@
end if
! mean temperature
if (calc_temp) then
if (tempmean_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,Tmean,temp_missing, &
imin,imax,jmin,jmax,0,kmax,ws3d)
err = nf90_put_var(ncid, tempmean_id,ws3d(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
! mean sigma_t
if (sigma_tmean_id .ne. -1) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,rhomean-1000.,rho_missing, &
imin,imax,jmin,jmax,0,kmax,ws3d)
err = nf90_put_var(ncid,sigma_tmean_id,ws3d(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
#endif
if (save_numerical_analyses) then
......
......@@ -17,7 +17,7 @@
use variables_3d, only: do_numerical_analyses
use variables_3d, only: hn,uu,hun,vv,hvn,ww,taub
#ifndef NO_BAROCLINIC
use variables_3d, only: S,T
use variables_3d, only: S,T,rho
#endif
use variables_3d, only: nummix3d_S,nummix2d_S,nummix3d_T,nummix2d_T
use variables_3d, only: phymix3d_S,phymix2d_S,phymix3d_T,phymix2d_T
......@@ -30,6 +30,7 @@
#ifdef _FABM_
use getm_fabm, only: fabm_pel,fabm_ben,fabm_diag,fabm_diag_hz
#endif
use output, only: save_s,save_t,save_rho
use diagnostic_variables
use getm_timers, only: tic, toc, TIM_CALCMEANF
IMPLICIT NONE
......@@ -87,12 +88,21 @@
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (hmean)'
#ifndef NO_BAROCLINIC
allocate(Tmean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (Tmean)'
allocate(Smean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (Smean)'
if (save_t) then
allocate(Tmean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (Tmean)'
end if
if (save_s) then
allocate(Smean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (Smean)'
end if
if (save_rho) then
allocate(rhomean(I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (rhomean)'
end if
#endif
if (do_numerical_analyses) then
......@@ -167,7 +177,9 @@
uumean=_ZERO_; vvmean=_ZERO_; wmean=_ZERO_
humean=_ZERO_; hvmean=_ZERO_; hmean=_ZERO_
#ifndef NO_BAROCLINIC
Tmean=_ZERO_; Smean=_ZERO_
if (save_t) Tmean=_ZERO_
if (save_s) Smean=_ZERO_
if (save_rho) rhomean=_ZERO_
#endif
if (do_numerical_analyses) then
numdis3d_mean=_ZERO_; numdis2d_mean=_ZERO_
......@@ -219,8 +231,9 @@
hmean = hmean + hn
#ifndef NO_BAROCLINIC
Tmean = Tmean + T*hn
Smean = Smean + S*hn
if (save_t) Tmean = Tmean + T*hn
if (save_s) Smean = Smean + S*hn
if (save_rho) rhomean = rhomean + rho*hn
#endif
if (do_numerical_analyses) then
numdis3d_mean = numdis3d_mean + numdis3d
......@@ -265,8 +278,9 @@
hmean = hmean / step
#ifndef NO_BAROCLINIC
Tmean = Tmean / step / hmean
Smean = Smean / step / hmean
if (save_t) Tmean = Tmean / step / hmean
if (save_s) Smean = Smean / step / hmean
if (save_rho) rhomean = rhomean / step / hmean
#endif
if (do_numerical_analyses) then
numdis3d_mean = numdis3d_mean / step
......
......@@ -27,6 +27,7 @@
REALTYPE,dimension(:,:,:), allocatable :: hmean
REALTYPE,dimension(:,:,:), allocatable :: Tmean
REALTYPE,dimension(:,:,:), allocatable :: Smean
REALTYPE,dimension(:,:,:), allocatable :: rhomean
REALTYPE,dimension(:,:,:), allocatable :: nummix3d_S_mean
REALTYPE,dimension(:,:), allocatable :: nummix2d_S_mean
......
......@@ -13,6 +13,7 @@
use time, only: write_time_string,timestep,timestr
use ascii_out
#ifndef NO_3D
use m3d, only: calc_salt,calc_temp
use variables_3d, only: do_numerical_analyses
#endif
#ifdef TEST_NESTING
......@@ -39,10 +40,10 @@
logical :: save_mean=.false.
logical :: save_vel=.true.
logical :: destag=.false.
logical :: save_strho=.true.
logical :: save_s=.true.
logical :: save_t=.true.
logical :: save_rho=.true.
logical :: save_strho=.false.
logical :: save_s=.false.
logical :: save_t=.false.
logical :: save_rho=.false.
logical :: save_rad=.false.
logical :: save_turb=.true.
logical :: save_tke=.true.
......@@ -137,10 +138,23 @@
if (runtype .eq. 2) then
save_strho = .false.
end if
if (.not. save_strho) then
save_s = .false.
save_t = .false.
save_rho = .false.
end if
#ifndef NO_3D
if (.not. calc_salt) then
save_s = .false.
end if
if (.not. calc_temp) then
save_t = .false.
end if
#endif
if(destag) then
LEVEL2 'de-stag velocities to T-points'
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment