Commit 83a4d644 authored by Knut's avatar Knut
Browse files

changed allocation and output of save_numerical_analyses variables

parent d1c1d75c
......@@ -133,39 +133,8 @@
allocate(light(I3DFIELD),stat=rc) ! light advection velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (light)'
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
allocate(numdis3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (numdis3d)'
allocate(numdis2d(I2DFIELD),stat=rc)
if (rc /= 0) stop 'init_3d: Error allocating memory (numdis2d)'
#ifdef SPM
allocate(spm(I3DFIELD),stat=rc) ! Suspended particulate matter
if (rc /= 0) stop 'init_3d: Error allocating memory (spm)'
......
......@@ -39,13 +39,7 @@
REALTYPE, dimension(:,:,:), allocatable :: alpha,beta
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
REALTYPE, dimension(:,:,:), allocatable :: numdis3d
REALTYPE, dimension(:,:), allocatable :: numdis2d
! suspended matter
#ifndef NO_SUSP_MATTER
......
......@@ -294,7 +294,7 @@
! of a hotstart file.
!
! !LOCAL VARIABLES:
integer :: i,j
integer :: i,j,rc
!EOP
!-------------------------------------------------------------------------
!BOC
......@@ -306,6 +306,47 @@
LEVEL1 'postinit_3d'
if (do_numerical_analyses) then
allocate(numdis3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (numdis3d)'
numdis3d = _ZERO_
allocate(numdis2d(I2DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (numdis2d)'
numdis2d = _ZERO_
if (calc_temp) then
allocate(phymix3d_T(I3DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (phymix3d_T)'
phymix3d_T = _ZERO_
allocate(phymix2d_T(I2DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (phymix2d_T)'
phymix2d_T = _ZERO_
allocate(nummix3d_T(I3DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (nummix3d_T)'
nummix3d_T = _ZERO_
allocate(nummix2d_T(I2DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (nummix2d_T)'
nummix2d_T = _ZERO_
end if
if (calc_salt) then
allocate(phymix3d_S(I3DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (phymix3d_S)'
phymix3d_S = _ZERO_
allocate(phymix2d_S(I2DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (phymix2d_S)'
phymix2d_S = _ZERO_
allocate(nummix3d_S(I3DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (nummix3d_S)'
nummix3d_S = _ZERO_
allocate(nummix2d_S(I2DFIELD),stat=rc)
if (rc /= 0) stop 'postinit_3d: Error allocating memory (nummix2d_S)'
nummix2d_S = _ZERO_
end if
end if
! Hotstart fix - see postinit_2d
if (hotstart) then
......
......@@ -65,18 +65,7 @@
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
REALTYPE :: numdis3d(I3DFIELD)
REALTYPE :: numdis2d(I2DFIELD)
#ifdef SPM
! suspended matter
......
......@@ -125,6 +125,13 @@
#include "dynamic_declarations_3d.h"
#endif
REALTYPE, dimension(:,:,:), allocatable :: numdis3d
REALTYPE, dimension(:,:), allocatable :: numdis2d
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
#ifdef GETM_BIO
REALTYPE, allocatable :: cc3d(:,:,:,:)
REALTYPE, allocatable :: ws3d(:,:,:,:)
......@@ -204,10 +211,7 @@
light=_ONE_
idpdx=_ZERO_
idpdy=_ZERO_
nummix3d_S = _ZERO_ ; nummix2d_S = _ZERO_
nummix3d_T = _ZERO_ ; nummix2d_T = _ZERO_
#endif
numdis3d = _ZERO_ ; numdis2d = _ZERO_
#ifdef DEBUG
write(debug,*) 'Leaving init_variables_3d()'
......
......@@ -402,6 +402,7 @@
end if
if (save_numerical_analyses) then
fv = nummix_missing
mv = nummix_missing
vr(1) = -100.0
......@@ -413,7 +414,6 @@
units='W/kg',&
FillValue=fv,missing_value=mv,valid_range=vr)
#ifndef NO_BAROCLINIC
if (calc_salt) then
err = nf90_def_var(ncid,'nummix3d_S',NCDF_FLOAT_PRECISION,f4_dims,nm3dS_id)
if (err .NE. NF90_NOERR) go to 10
......@@ -445,7 +445,7 @@
units='degC**2/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
#endif
end if
#ifdef SPM
if (spm_save) then
......
......@@ -171,6 +171,7 @@
#endif
if (save_numerical_analyses) then
fv = nummix_missing
mv = nummix_missing
vr(1) = -100.0
......@@ -189,7 +190,6 @@
units='Wm/kg',&
FillValue=fv,missing_value=mv,valid_range=vr)
#ifndef NO_BAROCLINIC
if (calc_salt) then
err = nf90_def_var(ncid,'nummix3d_S',NCDF_FLOAT_PRECISION,f4_dims,nm3dS_id)
if (err .NE. NF90_NOERR) go to 10
......@@ -249,7 +249,7 @@
units='degC**2 m/s',&
FillValue=fv,missing_value=mv,valid_range=vr)
end if
#endif
end if
#ifdef GETM_BIO
......
......@@ -33,8 +33,8 @@
#endif
#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: nummix3d_S,nummix3d_T,phymix3d_S,phymix3d_T
use variables_3d, only: numdis3d
use variables_3d, only: tke,num,nuh,eps
#ifdef SPM
......@@ -362,12 +362,12 @@
end if ! save_ss_nn
if (save_numerical_analyses) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,numdis3d,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
err = nf90_put_var(ncid,nm3d_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
if (calc_salt) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az,nummix3d_S,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws)
......@@ -391,7 +391,7 @@
err = nf90_put_var(ncid,pm3dT_id,ws(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
#endif
end if ! save_numerical_analyses
#ifdef SPM
......
......@@ -138,12 +138,13 @@
#endif
if (save_numerical_analyses) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
numdis3d_mean,nummix_missing, &
imin,imax,jmin,jmax,0,kmax,ws3d)
err = nf90_put_var(ncid, nm3d_id,ws3d(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
if (calc_salt) then
call cnv_3d(imin,jmin,imax,jmax,kmin,kmax,az, &
nummix3d_S_mean,nummix_missing, &
......@@ -171,7 +172,6 @@
err = nf90_put_var(ncid, pm3dT_id,ws3d(_3D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
#endif
start(1) = 1
start(2) = 1
......@@ -185,7 +185,6 @@
err = nf90_put_var(ncid, nm2d_id,ws2d(_2D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
if (calc_salt) then
call cnv_2d(imin,jmin,imax,jmax,az,nummix2d_S_mean,nummix_missing, &
imin,jmin,imax,jmax,ws2d)
......@@ -209,7 +208,7 @@
err = nf90_put_var(ncid, pm2dT_id,ws2d(_2D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
#endif
end if
#ifdef GETM_BIO
......
......@@ -18,9 +18,9 @@
use variables_3d, only: hn,uu,hun,vv,hvn,ww,taub
#ifndef NO_BAROCLINIC
use variables_3d, only: S,T
#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
#endif
use variables_3d, only: numdis3d,numdis2d
#ifdef GETM_BIO
use bio, only: bio_calc
......@@ -222,7 +222,6 @@
if (do_numerical_analyses) then
numdis3d_mean = numdis3d_mean + numdis3d
numdis2d_mean = numdis2d_mean + numdis2d
#ifndef NO_BAROCLINIC
if (calc_temp) then
nummix3d_T_mean = nummix3d_T_mean + nummix3d_T
nummix2d_T_mean = nummix2d_T_mean + nummix2d_T
......@@ -235,7 +234,6 @@
phymix3d_S_mean = phymix3d_S_mean + phymix3d_S
phymix2d_S_mean = phymix2d_S_mean + phymix2d_S
end if
#endif
end if
#ifdef GETM_BIO
if (bio_calc) cc3dmean=cc3dmean + cc3d
......@@ -270,7 +268,6 @@
if (do_numerical_analyses) then
numdis3d_mean = numdis3d_mean / step
numdis2d_mean = numdis2d_mean / step
#ifndef NO_BAROCLINIC
if (calc_temp) then
nummix3d_T_mean = nummix3d_T_mean / step
nummix2d_T_mean = nummix2d_T_mean / step
......@@ -283,7 +280,6 @@
phymix3d_S_mean = phymix3d_S_mean / step
phymix2d_S_mean = phymix2d_S_mean / step
end if
#endif
end if
#ifdef GETM_BIO
if (bio_calc) cc3dmean = cc3dmean / step
......
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