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

Last change on this file since 1036 was 1036, checked in by raasch, 9 years ago

code has been put under the GNU General Public License (v3)

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