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