[2696] | 1 | !> @file tests/test-centre-velocites.f90 |
---|
| 2 | !------------------------------------------------------------------------------! |
---|
[2718] | 3 | ! This file is part of the PALM model system. |
---|
[2696] | 4 | ! |
---|
[2718] | 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 |
---|
[2696] | 8 | ! version. |
---|
| 9 | ! |
---|
[2718] | 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. |
---|
[2696] | 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 | ! |
---|
[2718] | 17 | ! Copyright 2017-2018 Leibniz Universitaet Hannover |
---|
| 18 | ! Copyright 2017-2018 Deutscher Wetterdienst Offenbach |
---|
[2696] | 19 | !------------------------------------------------------------------------------! |
---|
| 20 | ! |
---|
| 21 | ! Current revisions: |
---|
| 22 | ! ----------------- |
---|
| 23 | ! |
---|
| 24 | ! |
---|
| 25 | ! Former revisions: |
---|
| 26 | ! ----------------- |
---|
| 27 | ! $Id: test-centre-velocities.f90 2718 2018-01-02 08:49:38Z knoop $ |
---|
| 28 | ! Initial revision |
---|
| 29 | ! |
---|
| 30 | ! |
---|
| 31 | ! |
---|
| 32 | ! Authors: |
---|
| 33 | ! -------- |
---|
| 34 | ! @author Eckhard Kadasch |
---|
| 35 | ! |
---|
| 36 | ! Description: |
---|
| 37 | ! ------------ |
---|
| 38 | !> This program tests INIFOR's central velocity interpolation. |
---|
| 39 | !------------------------------------------------------------------------------! |
---|
| 40 | PROGRAM test_centre_velocities |
---|
| 41 | |
---|
| 42 | USE test_utils |
---|
| 43 | USE transform, & |
---|
| 44 | ONLY : centre_velocities |
---|
| 45 | |
---|
| 46 | IMPLICIT NONE |
---|
| 47 | |
---|
| 48 | CHARACTER(LEN=*), PARAMETER :: title = "centre velocities" |
---|
| 49 | LOGICAL :: res |
---|
| 50 | REAL, DIMENSION(3,3,1) :: u_face, u_centre, u_ref |
---|
| 51 | REAL, DIMENSION(3,3,1) :: v_face, v_centre, v_ref |
---|
| 52 | INTEGER :: i |
---|
| 53 | |
---|
| 54 | CALL begin_test(title, res) |
---|
| 55 | |
---|
| 56 | ! Arange |
---|
| 57 | u_face = RESHAPE( (/1, 2, 3, 1, 2, 3, 1, 2, 3/), SHAPE(u_face)) |
---|
| 58 | v_face = RESHAPE( (/1, 1, 1, 2, 2, 2, 3, 3, 3/), SHAPE(v_face)) |
---|
| 59 | |
---|
| 60 | u_ref = RESHAPE( (/0.0, 1.5, 2.5, 0.0, 1.5, 2.5, 0.0, 1.5, 2.5/), SHAPE(u_ref)) |
---|
| 61 | v_ref = RESHAPE( (/0.0, 0.0, 0.0, 1.5, 1.5, 1.5, 2.5, 2.5, 2.5/), SHAPE(v_ref)) |
---|
| 62 | |
---|
| 63 | u_centre = 0.0 |
---|
| 64 | v_centre = 0.0 |
---|
| 65 | |
---|
| 66 | ! Act |
---|
| 67 | CALL centre_velocities(u_face, v_face, u_centre, v_centre) |
---|
| 68 | |
---|
| 69 | ! Assert that the correct central velocities u_centre and v_centre are computed. |
---|
| 70 | DO i = 1, 3 |
---|
| 71 | res = res .AND. assert_equal(u_centre(:,i,1), u_ref(:,i,1), 'centering u') |
---|
| 72 | res = res .AND. assert_equal(v_centre(i,:,1), v_ref(i,:,1), 'centering v') |
---|
| 73 | END DO |
---|
| 74 | |
---|
| 75 | CALL end_test(title, res) |
---|
| 76 | |
---|
| 77 | END PROGRAM test_centre_velocities |
---|