Commit 419b0ed8 authored by kb's avatar kb
Browse files

added psedo-coordinates when grid-type 3 or 4

parent 253ef6f9
......@@ -5,6 +5,13 @@
allocate(ycord(jmin-HALO:jmax+HALO),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (ycord)'
! pseudo coordinate axes - in case of grid-type = 3 or 4
allocate(xxcord(imin-HALO-1:imax+HALO),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (xxcord)'
allocate(yxcord(jmin-HALO-1:jmax+HALO),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (yxcord)'
! mask
allocate(az(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (az)'
......
......@@ -5,6 +5,9 @@
! coordinate axes - grid-type = 1 or 2
REALTYPE, dimension(:), allocatable :: xcord, ycord
! coordinate axes - grid-type = 3 or 4
REALTYPE, dimension(:), allocatable :: xxcord, yxcord
! mask
integer, dimension(:,:), allocatable :: az,au,av,ax
......
......@@ -4,6 +4,10 @@
REALTYPE :: xcord(imin-HALO:imax+HALO)
REALTYPE :: ycord(jmin-HALO:jmax+HALO)
! pseudo coordinate axes - grid-type = 3 or 4
REALTYPE :: xxcord(imin-HALO-1:imax+HALO)
REALTYPE :: yxcord(jmin-HALO-1:jmax+HALO)
! mask
integer :: az(E2DFIELD)
integer :: au(E2DFIELD)
......
!$Id: init_grid_ncdf.F90,v 1.8 2009-09-28 14:39:06 kb Exp $
!$Id: init_grid_ncdf.F90,v 1.9 2009-10-13 13:15:11 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -41,6 +41,9 @@
! Original author(s): Lars Umlauf
!
! $Log: init_grid_ncdf.F90,v $
! Revision 1.9 2009-10-13 13:15:11 kb
! added psedo-coordinates when grid-type 3 or 4
!
! Revision 1.8 2009-09-28 14:39:06 kb
! INLUDE_HALOS -> SAVE_HALOS, renamed dimension names
!
......@@ -116,14 +119,14 @@
yunits = 'degrees_north'
case (3)
xname = 'xic'
xxname = 'xicx'
xxname = 'xix'
yname = 'etac'
yxname = 'etax'
xunits = ' '
yunits = ' '
case (4)
xname = 'xic'
xxname = 'xicx'
xxname = 'xix'
yname = 'etac'
yxname = 'etax'
xunits = ' '
......@@ -364,7 +367,7 @@
case (3,4)
! pseudo coordinate variables
! pseudo coordinate variables - T-points
axisdim(1) = x_dim
status = nf90_def_var(ncid,'xic',NF90_DOUBLE,axisdim,id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
......@@ -375,6 +378,17 @@
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","etac -")
! pseudo coordinate variables - X-points
axisdim(1) = xx_dim
status = nf90_def_var(ncid,'xix',NF90_DOUBLE,axisdim,id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","xix -")
axisdim(1) = yx_dim
status = nf90_def_var(ncid,'etax',NF90_DOUBLE,axisdim,id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"init_grid_ncdf()","etax -")
! position of vertices
status = nf90_def_var(ncid,'xx',NF90_DOUBLE,(/ xx_dim, yx_dim /),id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
......
!$Id: ncdf_topo.F90,v 1.21 2009-10-08 16:08:00 kb Exp $
!$Id: ncdf_topo.F90,v 1.22 2009-10-13 13:15:11 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -26,6 +26,7 @@
use domain, only : H, Hland
use domain, only : grid_type
use domain, only : xcord,ycord
use domain, only : xxcord,yxcord
use domain, only : dx,dy
use domain, only : xc,yc
use domain, only : xx,yx
......@@ -48,6 +49,9 @@
! Karsten Bolding and Hans Burchard)
!
! $Log: ncdf_topo.F90,v $
! Revision 1.22 2009-10-13 13:15:11 kb
! added psedo-coordinates when grid-type 3 or 4
!
! Revision 1.21 2009-10-08 16:08:00 kb
! axes defined in entire domain - cartesian, spherical
!
......@@ -189,7 +193,7 @@ contains
! LEVEL2 'grid_type: ',grid_type
select case (grid_type)
case(1)
LEVEL2 'using Cartesian grid.'
LEVEL2 'using cartesian grid.'
case(2)
LEVEL2 'using spherical grid.'
case(3)
......@@ -301,8 +305,8 @@ contains
select case (grid_type)
case(1)
! cartesian - we require: xc, yc
! cartesian - we check for: dx, dy
! cartesian - we require: xc, yc
! cartesian - we check for: lonc, latc, convc
! cartesian - later we calculate: latu, latv
......@@ -428,8 +432,8 @@ stop
end if
case(2)
! spherical - we require: lonc, latc
! spherical - we check for: dlon, dlat
! spherical - we require: lonc, latc
! spherical - we check for: xc, yc
! spherical - later we calculate: latu, latv
!
......@@ -650,6 +654,21 @@ stop
case default
end select
select case (grid_type)
case(3,4)
! pseudo coordinates for T- and X-points
xxcord(imin-HALO-1) = imin-HALO-1+ioff
do i=imin-HALO,imax+HALO
xcord(i) = i+ioff - _HALF_
xxcord(i) = i+ioff
end do
yxcord(jmin-HALO-1) = jmin-HALO-1+joff
do j=jmin-HALO,jmax+HALO
ycord(j) = j+joff - _HALF_
yxcord(j) = j+joff
end do
end select
! read bottom roughness
if (z0_method .eq. 1) then
status = nf90_inq_varid(ncid,"z0",id)
......@@ -712,7 +731,6 @@ stop
REALTYPE :: expectval,readval,dval
!
!-------------------------------------------------------------------------
#include"netcdf.inc"
#ifdef DEBUG
write(debug,*) "ncdf_get_grid_dxy(): working on coordinate " // cordname
......
!$Id: save_grid_ncdf.F90,v 1.10 2009-10-06 13:11:16 kb Exp $
!$Id: save_grid_ncdf.F90,v 1.11 2009-10-13 13:15:11 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -27,6 +27,7 @@
use domain, only: dx,dy
use domain, only: dlon,dlat
use domain, only: xcord,ycord
use domain, only: xxcord,yxcord
use domain, only: xc,yc
use domain, only: xx,yx
use domain, only: latc,lonc,convc
......@@ -48,6 +49,9 @@
! Original author(s): Lars Umlauf
!
! $Log: save_grid_ncdf.F90,v $
! Revision 1.11 2009-10-13 13:15:11 kb
! added psedo-coordinates when grid-type 3 or 4
!
! Revision 1.10 2009-10-06 13:11:16 kb
! only save bathymetry when az > 0
!
......@@ -161,14 +165,14 @@
status = nf90_inq_varid(ncid,'xc',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xc_id -")
status = nf90_put_var(ncid,id,xcord(imin:imax))
status = nf90_put_var(ncid,id,xcord(IRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xc -")
status = nf90_inq_varid(ncid,'yc',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","yc_id -")
status = nf90_put_var(ncid,id,ycord(jmin:jmax))
status = nf90_put_var(ncid,id,ycord(JRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","yc -")
......@@ -246,16 +250,12 @@
end if
#if 1
case (3,4)
! pseudo coordinate variables
! pseudo coordinate variables - T-points
status = nf90_inq_varid(ncid,'xic',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xic_id -")
do i=imin,imax
xcord(i) = ioff+i
end do
status = nf90_put_var(ncid,id,xcord(IRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xic -")
......@@ -263,14 +263,26 @@
status = nf90_inq_varid(ncid,'etac',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","etac_id -")
do j=1,jmax
ycord(j) = joff+j
end do
status = nf90_put_var(ncid,id,ycord(JRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","etac -")
! pseudo coordinate variables - X-points
status = nf90_inq_varid(ncid,'xix',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xix_id -")
status = nf90_put_var(ncid,id,xxcord(-1+IRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xix -")
status = nf90_inq_varid(ncid,'etax',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","etax_id -")
status = nf90_put_var(ncid,id,yxcord(-1+JRANGE))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","etax -")
! positions of vertices
status = nf90_inq_varid(ncid,'xx',id)
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","xx_id -")
......@@ -314,7 +326,6 @@
convc(1:imax,1:jmax))
if (status .ne. NF90_NOERR) call netcdf_error(status, &
"save_grid_ncdf()","convc -")
#endif
#endif
case default
......
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