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

Last change on this file since 3289 was 3274, checked in by knoop, 6 years ago

Modularization of all bulk cloud physics code components

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