Commit 03c8e72f authored by Karsten Bolding's avatar Karsten Bolding
Browse files

added support for mean bio fields - Maljutenko

parent 1e1d0998
......@@ -19,6 +19,9 @@
use domain, only: imin,imax,jmin,jmax,kmax
use domain, only: vert_cord
use m3d, only: calc_temp,calc_salt
#ifdef GETM_BIO
use bio_var, only: numc,var_names,var_units,var_long
#endif
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -39,6 +42,7 @@
!
!
! !LOCAL VARIABLES:
integer :: n
integer :: err
integer :: scalar(1),f3_dims(3),f4_dims(4)
REALTYPE :: fv,mv,vr(2)
......@@ -236,6 +240,25 @@
end if
#endif
#ifdef GETM_BIO
allocate(biomean_id(numc),stat=err)
if (err /= 0) stop 'init_3d_ncdf(): Error allocating memory (bio_ids)'
fv = bio_missing
mv = bio_missing
vr(1) = -50.
vr(2) = 9999.
do n=1,numc
err = nf90_def_var(ncid,trim(var_names(n)) // '_mean',NF90_REAL, &
f4_dims,biomean_id(n))
if (err .NE. NF90_NOERR) go to 10
call set_attributes(ncid,biomean_id(n), &
long_name=trim(var_long(n)), &
units=trim(var_units(n)), &
FillValue=fv,missing_value=mv,valid_range=vr)
end do
#endif
! globals
err = nf90_put_att(ncid,NF90_GLOBAL,'title',trim(title))
if (err .NE. NF90_NOERR) go to 10
......
......@@ -24,6 +24,11 @@
integer :: swrmean_id,ustarmean_id,ustar2mean_id
integer :: uumean_id,vvmean_id,wmean_id
integer :: saltmean_id,tempmean_id,hmean_id
integer :: nm3dS_id,nm3dT_id,nm2dS_id,nm2dT_id
integer :: pm3dS_id,pm3dT_id,pm2dS_id,pm2dT_id
#ifdef GETM_BIO
integer, allocatable :: biomean_id(:)
#endif
REALTYPE, parameter :: hh_missing=-10.0
REALTYPE, parameter :: swr_missing=-9999.0
......@@ -33,8 +38,9 @@
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
#ifdef GETM_BIO
REALTYPE, parameter :: bio_missing=-9999.0
#endif
!
! Original author(s): Adolf Stips & Karsten Bolding
......
......@@ -22,6 +22,9 @@
use domain, only: H,az
use variables_3d, only: kmin
use m3d, only: calc_temp,calc_salt
#ifdef GETM_BIO
use bio_var, only: numc
#endif
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -45,6 +48,7 @@
!
!
! !LOCAL VARIABLES:
integer :: n
integer :: err
integer :: start(4),edges(4)
integer, save :: n3d=0
......@@ -201,6 +205,15 @@
end if
#endif
#ifdef GETM_BIO
do n=1,numc
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,cc3dmean(n,:,:,:), &
bio_missing,imin,imax,jmin,jmax,0,kmax,ws3d)
err = nf90_put_var(ncid, biomean_id(n), ws3d(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end do
#endif
err = nf90_sync(ncid)
if (err .NE. NF90_NOERR) go to 10
......
......@@ -21,6 +21,11 @@
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
#ifdef GETM_BIO
use bio, only: bio_calc
use bio_var, only: numc
use variables_3d, only: cc3d
#endif
use diagnostic_variables
use getm_timers, only: tic, toc, TIM_CALCMEANF
......@@ -131,6 +136,11 @@
stop 'calc_mean_fields.F90: Error allocating memory (nummix2d_S_mean)'
end if
end if
#endif
#ifdef GETM_BIO
allocate(cc3dmean(numc,I3DFIELD),stat=rc)
if (rc /= 0) &
stop 'calc_mean_fields.F90: Error allocating memory (cc3dmean)'
#endif
first = .false.
end if
......@@ -150,6 +160,9 @@
phymix3d_S_mean=_ZERO_; phymix2d_S_mean=_ZERO_
end if
end if
#endif
#ifdef GETM_BIO
cc3dmean=_ZERO_
#endif
ustarmean=_ZERO_; ustar2mean=_ZERO_; swrmean=_ZERO_
end if
......@@ -199,6 +212,9 @@
end if
end if
#endif
#ifdef GETM_BIO
if (bio_calc) cc3dmean=cc3dmean + cc3d
#endif
! count them
step = step + 1.0
end if ! here we summed them up
......@@ -232,7 +248,9 @@
end if
end if
#endif
#ifdef GETM_BIO
if (bio_calc) cc3dmean = cc3dmean / step
#endif
ustarmean = ustarmean / step
swrmean = swrmean / step
......
......@@ -38,6 +38,9 @@
REALTYPE,dimension(:,:,:), allocatable :: phymix3d_T_mean
REALTYPE,dimension(:,:), allocatable :: phymix2d_T_mean
#ifdef GETM_BIO
REALTYPE,dimension(:,:,:,:), allocatable :: cc3dmean
#endif
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
......
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