source: palm/trunk/SOURCE/init_ocean.f90 @ 1175

Last change on this file since 1175 was 1037, checked in by raasch, 12 years ago

last commit documented

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