[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 3618 2018-12-10 13:25:22Z moh.hefny $ |
---|
[3618] | 28 | ! Prefixed all INIFOR modules with inifor_ |
---|
| 29 | ! |
---|
| 30 | ! |
---|
| 31 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2696] | 32 | ! Initial revision |
---|
| 33 | ! |
---|
| 34 | ! |
---|
| 35 | ! |
---|
| 36 | ! Authors: |
---|
| 37 | ! -------- |
---|
| 38 | ! @author Eckhard Kadasch |
---|
| 39 | ! |
---|
| 40 | ! Description: |
---|
| 41 | ! ------------ |
---|
| 42 | !> This program tests INIFOR's central velocity interpolation. |
---|
| 43 | !------------------------------------------------------------------------------! |
---|
| 44 | PROGRAM test_centre_velocities |
---|
| 45 | |
---|
[3618] | 46 | USE inifor_transform, & |
---|
| 47 | ONLY : centre_velocities |
---|
[2696] | 48 | USE test_utils |
---|
| 49 | |
---|
| 50 | IMPLICIT NONE |
---|
| 51 | |
---|
| 52 | CHARACTER(LEN=*), PARAMETER :: title = "centre velocities" |
---|
| 53 | LOGICAL :: res |
---|
| 54 | REAL, DIMENSION(3,3,1) :: u_face, u_centre, u_ref |
---|
| 55 | REAL, DIMENSION(3,3,1) :: v_face, v_centre, v_ref |
---|
| 56 | INTEGER :: i |
---|
| 57 | |
---|
| 58 | CALL begin_test(title, res) |
---|
| 59 | |
---|
| 60 | ! Arange |
---|
| 61 | u_face = RESHAPE( (/1, 2, 3, 1, 2, 3, 1, 2, 3/), SHAPE(u_face)) |
---|
| 62 | v_face = RESHAPE( (/1, 1, 1, 2, 2, 2, 3, 3, 3/), SHAPE(v_face)) |
---|
| 63 | |
---|
| 64 | u_ref = RESHAPE( (/0.0, 1.5, 2.5, 0.0, 1.5, 2.5, 0.0, 1.5, 2.5/), SHAPE(u_ref)) |
---|
| 65 | v_ref = RESHAPE( (/0.0, 0.0, 0.0, 1.5, 1.5, 1.5, 2.5, 2.5, 2.5/), SHAPE(v_ref)) |
---|
| 66 | |
---|
| 67 | u_centre = 0.0 |
---|
| 68 | v_centre = 0.0 |
---|
| 69 | |
---|
| 70 | ! Act |
---|
| 71 | CALL centre_velocities(u_face, v_face, u_centre, v_centre) |
---|
| 72 | |
---|
| 73 | ! Assert that the correct central velocities u_centre and v_centre are computed. |
---|
| 74 | DO i = 1, 3 |
---|
| 75 | res = res .AND. assert_equal(u_centre(:,i,1), u_ref(:,i,1), 'centering u') |
---|
| 76 | res = res .AND. assert_equal(v_centre(i,:,1), v_ref(i,:,1), 'centering v') |
---|
| 77 | END DO |
---|
| 78 | |
---|
| 79 | CALL end_test(title, res) |
---|
| 80 | |
---|
| 81 | END PROGRAM test_centre_velocities |
---|