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

Last change on this file since 1321 was 1321, checked in by raasch, 10 years ago

last commit documented

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