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

Last change on this file since 2815 was 2718, checked in by maronga, 7 years ago

deleting of deprecated files; headers updated where needed

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