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

Last change on this file since 3182 was 3182, checked in by suehring, 6 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.5 KB
Line 
1!> @file tests/test-boundaries.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-boundaries.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 boundary grid mode of INIFOR's init_grid_definition()
40!> routine.
41!------------------------------------------------------------------------------!
42 PROGRAM test_boundaries
43
44    USE grid, ONLY  :  init_grid_definition
45    USE types, ONLY :  grid_definition
46    USE test_utils
47   
48    IMPLICIT NONE
49
50    CHARACTER(LEN=*), PARAMETER     ::  title = 'boundary initialization'
51    CHARACTER(LEN=20), DIMENSION(2) ::  kind_list = (/ 'boundary', 'boundary' /)
52    LOGICAL                         ::  res
53
54    INTEGER                         ::  i, nx, ny, nz
55    TYPE(grid_definition)           ::  boundary_grid
56
57    REAL ::  dx, dy, dz, lx, ly, lz, x(2), y(10)
58    REAL, TARGET :: z(10)
59
60    CALL begin_test(title, res)
61
62    ! Arange
63    dx = 1e-3
64    dy = 1.0
65    dz = 10.
66    nx = 9
67    ny = 9
68    nz = 9
69    lx = 1.0
70    ly = 1e1
71    lz = 1e2
72    x =   (/ -0.5*dx, lx + 0.5*dx /)
73    y = ( (/0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0/) + 0.5 )
74    z = ( (/0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0/) + 0.5 ) * 10
75
76    DO i = 1, SIZE(kind_list)
77   
78       ! Act
79       CALL init_grid_definition(                                              &
80          kind = kind_list(i), grid = boundary_grid,                           &
81          xmin = x(i), xmax = x(i),                                            &
82          ymin =  0.5 * dy, ymax = ly - 0.5 * dy,                              &
83          x0 = 0.0, y0 = 0.0, z0 = 0.0,                                        &
84          nx = 0, ny = ny, nz = nz, z = z)
85         
86   
87       ! Assert
88       ! asserting that grid % x has exactly two entries and that they match
89       ! expected coordinates
90       res = res .AND. assert_equal(boundary_grid % x, (/ x(i) /), 'x coordinates')
91
92       ! asserting that grid % y and % z have expected ranges and coordinates
93       res = res .AND. assert_equal( boundary_grid % y, y, 'y coordinates')
94       res = res .AND. assert_equal( boundary_grid % z, z, 'z coordinates')
95   
96       CALL fini_grid_definition(boundary_grid)
97    END DO
98
99    CALL end_test(title, res)
100
101 CONTAINS
102
103 SUBROUTINE fini_grid_definition(grid)
104    TYPE(grid_definition), INTENT(INOUT) ::  grid
105
106    DEALLOCATE( grid % x, grid % y )
107    DEALLOCATE( grid % kk )
108    DEALLOCATE( grid % w_verti )
109
110 END SUBROUTINE fini_grid_definition
111
112 END PROGRAM test_boundaries
Note: See TracBrowser for help on using the repository browser.