[1682] | 1 | !> @file init_ocean.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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[95] | 21 | ! ----------------- |
---|
[1354] | 22 | ! |
---|
[2502] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ------------------ |
---|
| 26 | ! $Id: init_ocean.f90 2845 2018-03-01 08:32:34Z raasch $ |
---|
[2845] | 27 | ! bugfix: set kinematic viscosity for sea water |
---|
| 28 | ! |
---|
| 29 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 30 | ! Corrected "Former revisions" section |
---|
| 31 | ! |
---|
| 32 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 33 | ! Change in file header (GPL part) |
---|
| 34 | ! |
---|
| 35 | ! 2502 2017-09-26 15:51:59Z gronemeier |
---|
[2502] | 36 | ! Bugfix: use equation of state for seawater to calculate rho_ocean_init at nzt |
---|
[1321] | 37 | ! |
---|
[2502] | 38 | ! 2195 2017-03-23 08:15:17Z raasch |
---|
| 39 | ! |
---|
[2195] | 40 | ! 2194 2017-03-23 08:03:04Z raasch |
---|
| 41 | ! bugfix: density is now used in single-value reference state instead of |
---|
| 42 | ! potential density |
---|
| 43 | ! |
---|
[2032] | 44 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
| 45 | ! renamed variable rho_init to rho_ocean_init |
---|
| 46 | ! |
---|
[2001] | 47 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 48 | ! Forced header and separation lines into 80 columns |
---|
| 49 | ! |
---|
[1683] | 50 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 51 | ! Code annotations made doxygen readable |
---|
| 52 | ! |
---|
[1354] | 53 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 54 | ! REAL constants provided with KIND-attribute |
---|
| 55 | ! |
---|
[1323] | 56 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 57 | ! REAL constants defined as wp_kind |
---|
| 58 | ! |
---|
[1321] | 59 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 60 | ! ONLY-attribute added to USE-statements, |
---|
| 61 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 62 | ! kinds are defined in new module kinds, |
---|
| 63 | ! revision history before 2012 removed, |
---|
| 64 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 65 | ! all variable declaration statements |
---|
[95] | 66 | ! |
---|
[1182] | 67 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 68 | ! Initial density profile is stored in array hom |
---|
| 69 | ! |
---|
[1037] | 70 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 71 | ! code put under GPL (PALM 3.9) |
---|
| 72 | ! |
---|
[98] | 73 | ! 97 2007-06-21 08:23:15Z raasch |
---|
| 74 | ! Initial revision |
---|
[95] | 75 | ! |
---|
| 76 | ! Description: |
---|
| 77 | ! ------------ |
---|
[1682] | 78 | !> Initialization of quantities needed for the ocean version |
---|
[95] | 79 | !------------------------------------------------------------------------------! |
---|
[1682] | 80 | SUBROUTINE init_ocean |
---|
| 81 | |
---|
[95] | 82 | |
---|
[1320] | 83 | USE arrays_3d, & |
---|
| 84 | ONLY: dzu, hyp, pt_init, ref_state, sa_init, zu, zw |
---|
| 85 | |
---|
| 86 | USE control_parameters, & |
---|
| 87 | ONLY: g, prho_reference, rho_surface, rho_reference, & |
---|
| 88 | surface_pressure, use_single_reference_value |
---|
| 89 | |
---|
| 90 | USE eqn_state_seawater_mod, & |
---|
| 91 | ONLY: eqn_state_seawater, eqn_state_seawater_func |
---|
| 92 | |
---|
| 93 | USE indices, & |
---|
| 94 | ONLY: nzb, nzt |
---|
| 95 | |
---|
| 96 | USE kinds |
---|
| 97 | |
---|
[1179] | 98 | USE pegrid |
---|
[95] | 99 | |
---|
[1320] | 100 | USE statistics, & |
---|
| 101 | ONLY: hom, statistic_regions |
---|
| 102 | |
---|
[95] | 103 | IMPLICIT NONE |
---|
| 104 | |
---|
[1682] | 105 | INTEGER(iwp) :: k !< |
---|
| 106 | INTEGER(iwp) :: n !< |
---|
[95] | 107 | |
---|
[1682] | 108 | REAL(wp) :: pt_l !< |
---|
| 109 | REAL(wp) :: sa_l !< |
---|
[95] | 110 | |
---|
[2031] | 111 | REAL(wp), DIMENSION(nzb:nzt+1) :: rho_ocean_init !< |
---|
[336] | 112 | |
---|
[95] | 113 | ALLOCATE( hyp(nzb:nzt+1) ) |
---|
| 114 | |
---|
| 115 | ! |
---|
| 116 | !-- Set water density near the ocean surface |
---|
[1353] | 117 | rho_surface = 1027.62_wp |
---|
[95] | 118 | |
---|
| 119 | ! |
---|
[2845] | 120 | !-- Set kinematic viscosity to sea water at 20C |
---|
| 121 | !-- WARNING: This value is especially used for calculating terminal fall |
---|
| 122 | !-- velocities in the LPM, so lpm_init should always be called after |
---|
| 123 | !-- init_ocean! |
---|
| 124 | molecular_viscosity = 1.05E-6_wp |
---|
| 125 | |
---|
| 126 | ! |
---|
[95] | 127 | !-- Calculate initial vertical profile of hydrostatic pressure (in Pa) |
---|
[96] | 128 | !-- and the reference density (used later in buoyancy term) |
---|
[388] | 129 | !-- First step: Calculate pressure using reference density |
---|
[1322] | 130 | hyp(nzt+1) = surface_pressure * 100.0_wp |
---|
[95] | 131 | |
---|
[1353] | 132 | hyp(nzt) = hyp(nzt+1) + rho_surface * g * 0.5_wp * dzu(nzt+1) |
---|
[2031] | 133 | rho_ocean_init(nzt) = rho_surface |
---|
[95] | 134 | |
---|
[366] | 135 | DO k = nzt-1, 1, -1 |
---|
[336] | 136 | hyp(k) = hyp(k+1) + rho_surface * g * dzu(k) |
---|
| 137 | ENDDO |
---|
[366] | 138 | hyp(0) = hyp(1) + rho_surface * g * dzu(1) |
---|
[95] | 139 | |
---|
[388] | 140 | ! |
---|
| 141 | !-- Second step: Iteratively calculate in situ density (based on presssure) |
---|
| 142 | !-- and pressure (based on in situ density) |
---|
[336] | 143 | DO n = 1, 5 |
---|
[95] | 144 | |
---|
[1353] | 145 | rho_reference = rho_surface * 0.5_wp * dzu(nzt+1) |
---|
[95] | 146 | |
---|
[2502] | 147 | DO k = nzt, 0, -1 |
---|
[336] | 148 | |
---|
[1353] | 149 | sa_l = 0.5_wp * ( sa_init(k) + sa_init(k+1) ) |
---|
| 150 | pt_l = 0.5_wp * ( pt_init(k) + pt_init(k+1) ) |
---|
[336] | 151 | |
---|
[2031] | 152 | rho_ocean_init(k) = eqn_state_seawater_func( hyp(k), pt_l, sa_l ) |
---|
[336] | 153 | |
---|
[2031] | 154 | rho_reference = rho_reference + rho_ocean_init(k) * dzu(k+1) |
---|
[336] | 155 | |
---|
| 156 | ENDDO |
---|
| 157 | |
---|
| 158 | rho_reference = rho_reference / ( zw(nzt) - zu(nzb) ) |
---|
| 159 | |
---|
[2502] | 160 | DO k = nzt, 0, -1 |
---|
| 161 | hyp(k) = hyp(k+1) + g * 0.5_wp * ( rho_ocean_init(k) & |
---|
| 162 | + rho_ocean_init(k+1) ) * dzu(k+1) |
---|
[336] | 163 | ENDDO |
---|
| 164 | |
---|
[95] | 165 | ENDDO |
---|
| 166 | |
---|
[97] | 167 | ! |
---|
| 168 | !-- Calculate the reference potential density |
---|
[1353] | 169 | prho_reference = 0.0_wp |
---|
[97] | 170 | DO k = 0, nzt |
---|
[96] | 171 | |
---|
[1353] | 172 | sa_l = 0.5_wp * ( sa_init(k) + sa_init(k+1) ) |
---|
| 173 | pt_l = 0.5_wp * ( pt_init(k) + pt_init(k+1) ) |
---|
[97] | 174 | |
---|
| 175 | prho_reference = prho_reference + dzu(k+1) * & |
---|
[1320] | 176 | eqn_state_seawater_func( 0.0_wp, pt_l, sa_l ) |
---|
[97] | 177 | |
---|
| 178 | ENDDO |
---|
| 179 | |
---|
| 180 | prho_reference = prho_reference / ( zu(nzt) - zu(nzb) ) |
---|
| 181 | |
---|
[124] | 182 | ! |
---|
[388] | 183 | !-- Calculate the 3d array of initial in situ and potential density, |
---|
| 184 | !-- based on the initial temperature and salinity profile |
---|
[124] | 185 | CALL eqn_state_seawater |
---|
[97] | 186 | |
---|
[1179] | 187 | ! |
---|
| 188 | !-- Store initial density profile |
---|
[2031] | 189 | hom(:,1,77,:) = SPREAD( rho_ocean_init(:), 2, statistic_regions+1 ) |
---|
[124] | 190 | |
---|
[1179] | 191 | ! |
---|
| 192 | !-- Set the reference state to be used in the buoyancy terms |
---|
| 193 | IF ( use_single_reference_value ) THEN |
---|
[2194] | 194 | ref_state(:) = rho_reference |
---|
[1179] | 195 | ELSE |
---|
[2031] | 196 | ref_state(:) = rho_ocean_init(:) |
---|
[1179] | 197 | ENDIF |
---|
| 198 | |
---|
| 199 | |
---|
[95] | 200 | END SUBROUTINE init_ocean |
---|