Commit b68fa145 authored by Knut's avatar Knut

Merge branch 'use_gotm' into nonnegsalt

parents 644c18ef ed9e3588
Pipeline #150 failed with stages
This diff is collapsed.
...@@ -167,7 +167,6 @@ ...@@ -167,7 +167,6 @@
integer :: i,j integer :: i,j
integer :: elev_method=1 integer :: elev_method=1
REALTYPE :: elev_const=_ZERO_ REALTYPE :: elev_const=_ZERO_
integer,parameter :: rk = kind(_ONE_)
character(LEN = PATH_MAX) :: elev_file='elev.nc' character(LEN = PATH_MAX) :: elev_file='elev.nc'
namelist /m2d/ & namelist /m2d/ &
elev_method,elev_const,elev_file, & elev_method,elev_const,elev_file, &
...@@ -434,8 +433,8 @@ ...@@ -434,8 +433,8 @@
! This is only needed for proper flexible output ! This is only needed for proper flexible output
where (az .eq. 0) where (az .eq. 0)
z = -9999.0d0 z = -9999._rk
zo = -9999.0d0 zo = -9999._rk
end where end where
return return
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
IMPLICIT NONE IMPLICIT NONE
! !
! !PUBLIC DATA MEMBERS: ! !PUBLIC DATA MEMBERS:
integer, parameter :: rk = kind(_ONE_)
REALTYPE :: dtm REALTYPE :: dtm
REALTYPE,dimension(:,:),pointer :: zo,z REALTYPE,dimension(:,:),pointer :: zo,z
logical :: deformC=.false. logical :: deformC=.false.
...@@ -121,7 +122,6 @@ ...@@ -121,7 +122,6 @@
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: rc integer :: rc
integer,parameter :: rk = kind(_ONE_)
!EOP !EOP
!------------------------------------------------------------------------- !-------------------------------------------------------------------------
!BOC !BOC
...@@ -174,12 +174,12 @@ ...@@ -174,12 +174,12 @@
end if end if
z = -9999*_ONE_; zo =_ZERO_ z = -9999._rk ; zo =_ZERO_
U = _ZERO_; DU = _ZERO_; Uint = _ZERO_; UEx = _ZERO_ U = _ZERO_; DU = _ZERO_; Uint = _ZERO_; UEx = _ZERO_
V = _ZERO_; DV = _ZERO_; Vint = _ZERO_; VEx = _ZERO_ V = _ZERO_; DV = _ZERO_; Vint = _ZERO_; VEx = _ZERO_
velx = -9999.0 ; vely = -9999.0 velx = -9999._rk ; vely = -9999._rk
where (az .gt. 0) where (az .gt. 0)
velx = _ZERO_ ; vely = _ZERO_ velx = _ZERO_ ; vely = _ZERO_
end where end where
...@@ -336,7 +336,6 @@ ...@@ -336,7 +336,6 @@
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
logical :: used logical :: used
integer,parameter :: rk = kind(_ONE_)
!EOP !EOP
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOC !BOC
......
...@@ -442,8 +442,8 @@ ...@@ -442,8 +442,8 @@
num(i,j,:) = 1.e-15 num(i,j,:) = 1.e-15
nuh(i,j,:) = 1.e-15 nuh(i,j,:) = 1.e-15
#ifndef NO_BAROCLINIC #ifndef NO_BAROCLINIC
S(i,j,:) = -9999.0 S(i,j,:) = -9999._rk
T(i,j,:) = -9999.0 T(i,j,:) = -9999._rk
#endif #endif
end if end if
end do end do
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
use domain, only: imin,jmin,imax,jmax,kmax,H,az,dry_z use domain, only: imin,jmin,imax,jmax,kmax,H,az,dry_z
!KB use get_field, only: get_3d_field !KB use get_field, only: get_3d_field
use variables_2d, only: fwf_int use variables_2d, only: fwf_int
use variables_3d, only: S,hn,kmin use variables_3d, only: rk,S,hn,kmin
use meteo, only: metforcing,met_method,nudge_sss,sss use meteo, only: metforcing,met_method,nudge_sss,sss
use meteo, only: METEO_CONST,METEO_FROMFILE,METEO_FROMEXT use meteo, only: METEO_CONST,METEO_FROMFILE,METEO_FROMEXT
use halo_zones, only: update_3d_halo,wait_halo,D_TAG,H_TAG use halo_zones, only: update_3d_halo,wait_halo,D_TAG,H_TAG
...@@ -305,8 +305,8 @@ ...@@ -305,8 +305,8 @@
stop 'init_salinity' stop 'init_salinity'
end select end select
S(:,:,0) = -9999*_ONE_ S(:,:,0) = -9999._rk
forall(i=imin:imax,j=jmin:jmax, az(i,j).eq.0) S(i,j,:) = -9999*_ONE_ forall(i=imin:imax,j=jmin:jmax, az(i,j).eq.0) S(i,j,:) = -9999._rk
call update_3d_halo(S,S,az,imin,jmin,imax,jmax,kmax,D_TAG) call update_3d_halo(S,S,az,imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG) call wait_halo(D_TAG)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
use domain, only: imin,jmin,imax,kmax,jmax,H,az,dry_z use domain, only: imin,jmin,imax,kmax,jmax,H,az,dry_z
use domain, only: ill,ihl,jll,jhl use domain, only: ill,ihl,jll,jhl
use domain, only: ilg,ihg,jlg,jhg use domain, only: ilg,ihg,jlg,jhg
use variables_3d, only: T,rad,hn,kmin,A,g1,g2,heatflux_net use variables_3d, only: rk,T,rad,hn,kmin,A,g1,g2,heatflux_net
use meteo, only: metforcing,met_method,nudge_sst,sst use meteo, only: metforcing,met_method,nudge_sst,sst
use meteo, only: METEO_CONST,METEO_FROMFILE,METEO_FROMEXT use meteo, only: METEO_CONST,METEO_FROMFILE,METEO_FROMEXT
!KB use get_field, only: get_3d_field !KB use get_field, only: get_3d_field
...@@ -375,8 +375,8 @@ end interface ...@@ -375,8 +375,8 @@ end interface
stop 'init_temperature' stop 'init_temperature'
end select end select
T(:,:,0) = -9999*_ONE_ T(:,:,0) = -9999._rk
forall(i=imin:imax,j=jmin:jmax, az(i,j).eq.0) T(i,j,:) = -9999*_ONE_ forall(i=imin:imax,j=jmin:jmax, az(i,j).eq.0) T(i,j,:) = -9999._rk
call update_3d_halo(T,T,az,imin,jmin,imax,jmax,kmax,D_TAG) call update_3d_halo(T,T,az,imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG) call wait_halo(D_TAG)
......
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
IMPLICIT NONE IMPLICIT NONE
! !
! !PUBLIC DATA MEMBERS: ! !PUBLIC DATA MEMBERS:
integer, parameter :: rk = kind(_ONE_)
REALTYPE :: dt,cnpar=0.9 REALTYPE :: dt,cnpar=0.9
REALTYPE :: avmback=_ZERO_,avhback=_ZERO_ REALTYPE :: avmback=_ZERO_,avhback=_ZERO_
logical :: do_numerical_analyses_3d=.false. logical :: do_numerical_analyses_3d=.false.
...@@ -213,7 +214,6 @@ ...@@ -213,7 +214,6 @@
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: i,j, rc integer :: i,j, rc
integer,parameter :: rk = kind(_ONE_)
!EOP !EOP
!------------------------------------------------------------------------- !-------------------------------------------------------------------------
!BOC !BOC
...@@ -315,8 +315,8 @@ ...@@ -315,8 +315,8 @@
#endif #endif
! must be nonzero for gotm_fabm in case of calc_temp=F ! must be nonzero for gotm_fabm in case of calc_temp=F
g1 = -9999*_ONE_ g1 = -9999._rk
g2 = -9999*_ONE_ g2 = -9999._rk
#ifdef STRUCTURE_FRICTION #ifdef STRUCTURE_FRICTION
sf = _ZERO_ sf = _ZERO_
...@@ -513,7 +513,7 @@ ...@@ -513,7 +513,7 @@
! Original author(s): Karsten Bolding & Jorn Bruggeman ! Original author(s): Karsten Bolding & Jorn Bruggeman
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer,parameter :: rk = kind(_ONE_) !
!EOP !EOP
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOC !BOC
......
...@@ -183,9 +183,9 @@ stop ...@@ -183,9 +183,9 @@ stop
! calculate the z-coordinate of the cell centers ! calculate the z-coordinate of the cell centers
! references to mean sea level ! references to mean sea level
zc(:,:,0)=-H(:,:) zc(:,:,0)=-H(:,:)
zc(:,:,1)=-H(:,:) + 0.5*hn(:,:,1) zc(:,:,1)=-H(:,:) + _HALF_*hn(:,:,1)
do k=2,kmax do k=2,kmax
zc(:,:,k)=zc(:,:,k-1)+0.5*(hn(:,:,k-1)+hn(:,:,k)) zc(:,:,k)=zc(:,:,k-1)+_HALF_*(hn(:,:,k-1)+hn(:,:,k))
end do end do
#ifdef SLICE_MODEL #ifdef SLICE_MODEL
......
This diff is collapsed.
...@@ -362,10 +362,11 @@ ...@@ -362,10 +362,11 @@
#endif #endif
end if end if
#endif #endif
call init_output_processing()
call init_les(runtype) call init_les(runtype)
call init_output_processing()
call init_register_all_variables(runtype) call init_register_all_variables(runtype)
allocate(type_getm_host::output_manager_host) allocate(type_getm_host::output_manager_host)
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
! !
! !USES: ! !USES:
use field_manager use field_manager
use variables_2d, only: register_2d_variables
use variables_3d, only: register_3d_variables
#ifdef _FABM_
use getm_fabm, only: register_fabm_variables
#endif
use output_processing, only: register_processed_variables, finalize_register_processed_variables
IMPLICIT NONE IMPLICIT NONE
! !
! default: all is private. ! default: all is private.
...@@ -229,6 +235,7 @@ ...@@ -229,6 +235,7 @@
#ifdef _FABM_ #ifdef _FABM_
call finalize_register_fabm_variables(fm) call finalize_register_fabm_variables(fm)
#endif #endif
call finalize_register_processed_variables(fm)
return return
end subroutine finalize_register_all_variables end subroutine finalize_register_all_variables
......
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: les_smagorinsky_sym - \label{les_smagorinsky_sym}
!
! !INTERFACE:
subroutine les_smagorinsky_sym(dudxC,dudxV, &
#ifndef SLICE_MODEL
dvdyC,dvdyU, &
#endif
shearX,shearU, &
AmC,AmX,AmU,AmV)
! Note (KK): keep in sync with interface in les.F90
!
! !DESCRIPTION:
!
!
! !USES:
use variables_les, only: SmagC2_2d,SmagX2_2d,SmagU2_2d,SmagV2_2d
use domain, only: imin,imax,jmin,jmax,az,ax,au,av
use domain, only: dxc,dyc,dxx,dyx,dxu,dyu,dxv,dyv
use getm_timers, only: tic,toc,TIM_SMAG2D
!$ use omp_lib
IMPLICIT NONE
!
! !INPUT PARAMETERS:
REALTYPE,dimension(E2DFIELD),intent(in) :: dudxC,dudxV
#ifndef SLICE_MODEL
REALTYPE,dimension(E2DFIELD),intent(in) :: dvdyC,dvdyU
#endif
REALTYPE,dimension(E2DFIELD),intent(in) :: shearX,shearU
!
! !OUTPUT PARAMETERS:
REALTYPE,dimension(E2DFIELD),intent(out),optional :: AmC,AmX,AmU,AmV
!
! !REVISION HISTORY:
! Original author(s): Knut Klingbeil
!
! !LOCAL VARIABLES:
REALTYPE :: dudx,dvdy
integer :: i,j
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'les_smagorinsky_sym() # ',Ncall
#endif
#ifdef SLICE_MODEL
j = jmax/2 ! this MUST NOT be changed!!!
#endif
call tic(TIM_SMAG2D)
!$OMP PARALLEL DEFAULT(SHARED) &
!$OMP FIRSTPRIVATE(j) &
!$OMP PRIVATE(i,dudx,dvdy)
if (present(AmC)) then
!$OMP DO SCHEDULE(RUNTIME)
#ifndef SLICE_MODEL
do j=jmin-1,jmax+1
#endif
do i=imin-1,imax+1
! Note (KK): AmC(az=1) needed in uv_diffusion
if (az(i,j) .eq. 1) then
! interpolate shearC
! Note (KK): in W/E open boundary cells shearC(az=2) would
! require shearU outside open boundary
! in N/S open boundary cells shearC(az=2) would
! require shearU(au=3)
! however shearC(az=2) not needed
AmC(i,j) = ( &
dudxC(i,j) &
#ifndef SLICE_MODEL
- dvdyC(i,j) &
#endif
)**2 &
+ (_HALF_*(shearU(i-1,j) + shearU(i,j)))**2
AmC(i,j) = SmagC2_2d(i,j)*DXC*DYC*sqrt(AmC(i,j))
end if
end do
#ifndef SLICE_MODEL
end do
#endif
!$OMP END DO NOWAIT
#ifdef SLICE_MODEL
!$OMP BARRIER
!$OMP SINGLE
AmC(imin-1:imax+1,j+1) = AmC(imin-1:imax+1,j)
!$OMP END SINGLE
#endif
end if
if (present(AmX)) then
!$OMP DO SCHEDULE(RUNTIME)
#ifndef SLICE_MODEL
do j=jmin-1,jmax
#endif
do i=imin-1,imax
if (ax(i,j) .eq. 1) then
! interpolate dudxX and dvdyX
if (av(i,j).eq.3 .or. av(i+1,j).eq.3) then
! Note (KK): western/eastern open bdy
dudx = _ZERO_
else
dudx = _HALF_*(dudxV(i,j) + dudxV(i+1,j ))
end if
#ifndef SLICE_MODEL
if (au(i,j).eq.3 .or. au(i,j+1).eq.3) then
! Note (KK): northern/southern open bdy
dvdy = _ZERO_
else
dvdy = _HALF_*(dvdyU(i,j) + dvdyU(i ,j+1))
end if
#endif
AmX(i,j) = ( &
dudx &
#ifndef SLICE_MODEL
- dvdy &
#endif
)**2 &
+ shearX(i,j)**2
AmX(i,j) = SmagX2_2d(i,j)*DXX*DYX*sqrt(AmX(i,j))
end if
end do
#ifndef SLICE_MODEL
end do
#endif
!$OMP END DO NOWAIT
#ifdef SLICE_MODEL
!$OMP BARRIER
!$OMP SINGLE
AmX(imin-1:imax,j-1) = AmX(imin-1:imax,j)
AmX(imin-1:imax,j+1) = AmX(imin-1:imax,j)
!$OMP END SINGLE
#endif
end if
if (present(AmU)) then
!$OMP DO SCHEDULE(RUNTIME)
#ifndef SLICE_MODEL
do j=jmin-1,jmax+1
#endif
do i=imin-1,imax
! Note (KK): shearU(au=3) not available
! (however we only need AmU(au=[1|2]) in tracer_diffusion)
if(au(i,j).eq.1 .or. au(i,j).eq.2) then
! interpolate dudxU (see deformation_rates)
if (au(i,j) .eq. 1) then
dudx = _HALF_*(dudxC(i,j) + dudxC(i+1,j))
else
dudx = _ZERO_
end if
AmU(i,j) = ( &
dudx &
#ifndef SLICE_MODEL
- dvdyU(i,j) &
#endif
)**2 &
+ shearU(i,j)**2
AmU(i,j) = SmagU2_2d(i,j)*DXU*DYU*sqrt(AmU(i,j))
end if
end do
#ifndef SLICE_MODEL
end do
#endif
!$OMP END DO NOWAIT
#ifdef SLICE_MODEL
!$OMP BARRIER
!$OMP SINGLE
AmU(imin-1:imax,j+1) = AmU(imin-1:imax,j)
!$OMP END SINGLE
#endif
end if
#ifndef SLICE_MODEL
if (present(AmV)) then
!$OMP DO SCHEDULE(RUNTIME)
do j=jmin-1,jmax
do i=imin-1,imax+1
! Note (KK): we only need AmV(av=[1|2]) in tracer_diffusion
! (shearV(av=3) cannot be calculated anyway)
if(av(i,j).eq.1 .or. av(i,j).eq.2) then
! interpolate dvdyV and shearV (see deformation_rates)
if (av(i,j) .eq. 1) then
dvdy = _HALF_*(dvdyC(i,j) + dvdyC(i,j+1))
else
dvdy = _ZERO_
end if
AmV(i,j) = ( &
dudxV(i,j) &
- dvdy &
)**2 &
+ (_HALF_*(shearX(i-1,j) + shearX(i,j)))**2
AmV(i,j) = SmagV2_2d(i,j)*DXV*DYV*sqrt(AmV(i,j))
end if
end do
end do
!$OMP END DO NOWAIT
end if
#endif
!$OMP END PARALLEL
call toc(TIM_SMAG2D)
#ifdef DEBUG
write(debug,*) 'Leaving les_smagorinsky_sym()'
write(debug,*)
#endif
return
end subroutine les_smagorinsky_sym
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2011 - Hans Burchard and Karsten Bolding !
!-----------------------------------------------------------------------
...@@ -148,14 +148,8 @@ ...@@ -148,14 +148,8 @@
"dimensions do not match") "dimensions do not match")
end if end if
il = ilg ; jl = jlg ; ih = ihg ; jh = jhg il = ilg ; jl = jlg ; ih = ihg ; jh = jhg
else
il = 1 ; jl = 1 ; ih = iextr ; jh = jextr
end if end if
start(1) = il; start(2) = jl;
edges(1) = ih-il+1; edges(2) = jh-jl+1;
edges(3) = 1
allocate(beta(E2DFIELD),stat=err) allocate(beta(E2DFIELD),stat=err)
if (err /= 0) & if (err /= 0) &
stop 'init_meteo_input_ncdf: Error allocating memory (beta)' stop 'init_meteo_input_ncdf: Error allocating memory (beta)'
...@@ -174,6 +168,7 @@ ...@@ -174,6 +168,7 @@
call to_rotated_lat_lon(southpole,olon,olat,rlon,rlat,x) call to_rotated_lat_lon(southpole,olon,olat,rlon,rlat,x)
beta = x beta = x
end if end if
il = 1 ; jl = 1 ; ih = iextr ; jh = jextr
else else
if (met_lat(1) .gt. met_lat(2)) then if (met_lat(1) .gt. met_lat(2)) then
LEVEL3 'Reverting lat-axis and setting grid_scan to 0' LEVEL3 'Reverting lat-axis and setting grid_scan to 0'
...@@ -228,8 +223,21 @@ ...@@ -228,8 +223,21 @@
call getm_error("init_meteo_input_ncdf()", & call getm_error("init_meteo_input_ncdf()", &
"Some interpolation coefficients are not valid") "Some interpolation coefficients are not valid")
end if end if
il = minval(gridmap(:,:,1),mask=(gridmap(:,:,1).gt.0))
jl = minval(gridmap(:,:,2),mask=(gridmap(:,:,2).gt.0))
ih = min( maxval(gridmap(:,:,1))+1 , iextr )
jh = min( maxval(gridmap(:,:,2))+1 , jextr )
where( gridmap(:,:,1).gt.0 ) gridmap(:,:,1) = gridmap(:,:,1) - il + 1
where( gridmap(:,:,2).gt.0 ) gridmap(:,:,2) = gridmap(:,:,2) - jl + 1
end if end if
start(1) = il; start(2) = jl;
edges(1) = ih-il+1; edges(2) = jh-jl+1;
edges(3) = 1
allocate(d_airp(E2DFIELD),stat=rc) allocate(d_airp(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_meteo_input_ncdf: Error allocating memory (d_airp)' if (rc /= 0) stop 'init_meteo_input_ncdf: Error allocating memory (d_airp)'
d_airp = -9999*_ONE_ d_airp = -9999*_ONE_
...@@ -846,7 +854,7 @@ STDERR 'grid_north_pole_longitude ',southpole(2) ...@@ -846,7 +854,7 @@ STDERR 'grid_north_pole_longitude ',southpole(2)
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: i,j,err integer :: i,j,err
REALTYPE,dimension(edges(1),edges(2)) :: wrk,wrk_dp REALTYPE,dimension(edges(1),edges(2)) :: wrk!,wrk_dp
REALTYPE :: angle,uu,vv,sinconv,cosconv REALTYPE :: angle,uu,vv,sinconv,cosconv
!EOP !EOP
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
...@@ -866,8 +874,10 @@ STDERR 'grid_north_pole_longitude ',southpole(2) ...@@ -866,8 +874,10 @@ STDERR 'grid_north_pole_longitude ',southpole(2)
end if end if
else else
!KBKwrk_dp = _ZERO_ !KBKwrk_dp = _ZERO_
call copy_var(grid_scan,wrk,wrk_dp) !call copy_var(grid_scan,wrk,wrk_dp)
call do_grid_interpol(az,wrk_dp,gridmap,ti,ui,airp_input) !call do_grid_interpol(az,wrk_dp,gridmap,ti,ui,airp_input)
call flip_var(wrk)
call do_grid_interpol(az,wrk,gridmap,ti,ui,airp_input)
end if end if
end if end if
...@@ -881,8 +891,10 @@ STDERR 'grid_north_pole_longitude ',southpole(2) ...@@ -881,8 +891,10 @@ STDERR 'grid_north_pole_longitude ',southpole(2)
evap_input(ill:ihl,jll:jhl) = wrk evap_input(ill:ihl,jll:jhl) = wrk
end if end if
else