source: palm/trunk/SOURCE/buoyancy.f90 @ 4180

Last change on this file since 4180 was 4180, checked in by scharf, 5 years ago

removed comments in 'Former revisions' section that are older than 01.01.2019

  • Property svn:keywords set to Id
File size: 7.6 KB
RevLine 
[1873]1!> @file buoyancy.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[2000]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.
[1036]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!
[3655]17! Copyright 1997-2019 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[1328]20! Current revisions:
[1179]21! ------------------
[1354]22!
[2233]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: buoyancy.f90 4180 2019-08-21 14:37:54Z scharf $
[3725]27! unused variables removed
28!
29! 3655 2019-01-07 16:51:22Z knoop
[3636]30! nopointer option removed
31!
[3241]32!
[1]33! Description:
34! ------------
[1682]35!> Buoyancy term of the third component of the equation of motion.
36!> @attention Humidity is not regarded when using a sloping surface!
[1]37!------------------------------------------------------------------------------!
[1682]38 MODULE buoyancy_mod
[1]39
[3274]40    USE basic_constants_and_equations_mod,                                     &
41        ONLY:  g
42
[3294]43    USE arrays_3d,                                                             &
44        ONLY:  pt, pt_slope_ref, ref_state, tend
45
46    USE control_parameters,                                                    &
47        ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string, pt_surface,&
48               sin_alpha_surface, sloping_surface
49
50    USE kinds
51
[1]52    PRIVATE
[2118]53    PUBLIC buoyancy
[1]54
55    INTERFACE buoyancy
56       MODULE PROCEDURE buoyancy
57       MODULE PROCEDURE buoyancy_ij
58    END INTERFACE buoyancy
59
60 CONTAINS
61
62
63!------------------------------------------------------------------------------!
[1682]64! Description:
65! ------------
66!> Call for all grid points
[1]67!------------------------------------------------------------------------------!
[1179]68    SUBROUTINE buoyancy( var, wind_component )
[1]69
[1320]70       USE indices,                                                            &
[3725]71           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzt
[1320]72
73
[1]74       IMPLICIT NONE
75
[1682]76       INTEGER(iwp) ::  i              !<
77       INTEGER(iwp) ::  j              !<
78       INTEGER(iwp) ::  k              !<
79       INTEGER(iwp) ::  wind_component !<
[1320]80       
81       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
[1]82
83
84       IF ( .NOT. sloping_surface )  THEN
85!
86!--       Normal case: horizontal surface
[3634]87          !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
88          !$ACC PRESENT(var) &
89          !$ACC PRESENT(ref_state) &
90          !$ACC PRESENT(tend)
[1179]91          DO  i = nxl, nxr
92             DO  j = nys, nyn
[2232]93                DO  k = nzb+1, nzt-1
94                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp *  &
95                          (                                                     &
[1353]96                             ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
97                             ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
[3538]98                          )
[57]99                ENDDO
100             ENDDO
[1179]101          ENDDO
[1]102
103       ELSE
104!
105!--       Buoyancy term for a surface with a slope in x-direction. The equations
106!--       for both the u and w velocity-component contain proportionate terms.
107!--       Temperature field at time t=0 serves as environmental temperature.
108!--       Reference temperature (pt_surface) is the one at the lower left corner
109!--       of the total domain.
110          IF ( wind_component == 1 )  THEN
111
[106]112             DO  i = nxlu, nxr
[1]113                DO  j = nys, nyn
[2232]114                   DO  k = nzb+1, nzt-1
115                      tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *         &
[1353]116                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
117                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
[3538]118                                    ) / pt_surface
[1]119                   ENDDO
120                ENDDO
121             ENDDO
122
123          ELSEIF ( wind_component == 3 )  THEN
124
125             DO  i = nxl, nxr
126                DO  j = nys, nyn
[2232]127                   DO  k = nzb+1, nzt-1
128                      tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *         &
[1353]129                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
130                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
[3538]131                                    ) / pt_surface
[1]132                   ENDDO
133                ENDDO
134            ENDDO
135
136          ELSE
[247]137             
[1320]138             WRITE( message_string, * ) 'no term for component "',             &
[1]139                                       wind_component,'"'
[247]140             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
[1]141
142          ENDIF
143
144       ENDIF
145
146    END SUBROUTINE buoyancy
147
148
149!------------------------------------------------------------------------------!
[1682]150! Description:
151! ------------
152!> Call for grid point i,j
153!> @attention PGI-compiler creates SIGFPE if opt>1 is used! Therefore, opt=1 is
154!>            forced by compiler-directive.
[1]155!------------------------------------------------------------------------------!
[515]156!pgi$r opt=1
[1179]157    SUBROUTINE buoyancy_ij( i, j, var, wind_component )
[1]158
[1320]159
160       USE indices,                                                            &
[3725]161           ONLY:  nzb, nzt
[1320]162
[1]163       IMPLICIT NONE
164
[1682]165       INTEGER(iwp) ::  i              !<
166       INTEGER(iwp) ::  j              !<
167       INTEGER(iwp) ::  k              !<
168       INTEGER(iwp) ::  wind_component !<
[1320]169       
170       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
[1]171
172
173       IF ( .NOT. sloping_surface )  THEN
174!
175!--       Normal case: horizontal surface
[2232]176          DO  k = nzb+1, nzt-1
[1353]177              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * (    &
[1320]178                        ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +   &
179                        ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)     &
[3538]180                                                                          )
[1179]181          ENDDO
[1]182
183       ELSE
184!
185!--       Buoyancy term for a surface with a slope in x-direction. The equations
186!--       for both the u and w velocity-component contain proportionate terms.
187!--       Temperature field at time t=0 serves as environmental temperature.
188!--       Reference temperature (pt_surface) is the one at the lower left corner
189!--       of the total domain.
190          IF ( wind_component == 1 )  THEN
191
[2232]192             DO  k = nzb+1, nzt-1
193                tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *               &
[1353]194                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
195                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
[3538]196                                    ) / pt_surface
[1]197             ENDDO
198
199          ELSEIF ( wind_component == 3 )  THEN
200
[2232]201             DO  k = nzb+1, nzt-1
202                tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *               &
[1353]203                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
204                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
[3538]205                                    ) / pt_surface
[1]206             ENDDO
207
208          ELSE
209
[1320]210             WRITE( message_string, * ) 'no term for component "',             &
[1]211                                       wind_component,'"'
[247]212             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
[1]213
214          ENDIF
215
216       ENDIF
217
218    END SUBROUTINE buoyancy_ij
219
220 END MODULE buoyancy_mod
Note: See TracBrowser for help on using the repository browser.