[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 | ! |
---|
| 17 | ! Copyright 1997-2012 Leibniz University Hannover |
---|
| 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[95] | 21 | ! ----------------- |
---|
| 22 | ! |
---|
[1182] | 23 | ! |
---|
[95] | 24 | ! Former revisions: |
---|
| 25 | ! ------------------ |
---|
[96] | 26 | ! $Id: init_ocean.f90 1182 2013-06-14 09:07:24Z witha $ |
---|
[95] | 27 | ! |
---|
[1182] | 28 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 29 | ! Initial density profile is stored in array hom |
---|
| 30 | ! |
---|
[1037] | 31 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 32 | ! code put under GPL (PALM 3.9) |
---|
| 33 | ! |
---|
[392] | 34 | ! 388 2009-09-23 09:40:33Z raasch |
---|
| 35 | ! Bugfix: Initial profiles of hydrostatic pressure and density are calculated |
---|
| 36 | ! iteratively. First calculation of hyp(0) changed. |
---|
| 37 | ! |
---|
[139] | 38 | ! 124 2007-10-19 15:47:46Z raasch |
---|
| 39 | ! Bugfix: Initial density rho is calculated |
---|
| 40 | ! |
---|
[98] | 41 | ! 97 2007-06-21 08:23:15Z raasch |
---|
| 42 | ! Initial revision |
---|
[95] | 43 | ! |
---|
| 44 | ! Description: |
---|
| 45 | ! ------------ |
---|
| 46 | ! Initialization of quantities needed for the ocean version |
---|
| 47 | !------------------------------------------------------------------------------! |
---|
| 48 | |
---|
| 49 | USE arrays_3d |
---|
| 50 | USE control_parameters |
---|
| 51 | USE eqn_state_seawater_mod |
---|
| 52 | USE grid_variables |
---|
| 53 | USE indices |
---|
[1179] | 54 | USE pegrid |
---|
| 55 | USE statistics |
---|
[95] | 56 | |
---|
| 57 | IMPLICIT NONE |
---|
| 58 | |
---|
[336] | 59 | INTEGER :: k, n |
---|
[95] | 60 | |
---|
[388] | 61 | REAL :: sa_l, pt_l |
---|
[95] | 62 | |
---|
[336] | 63 | REAL, DIMENSION(nzb:nzt+1) :: rho_init |
---|
| 64 | |
---|
[95] | 65 | ALLOCATE( hyp(nzb:nzt+1) ) |
---|
| 66 | |
---|
| 67 | ! |
---|
| 68 | !-- Set water density near the ocean surface |
---|
| 69 | rho_surface = 1027.62 |
---|
| 70 | |
---|
| 71 | ! |
---|
| 72 | !-- Calculate initial vertical profile of hydrostatic pressure (in Pa) |
---|
[96] | 73 | !-- and the reference density (used later in buoyancy term) |
---|
[388] | 74 | !-- First step: Calculate pressure using reference density |
---|
[95] | 75 | hyp(nzt+1) = surface_pressure * 100.0 |
---|
| 76 | |
---|
[97] | 77 | hyp(nzt) = hyp(nzt+1) + rho_surface * g * 0.5 * dzu(nzt+1) |
---|
[336] | 78 | rho_init(nzt) = rho_surface |
---|
[95] | 79 | |
---|
[366] | 80 | DO k = nzt-1, 1, -1 |
---|
[336] | 81 | hyp(k) = hyp(k+1) + rho_surface * g * dzu(k) |
---|
| 82 | ENDDO |
---|
[366] | 83 | hyp(0) = hyp(1) + rho_surface * g * dzu(1) |
---|
[95] | 84 | |
---|
[388] | 85 | ! |
---|
| 86 | !-- Second step: Iteratively calculate in situ density (based on presssure) |
---|
| 87 | !-- and pressure (based on in situ density) |
---|
[336] | 88 | DO n = 1, 5 |
---|
[95] | 89 | |
---|
[336] | 90 | rho_reference = rho_surface * 0.5 * dzu(nzt+1) |
---|
[95] | 91 | |
---|
[336] | 92 | DO k = nzt-1, 0, -1 |
---|
| 93 | |
---|
| 94 | sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) ) |
---|
| 95 | pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) ) |
---|
| 96 | |
---|
| 97 | rho_init(k) = eqn_state_seawater_func( hyp(k), pt_l, sa_l ) |
---|
| 98 | |
---|
| 99 | rho_reference = rho_reference + rho_init(k) * dzu(k+1) |
---|
| 100 | |
---|
| 101 | ENDDO |
---|
| 102 | |
---|
| 103 | rho_reference = rho_reference / ( zw(nzt) - zu(nzb) ) |
---|
| 104 | |
---|
| 105 | DO k = nzt-1, 0, -1 |
---|
| 106 | hyp(k) = hyp(k+1) + g * 0.5 * ( rho_init(k) + rho_init(k+1 ) ) * & |
---|
| 107 | dzu(k+1) |
---|
| 108 | ENDDO |
---|
| 109 | |
---|
[95] | 110 | ENDDO |
---|
| 111 | |
---|
[97] | 112 | ! |
---|
| 113 | !-- Calculate the reference potential density |
---|
| 114 | prho_reference = 0.0 |
---|
| 115 | DO k = 0, nzt |
---|
[96] | 116 | |
---|
[97] | 117 | sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) ) |
---|
| 118 | pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) ) |
---|
| 119 | |
---|
| 120 | prho_reference = prho_reference + dzu(k+1) * & |
---|
[336] | 121 | eqn_state_seawater_func( 0.0, pt_l, sa_l ) |
---|
[97] | 122 | |
---|
| 123 | ENDDO |
---|
| 124 | |
---|
| 125 | prho_reference = prho_reference / ( zu(nzt) - zu(nzb) ) |
---|
| 126 | |
---|
[124] | 127 | ! |
---|
[388] | 128 | !-- Calculate the 3d array of initial in situ and potential density, |
---|
| 129 | !-- based on the initial temperature and salinity profile |
---|
[124] | 130 | CALL eqn_state_seawater |
---|
[97] | 131 | |
---|
[1179] | 132 | ! |
---|
| 133 | !-- Store initial density profile |
---|
| 134 | hom(:,1,77,:) = SPREAD( rho_init(:), 2, statistic_regions+1 ) |
---|
[124] | 135 | |
---|
[1179] | 136 | ! |
---|
| 137 | !-- Set the reference state to be used in the buoyancy terms |
---|
| 138 | IF ( use_single_reference_value ) THEN |
---|
| 139 | ref_state(:) = prho_reference |
---|
| 140 | ELSE |
---|
| 141 | ref_state(:) = rho_init(:) |
---|
| 142 | ENDIF |
---|
| 143 | |
---|
| 144 | |
---|
[95] | 145 | END SUBROUTINE init_ocean |
---|