source: palm/trunk/UTIL/inifor/tests/test-grid.f90 @ 3182

Last change on this file since 3182 was 3182, checked in by suehring, 3 years ago

New Inifor features: grid stretching, improved command-interface, support start dates in different formats in both YYYYMMDD and YYYYMMDDHH, Ability to manually control input file prefixes (--radiation-prefix, --soil-preifx, --flow-prefix, --soilmoisture-prefix) for compatiblity with DWD forcast naming scheme; GNU-style short and long option; Prepared output of large-scale forcing profiles (no computation yet); Added preprocessor flag netcdf4 to switch output format between netCDF 3 and 4; Updated netCDF variable names and attributes to comply with PIDS v1.9; Inifor bugfixes: Improved compatibility with older Intel Intel compilers by avoiding implicit array allocation; Added origin_lon/_lat values and correct reference time in dynamic driver global attributes; corresponding PALM changes: adjustments to revised Inifor; variables names in dynamic driver adjusted; enable geostrophic forcing also in offline nested mode; variable names in LES-LES and COSMO offline nesting changed; lateral boundary flags for nesting, in- and outflow conditions renamed

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1!> @file tests/test-grid.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 2017-2018 Leibniz Universitaet Hannover
18! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
19!------------------------------------------------------------------------------!
20!
21! Current revisions:
22! -----------------
23! Updated test for new PALM grid strechting
24!
25!
26! Former revisions:
27! -----------------
28! $Id: test-grid.f90 3182 2018-07-27 13:36:03Z suehring $
29! Initial revision
30!
31!
32!
33! Authors:
34! --------
35! @author Eckhard Kadasch
36!
37! Description:
38! ------------
39!> This program tests the PALM grid mode of INIFOR's init_grid_definition()
40!> routine.
41!------------------------------------------------------------------------------!
42 PROGRAM test_grid
43
44    USE grid, ONLY :  grid_definition, init_grid_definition, dx, dy, dz
45    USE test_utils
46   
47    IMPLICIT NONE
48
49    CHARACTER(LEN=*), PARAMETER ::  title = "grid initialization"
50    LOGICAL                     ::  res
51
52    TYPE(grid_definition)   ::  mygrid
53    INTEGER                 ::  i
54    INTEGER, PARAMETER      ::  nx = 9,   ny = 19,   nz = 29
55    REAL, PARAMETER         ::  lx = 100., ly = 200., lz = 300.
56    REAL, DIMENSION(0:nx)   ::  x, xu
57    REAL, DIMENSION(0:ny)   ::  y, yv
58    REAL, DIMENSION(1:nz)   ::  z
59    REAL, DIMENSION(1:nz-1) ::  zw
60
61    CALL begin_test(title, res)
62
63    ! Arange
64    dx = lx / (nx + 1)
65    DO i = 0, nx
66       xu(i) = real(i) / (nx+1) * lx
67       x(i)  = 0.5*dx + xu(i)
68    END DO
69
70    dy = ly / (ny + 1)
71    DO i = 0, ny
72       yv(i) = real(i) / (ny+1) * ly
73       y(i)  = 0.5*dy + yv(i)
74    END DO
75
76    dz(:) = lz / (nz + 1)
77    DO i = 1, nz
78       IF (i < nz)  zw(i) = real(i) / (nz+1) * lz
79       z(i) = 0.5*dz(1) + zw(i)
80    END DO
81
82    ! Act
83    CALL init_grid_definition('palm', grid = mygrid,                           &
84                              xmin = 0., xmax = lx,                            &
85                              ymin = 0., ymax = ly,                            &
86                              x0 = 0.0, y0 = 0.0, z0 = 0.0,                    &
87                              nx = nx, ny = ny, nz = nz,                       &
88                              z = z, zw = zw)
89
90    ! Assert coordinates match
91    res = res .AND. assert_equal(x,      mygrid%x,  "x" )
92    res = res .AND. assert_equal(xu(1:), mygrid%xu, "xu")
93    res = res .AND. assert_equal(y,      mygrid%y,  "y" )
94    res = res .AND. assert_equal(yv(1:), mygrid%yv, "yv")
95    res = res .AND. assert_equal(z,      mygrid%z,  "z" )
96    res = res .AND. assert_equal(zw(1:), mygrid%zw, "zw")
97
98    CALL end_test(title, res)
99
100 END PROGRAM test_grid
Note: See TracBrowser for help on using the repository browser.