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