Changeset 3294


Ignore:
Timestamp:
Oct 1, 2018 2:37:10 AM (5 years ago)
Author:
raasch
Message:

modularization of the ocean code

Location:
palm/trunk
Files:
2 added
2 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/INSTALL/test_oceanml_p3d

    r3275 r3294  
    1919    initializing_actions       = 'set_constant_profiles', ! initial conditions
    2020
    21     ocean                      = .TRUE., ! enable ocean modeling
    2221    latitude                   = 55.6,
    2322
     
    3736    bc_s_b                     = 'initial_gradient',
    3837    bc_s_t                     = 'neumann',
    39     bc_sa_t                    = 'neumann',
    4038
    4139    use_top_fluxes             = .T.,
     
    4745
    4846    top_heatflux               = 0.0,
    49     top_salinityflux           = 0.0,
    5047!
    5148!-- numerics
     
    7572!-- data output
    7673!-------------------------------------------------------------------------------
    77     netcdf_data_format         = 5, ! use NetCDF3
    78 
    7974    dt_run_control             = 0.0,    ! output interval for run control
    8075
     
    8378/ ! end of runtime parameter namelist
    8479 
     80!-------------------------------------------------------------------------------
     81!-- OCEAN PARAMETER NAMELIST
     82!   Documentation: https://palm.muk.uni-hannover.de/trac/wiki/doc/app/oceanpar
     83!-------------------------------------------------------------------------------
     84&ocean_parameters
     85!
     86!-- top boundary condition for salinity
     87    bc_sa_t                    = 'neumann',
    8588
     89!   zero salinityflux at ocean surface
     90    top_salinityflux           = 0.0,
     91
     92/ ! end of ocean parameters
  • palm/trunk/INSTALL/test_oceanml_rc

    r2508 r3294  
    11
    22 ******************************    --------------------------------------------
    3  * PALM 4.0  Rev: 2507M       *    ocean - run without 1D - prerun
     3 * PALM 5.0  Rev: 3291M       *    ocean - run without 1D - prerun
    44 ******************************    --------------------------------------------
    55
    6  Date:                 02-10-17    Run:       test_oceanml       
    7  Time:                 10:50:00    Run-No.:   00
    8  Run on host:             lcmuk
     6 Date:                 01-10-18    Run:       test_oceanml                     
     7 Time:                 04:15:16    Run-No.:   00
     8 Run on host:              imuk
    99 Number of PEs:               4    Processor grid (x,y): (   2,   2) calculated
    1010 ------------------------------------------------------------------------------
     
    1313 -----------------
    1414
     15 --> Use the Moeng_Wyngaard turbulence closure (LES mode).
    1516 --> Use the boussinesq approximation for the model equations.
    1617 --> Solve perturbation pressure via FFT using temperton-algorithm routines
     
    3435 ----------------------------------
    3536
    36  Grid length:      dx =      1.250 m    dy =      1.250 m    dz =      1.250 m
     37 Grid length:      dx =       1.250 m    dy =       1.250 m
     38                dz(1) =       1.250 m
     39
    3740 Domain size:       x =     80.000 m     y =     80.000 m  z(u) =    -80.000 m
     41
     42
    3843
    3944 Number of gridpoints (x,y,z):  (0:  63, 0:  63, 0:  65)
     
    114119
    115120    1D-Profiles:
    116        Output every             ******** s
     121       Output every             9999999.90 s
    117122
    118123
     
    141146 -------------------
    142147
    143     Geograph. latitude  :   phi    = 55.6 degr
     148    Geograph. latitude  :   latitude  = 55.6 degr
     149    Geograph. longitude :   longitude =  0.0 degr
    144150    Angular velocity    :   omega  = 0.729E-04 rad/s
    145151    Coriolis parameter  :   f      =  0.000120 1/s
    146152                            f*     =  0.000082 1/s
     153
     154    Day of the year at model start :   day_init      =     172
     155    UTC time at model start        :   time_utc_init = 43200.0 s
    147156
    148157    Gravity             :   g      =  9.8 m/s**2
  • palm/trunk/SCRIPTS/palmrun

    r3236 r3294  
    2727# -----------------
    2828# $Id$
     29# more detailed error message for outdated fileconnection file
     30#
     31# 3236 2018-09-10 09:07:06Z raasch
    2932# warning issued in case of file connection file version mismatch,
    3033# host_configuration renamed configuration_identifier,
     
    409412          printf "\n               working directory, but its revision does not match"
    410413          printf "\n               the revision of the default (trunk) version."
    411           printf "\n               You may need to update your connection file!"
     414          printf "\n               You may need to update your connection file"
     415          printf "\n               \"${working_directory}/.palm.iofiles\" !"
    412416       fi
    413417    fi
  • palm/trunk/SOURCE/Makefile

    r3274 r3294  
    2525# -----------------
    2626# $Id$
     27# changes related to modularization of the ocean mode,
     28# bugfix: dependency to advec_ws was missed in chemistry_model_mod
     29#
     30# 3274 2018-09-24 15:42:55Z knoop
    2731# Added palm dependency of multi_agent_system_mod, because of mas_last_actions
    2832# call at the end of palm run
     
    494498        disturb_field.f90 \
    495499        disturb_heatflux.f90 \
    496         eqn_state_seawater.f90 \
    497500        exchange_horiz_2d.f90 \
    498501        exchange_horiz.f90 \
     
    509512        init_grid.f90 \
    510513        init_masks.f90 \
    511         init_ocean.f90 \
    512514        init_pegrid.f90 \
    513515        init_pt_anomaly.f90 \
    514516        init_rankine.f90 \
    515517        init_slope.f90 \
     518        init_vertical_profiles.f90 \
    516519        interaction_droplets_ptq.f90 \
    517520        land_surface_model_mod.f90 \
     
    548551        netcdf_data_input_mod.f90 \
    549552        netcdf_interface_mod.f90 \
     553        ocean_mod.f90 \
    550554        outflow_turbulence.f90 \
    551555        package_parin.f90 \
     
    707711        mod_kinds.o \
    708712        modules.o \
     713        ocean_mod.o \
    709714        radiation_model_mod.o \
    710715        turbulence_closure_mod.o \
     
    753758        chemistry_model_mod.o \
    754759        gust_mod.o \
     760        init_vertical_profiles.o \
    755761        land_surface_model_mod.o \
    756762        large_scale_forcing_nudging_mod.o \
     
    760766        netcdf_data_input_mod.o \
    761767        netcdf_interface_mod.o \
     768        ocean_mod.o \
    762769        plant_canopy_model_mod.o \
    763770        pmc_interface_mod.o \
     
    772779        wind_turbine_model_mod.o
    773780chemistry_model_mod.o: \
     781        advec_ws.o \
    774782        chem_gasphase_mod.o \
    775783        chem_modules.o \
     
    867875        modules.o \
    868876        netcdf_interface_mod.o \
     877        ocean_mod.o \
    869878        radiation_model_mod.o \
    870879        surface_mod.o \
     
    882891        modules.o \
    883892        netcdf_interface_mod.o \
     893        ocean_mod.o \
    884894        turbulence_closure_mod.o \
    885895        urban_surface_mod.o
     
    914924        modules.o \
    915925        random_generator_parallel_mod.o \
    916         surface_mod.o
    917 eqn_state_seawater.o: \
    918         mod_kinds.o \
    919         modules.o \
    920926        surface_mod.o
    921927exchange_horiz.o: \
     
    963969        modules.o \
    964970        netcdf_interface_mod.o \
     971        ocean_mod.o \
    965972        plant_canopy_model_mod.o \
    966973        pmc_handle_communicator_mod.o \
     
    9931000        netcdf_data_input_mod.o \
    9941001        netcdf_interface_mod.o \
     1002        ocean_mod.o \
    9951003        plant_canopy_model_mod.o \
    9961004        pmc_interface_mod.o \
     
    10301038        modules.o \
    10311039        netcdf_interface_mod.o
    1032 init_ocean.o: \
    1033         basic_constants_and_equations_mod.o \
    1034         eqn_state_seawater.o \
    1035         mod_kinds.o \
    1036         modules.o
    10371040init_pegrid.o: \
    10381041        mod_kinds.o \
     
    10521055        mod_kinds.o \
    10531056        modules.o
     1057init_vertical_profiles.o: \
     1058        modules.o \
     1059        mod_kinds.o
    10541060interaction_droplets_ptq.o: \
    10551061        basic_constants_and_equations_mod.o \
     
    12381244        mod_kinds.o \
    12391245        modules.o \
     1246        ocean_mod.o \
    12401247        radiation_model_mod.o \
    12411248        spectra_mod.o \
     
    12431250        urban_surface_mod.o \
    12441251        uv_exposure_model_mod.o
     1252ocean_mod.o: \
     1253 advec_s_pw.o \
     1254        advec_s_up.o \
     1255        advec_ws.o \
     1256        basic_constants_and_equations_mod.o \
     1257        diffusion_s.o \
     1258        init_vertical_profiles.o \
     1259        mod_kinds.o \
     1260        modules.o \
     1261        pmc_interface_mod.o \
     1262        user_actions.o
    12451263outflow_turbulence.o: \
    12461264        cpulog_mod.o \
     
    12781296        multi_agent_system_mod.o \
    12791297        netcdf_interface_mod.o \
     1298        ocean_mod.o \
    12801299        plant_canopy_model_mod.o \
    12811300        pmc_interface_mod.o \
     
    13871406        diffusion_v.o \
    13881407        diffusion_w.o \
    1389         eqn_state_seawater.o \
    13901408        large_scale_forcing_nudging_mod.o \
    13911409        mod_kinds.o \
     
    13931411        modules.o \
    13941412        modules.o \
     1413        ocean_mod.o \
    13951414        plant_canopy_model_mod.o \
    13961415        radiation_model_mod.o \
     
    15081527        mod_kinds.o \
    15091528        modules.o \
     1529 ocean_mod.o \
    15101530        pmc_interface_mod.o \
    15111531        turbulence_closure_mod.o \
     
    15381558        modules.o \
    15391559        multi_agent_system_mod.o \
     1560 ocean_mod.o \
    15401561        pmc_interface_mod.o \
    15411562        prognostic_equations.o \
     
    15951616        mod_particle_attributes.o \
    15961617        modules.o \
     1618 ocean_mod.o \
    15971619        plant_canopy_model_mod.o \
    15981620        pmc_interface_mod.o \
     
    17851807        modules.o \
    17861808        netcdf_interface_mod.o \
     1809        ocean_mod.o \
    17871810        radiation_model_mod.o \
    17881811        random_function_mod.o \
  • palm/trunk/SOURCE/advec_ws.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    293296
    294297       USE control_parameters,                                                 &
    295            ONLY:  humidity, loop_optimization, passive_scalar, ocean,          &
     298           ONLY:  humidity, loop_optimization, passive_scalar, ocean_mode,     &
    296299                  rans_tke_e, ws_scheme_mom, ws_scheme_sca
    297300
     
    369372          ENDIF
    370373
    371           IF ( ocean )  THEN
     374          IF ( ocean_mode )  THEN
    372375             ALLOCATE( sums_wssas_ws_l(nzb:nzt+1,0:threads_per_task-1) )
    373376             sums_wssas_ws_l = 0.0_wp
     
    454457             ENDIF
    455458
    456              IF ( ocean )  THEN
     459             IF ( ocean_mode )  THEN
    457460                ALLOCATE( flux_s_sa(nzb+1:nzt,0:threads_per_task-1),           &
    458461                          diss_s_sa(nzb+1:nzt,0:threads_per_task-1) )
     
    10841087   
    10851088       USE control_parameters,                                                 &
    1086            ONLY:  humidity, passive_scalar, ocean, ws_scheme_mom, ws_scheme_sca
     1089           ONLY:  humidity, passive_scalar, ocean_mode, ws_scheme_mom,         &
     1090                  ws_scheme_sca
    10871091
    10881092       USE kinds
     
    11231127             sums_wsnrs_ws_l = 0.0_wp
    11241128          ENDIF
    1125           IF ( ocean )  sums_wssas_ws_l = 0.0_wp
     1129          IF ( ocean_mode )  sums_wssas_ws_l = 0.0_wp
    11261130
    11271131       ENDIF
  • palm/trunk/SOURCE/average_3d_data.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    149152    USE control_parameters,                                                    &
    150153        ONLY:  air_chemistry, average_count_3d, doav, doav_n, land_surface,    &
    151                urban_surface, varnamelength
     154               ocean_mode, urban_surface, varnamelength
    152155
    153156    USE cpulog,                                                                &
     
    165168        ONLY:  lsm_3d_data_averaging
    166169
     170    USE ocean_mod,                                                             &
     171        ONLY:  ocean_3d_data_averaging
     172
    167173    USE radiation_model_mod,                                                   &
    168174        ONLY:  radiation, radiation_3d_data_averaging
     
    179185    IMPLICIT NONE
    180186
    181     INTEGER(iwp) ::  i  !< running index
    182     INTEGER(iwp) ::  ii !< running index
    183     INTEGER(iwp) ::  j  !< running index
    184     INTEGER(iwp) ::  k  !< running index
     187    INTEGER(iwp) ::  i   !< loop index
     188    INTEGER(iwp) ::  ii  !< loop index
     189    INTEGER(iwp) ::  j   !< loop index
     190    INTEGER(iwp) ::  k   !< loop index
    185191
    186192    CHARACTER (LEN=varnamelength) ::  trimvar  !< TRIM of output-variable string
     
    392398             ENDIF
    393399
    394           CASE ( 'rho_ocean' )
    395              IF ( ALLOCATED( rho_ocean_av ) ) THEN
    396                 DO  i = nxlg, nxrg
    397                    DO  j = nysg, nyng
    398                       DO  k = nzb, nzt+1
    399                          rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) / REAL( average_count_3d, KIND=wp )
    400                       ENDDO
    401                    ENDDO
    402                 ENDDO
    403              ENDIF
    404 
    405400          CASE ( 's' )
    406401             IF ( ALLOCATED( s_av ) ) THEN
     
    414409             ENDIF
    415410
    416           CASE ( 'sa' )
    417              IF ( ALLOCATED( sa_av ) ) THEN
    418                 DO  i = nxlg, nxrg
    419                    DO  j = nysg, nyng
    420                       DO  k = nzb, nzt+1
    421                          sa_av(k,j,i) = sa_av(k,j,i) / REAL( average_count_3d, KIND=wp )
    422                       ENDDO
    423                    ENDDO
    424                 ENDDO
    425              ENDIF
    426 
    427411         CASE ( 'shf*' )
    428412             IF ( ALLOCATED( shf_av ) ) THEN
     
    549533             ENDIF
    550534
     535          CASE ( 'usm_output' )
    551536!             
    552 !--       Block of urban surface model outputs   
    553           CASE ( 'usm_output' )
     537!--          Block of urban surface model outputs
    554538             CALL usm_average_3d_data( 'average', doav(ii) )
    555539
    556540          CASE DEFAULT
    557541!
    558 !--          Turbulence closure module
    559              CALL tcm_3d_data_averaging( 'average', doav(ii) )
    560 !
    561 !--          microphysics module quantities
     542!--          Averaging of data from other modules
     543             IF ( air_chemistry )  THEN
     544                CALL chem_3d_data_averaging( 'average', doav(ii) )
     545             ENDIF
     546
    562547             IF ( bulk_cloud_model )  THEN
    563548                CALL bcm_3d_data_averaging( 'average', doav(ii) )
    564549             ENDIF
    565 !
    566 !--          Land surface quantity
     550
     551             IF ( gust_module_enabled )  THEN
     552                CALL gust_3d_data_averaging( 'average', doav(ii) )
     553             ENDIF
     554
    567555             IF ( land_surface )  THEN
    568556                CALL lsm_3d_data_averaging( 'average', doav(ii) )
    569557             ENDIF
    570 !
    571 !--          Radiation quantity
     558
     559             IF ( ocean_mode )  THEN
     560                CALL ocean_3d_data_averaging( 'average', doav(ii) )
     561             ENDIF
     562
    572563             IF ( radiation )  THEN
    573564                CALL radiation_3d_data_averaging( 'average', doav(ii) )
    574565             ENDIF
    575 !
    576 !--          Gust module quantities
    577              IF ( gust_module_enabled )  THEN
    578                 CALL gust_3d_data_averaging( 'average', doav(ii) )
    579              ENDIF
    580 !
    581 !--          Chemistry quantity
    582              IF ( air_chemistry )  THEN
    583                 CALL chem_3d_data_averaging( 'average', doav(ii) )
    584              ENDIF
    585 !
    586 !--          User-defined quantity
     566
     567             CALL tcm_3d_data_averaging( 'average', doav(ii) )
     568!
     569!--          User-defined quantities
    587570             CALL user_3d_data_averaging( 'average', doav(ii) )
    588571
  • palm/trunk/SOURCE/boundary_conds.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    203206        ONLY:  kappa
    204207
     208    USE bulk_cloud_model_mod,                                                  &
     209        ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert
     210
    205211    USE chemistry_model_mod,                                                   &
    206212        ONLY:  chem_boundary_conds
     
    212218               child_domain, constant_diffusion, coupling_mode, &
    213219               dt_3d, humidity, ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_s_b, &
    214                ibc_s_t,ibc_sa_t, ibc_uv_b, ibc_uv_t,                           &
    215                intermediate_timestep_count,                                    &
    216                nesting_offline, nudging,                                       &
    217                ocean, passive_scalar, rans_mode, rans_tke_e, tsc, use_cmax
     220               ibc_s_t, ibc_uv_b, ibc_uv_t,                           &
     221               intermediate_timestep_count, nesting_offline, nudging,          &
     222               ocean_mode, passive_scalar, rans_mode, rans_tke_e, tsc, use_cmax
    218223
    219224    USE grid_variables,                                                        &
     
    221226
    222227    USE indices,                                                               &
    223         ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,             &
    224                nzb, nzt
     228        ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb, nzt
    225229
    226230    USE kinds
    227231
    228     USE bulk_cloud_model_mod,                                                  &
    229         ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert
     232    USE ocean_mod,                                                             &
     233        ONLY:  ibc_sa_t
    230234
    231235    USE pegrid
     
    529533!
    530534!-- Boundary conditions for salinity
    531     IF ( ocean )  THEN
     535    IF ( ocean_mode )  THEN
    532536!
    533537!--    Bottom boundary: Neumann condition because salinity flux is always
  • palm/trunk/SOURCE/buoyancy.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! module use statements moved to global declaration section
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    5356! 1850 2016-04-08 13:29:27Z maronga
    5457! Module renamed
    55 !
    5658!
    5759! 1682 2015-10-07 23:56:08Z knoop
     
    121123        ONLY:  g
    122124
     125    USE arrays_3d,                                                             &
     126        ONLY:  pt, pt_slope_ref, ref_state, tend
     127
     128    USE control_parameters,                                                    &
     129        ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string, pt_surface,&
     130               sin_alpha_surface, sloping_surface
     131
     132    USE kinds
     133
    123134    PRIVATE
    124135    PUBLIC buoyancy
     
    139150    SUBROUTINE buoyancy( var, wind_component )
    140151
    141        USE arrays_3d,                                                          &
    142            ONLY:  pt, pt_slope_ref, ref_state, tend
    143 
    144        USE control_parameters,                                                 &
    145            ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string,         &
    146                   pt_surface, sin_alpha_surface, sloping_surface
    147 
    148152       USE indices,                                                            &
    149153           ONLY:  nxl, nxlg, nxlu, nxr, nxrg, nyn, nyng, nys, nysg, nzb,       &
    150154                  nzt, wall_flags_0
    151 
    152        USE kinds
    153 
    154        USE pegrid
    155155
    156156
     
    245245    SUBROUTINE buoyancy_ij( i, j, var, wind_component )
    246246
    247        USE arrays_3d,                                                          &
    248            ONLY:  pt, pt_slope_ref, ref_state, tend
    249 
    250        USE control_parameters,                                                 &
    251            ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string,         &
    252                   pt_surface, sin_alpha_surface, sloping_surface
    253247
    254248       USE indices,                                                            &
    255249           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
    256 
    257        USE kinds
    258 
    259        USE pegrid
    260 
    261250
    262251       IMPLICIT NONE
  • palm/trunk/SOURCE/check_parameters.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id: check_parameters.f90 2520 2017-10-05 13:50:26Z gronemeier &
     27! changes concerning modularization of ocean option,
     28! init_vertical_profiles moved to separate file to avoid circular dependency
     29!
     30! 2520 2017-10-05 13:50:26Z gronemeier
    2731! Modularization of all bulk cloud physics code components
    2832!
     
    669673    USE arrays_3d
    670674
     675    USE basic_constants_and_equations_mod
     676
    671677    USE bulk_cloud_model_mod,                                                  &
    672678        ONLY:  bulk_cloud_model, bcm_check_parameters, bcm_check_data_output,  &
     
    676682        ONLY:  chem_boundary_conds, chem_check_data_output,                    &
    677683               chem_check_data_output_pr, chem_species
     684
    678685    USE chem_modules
    679     USE basic_constants_and_equations_mod
     686
    680687    USE control_parameters
     688
    681689    USE dvrp_variables
     690
    682691    USE grid_variables
     692
    683693    USE gust_mod,                                                              &
    684694        ONLY: gust_check_data_output, gust_check_data_output_pr,               &
    685695              gust_check_parameters, gust_module_enabled
     696
     697    USE kinds
     698
    686699    USE indices
     700
    687701    USE land_surface_model_mod,                                                &
    688702        ONLY: lsm_check_data_output, lsm_check_data_output_pr,                 &
     
    691705    USE lsf_nudging_mod,                                                       &
    692706        ONLY:  lsf_nudging_check_parameters, lsf_nudging_check_data_output_pr
    693 
    694     USE kinds
    695707
    696708    USE model_1d_mod,                                                          &
     
    706718               waterflux_output_unit, momentumflux_output_unit
    707719
     720    USE ocean_mod,                                                             &
     721        ONLY:  ocean_check_data_output, ocean_check_data_output_pr,            &
     722               ocean_check_parameters
     723
    708724    USE particle_attributes
     725
    709726    USE pegrid
     727
    710728    USE plant_canopy_model_mod,                                                &
    711729        ONLY:  pcm_check_data_output, pcm_check_parameters
     
    715733
    716734    USE profil_parameter
     735
    717736    USE radiation_model_mod,                                                   &
    718737        ONLY:  radiation, radiation_check_data_output,                         &
    719738               radiation_check_data_output_pr, radiation_check_parameters
     739
    720740    USE spectra_mod,                                                           &
    721741        ONLY:  calculate_spectra, spectra_check_parameters
     742
    722743    USE statistics
     744
    723745    USE subsidence_mod
     746
    724747    USE statistics
     748
    725749    USE synthetic_turbulence_generator_mod,                                    &
    726750        ONLY:  stg_check_parameters
     751
    727752    USE transpose_indices
     753
    728754    USE turbulence_closure_mod,                                                &
    729755        ONLY:  tcm_check_data_output, tcm_check_parameters
     756
    730757    USE urban_surface_mod,                                                     &
    731758        ONLY:  usm_check_data_output, usm_check_parameters
     759
    732760    USE uv_exposure_model_mod,                                                 &
    733761        ONLY:  uvem_check_data_output
     762
    734763    USE wind_turbine_model_mod,                                                &
    735764        ONLY:  wtm_check_parameters
     765
    736766    USE vertical_nesting_mod,                                                  &
    737767        ONLY:  vnested, vnest_check_parameters
     
    10831113
    10841114!
    1085 !-- Check turbulence closure setup
    1086     CALL tcm_check_parameters
    1087 
    1088 !
    10891115!-- Check approximation
    10901116    IF ( TRIM( approximation ) /= 'boussinesq'   .AND.                         &
     
    11271153       CALL message( 'check_parameters', 'PA0450', 1, 2, 0, 6, 0 )
    11281154    ENDIF
     1155!
    11291156!-- Set flux input mode according to approximation if applicable
    11301157    IF ( TRIM( flux_input_mode ) == 'approximation-specific' )  THEN
     
    11451172       CALL message( 'check_parameters', 'PA0451', 1, 2, 0, 6, 0 )
    11461173    ENDIF
     1174!
    11471175!-- Set flux output mode according to approximation if applicable
    11481176    IF ( TRIM( flux_output_mode ) == 'approximation-specific' )  THEN
     
    11631191
    11641192!
    1165 !-- set the flux output units according to flux_output_mode
     1193!-- Set the flux output units according to flux_output_mode
    11661194    IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN
    11671195        heatflux_output_unit              = 'K m/s'
     
    11741202    ENDIF
    11751203
     1204!
    11761205!-- set time series output units for fluxes
    11771206    dots_unit(14:16) = heatflux_output_unit
    11781207    dots_unit(21)    = waterflux_output_unit
    11791208    dots_unit(19:20) = momentumflux_output_unit
    1180 
    1181 !
    1182 !-- Check ocean setting
    1183     IF ( TRIM( coupling_mode ) == 'uncoupled'  .AND.                           &
    1184          TRIM( coupling_char ) == '_O' .AND.                                   &
    1185          .NOT. ocean )  THEN
    1186 
    1187 !
    1188 !--    Check whether an (uncoupled) atmospheric run has been declared as an
    1189 !--    ocean run (this setting is done via palmrun-option -y)
    1190        message_string = 'ocean = .F. does not allow coupling_char = "' //      &
    1191                         TRIM( coupling_char ) // '" set by palmrun-option "-y"'
    1192        CALL message( 'check_parameters', 'PA0317', 1, 2, 0, 6, 0 )
    1193 
    1194     ENDIF
    11951209
    11961210!
     
    14301444
    14311445!
    1432 !-- Check for synthetic turbulence generator settings
     1446!-- Check the module settings
     1447    IF ( ocean_mode )  CALL ocean_check_parameters
     1448    CALL tcm_check_parameters
    14331449    CALL stg_check_parameters
    1434 !
    1435 !-- When plant canopy model is used, peform addtional checks
    1436     IF ( plant_canopy )  CALL pcm_check_parameters
    1437 
    1438 !
    1439 !-- Additional checks for spectra
    1440     IF ( calculate_spectra )  CALL spectra_check_parameters
    1441 !
    1442 !-- When land surface model is used, perform additional checks
    1443     IF ( land_surface )  CALL lsm_check_parameters
    1444 !
    1445 !-- When microphysics module is used, perform additional checks
    1446     IF ( bulk_cloud_model )  CALL bcm_check_parameters
    1447 
    1448 !
    1449 !-- When urban surface model is used, perform additional checks
    1450     IF ( urban_surface )  CALL usm_check_parameters
    1451 
    1452 !
    1453 !-- If wind turbine model is used, perform additional checks
    1454     IF ( wind_turbine )  CALL wtm_check_parameters
    1455 !
    1456 !-- When radiation model is used, peform addtional checks
    1457     IF ( radiation )  CALL radiation_check_parameters
    1458 !
    1459 !-- When gust module is used, perform additional checks
     1450    IF ( plant_canopy )         CALL pcm_check_parameters
     1451    IF ( calculate_spectra )    CALL spectra_check_parameters
     1452    IF ( land_surface )         CALL lsm_check_parameters
     1453    IF ( bulk_cloud_model )     CALL bcm_check_parameters
     1454    IF ( urban_surface )        CALL usm_check_parameters
     1455    IF ( wind_turbine )         CALL wtm_check_parameters
     1456    IF ( radiation )            CALL radiation_check_parameters
    14601457    IF ( gust_module_enabled )  CALL gust_check_parameters
    1461 !
    1462 !-- When large-scale forcing or nudging is used, peform addtional checks
    14631458    IF ( large_scale_forcing  .OR.  nudging )  CALL lsf_nudging_check_parameters
    14641459
    14651460!
    1466 !-- In case of no model continuation run, check initialising parameters and
    1467 !-- deduce further quantities
     1461!-- In case of no restart run, check initialising parameters and calculate
     1462!-- further quantities
    14681463    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
    14691464
     
    14721467       pt_init = pt_surface
    14731468       IF ( humidity       )  q_init  = q_surface
    1474        IF ( ocean          )  sa_init = sa_surface
    14751469       IF ( passive_scalar )  s_init  = s_surface
    14761470       IF ( air_chemistry )  THEN
     
    14861480       gradient = 0.0_wp
    14871481
    1488        IF (  .NOT.  ocean )  THEN
     1482       IF ( .NOT. ocean_mode )  THEN
    14891483
    14901484          ug_vertical_gradient_level_ind(1) = 0
     
    15501544       gradient = 0.0_wp
    15511545
    1552        IF (  .NOT.  ocean )  THEN
     1546       IF ( .NOT. ocean_mode )  THEN
    15531547
    15541548          vg_vertical_gradient_level_ind(1) = 0
     
    16911685!--    Compute initial chemistry profile using the given chemical species gradients
    16921686       IF ( air_chemistry )  THEN                                                         
    1693          DO lsp = 1, nvar
    1694           CALL init_vertical_profiles( cs_vertical_gradient_level_ind(lsp,:),  &
    1695                                        cs_vertical_gradient_level(lsp,:),      &
    1696                                        cs_vertical_gradient(lsp,:),            &
    1697                                        chem_species(lsp)%conc_pr_init,         &
    1698                                        cs_surface(lsp), bc_cs_t_val(lsp) )
    1699          ENDDO
    1700        ENDIF
    1701 !
    1702 !
    1703 !--    If required, compute initial salinity profile using the given salinity
    1704 !--    gradients
    1705        IF ( ocean )  THEN
    1706           CALL init_vertical_profiles( sa_vertical_gradient_level_ind,          &
    1707                                        sa_vertical_gradient_level,              &
    1708                                        sa_vertical_gradient, sa_init,           &
    1709                                        sa_surface, dum )
    1710        ENDIF
    1711 
     1687          DO  lsp = 1, nvar
     1688            CALL init_vertical_profiles( cs_vertical_gradient_level_ind(lsp,:),&
     1689                                         cs_vertical_gradient_level(lsp,:),    &
     1690                                         cs_vertical_gradient(lsp,:),          &
     1691                                         chem_species(lsp)%conc_pr_init,       &
     1692                                         cs_surface(lsp), bc_cs_t_val(lsp) )
     1693          ENDDO
     1694       ENDIF
    17121695
    17131696    ENDIF
     
    17771760                        TRIM( reference_state ) // '"'
    17781761       CALL message( 'check_parameters', 'PA0056', 1, 2, 0, 6, 0 )
    1779     ENDIF
    1780 
    1781 !
    1782 !-- Sign of buoyancy/stability terms
    1783     IF ( ocean )  atmos_ocean_sign = -1.0_wp
    1784 
    1785 !
    1786 !-- Ocean version must use flux boundary conditions at the top
    1787     IF ( ocean .AND. .NOT. use_top_fluxes )  THEN
    1788        message_string = 'use_top_fluxes must be .TRUE. in ocean mode'
    1789        CALL message( 'check_parameters', 'PA0042', 1, 2, 0, 6, 0 )
    17901762    ENDIF
    17911763
     
    20672039
    20682040!
    2069 !-- Boundary conditions for salinity
    2070     IF ( ocean )  THEN
    2071        IF ( bc_sa_t == 'dirichlet' )  THEN
    2072           ibc_sa_t = 0
    2073        ELSEIF ( bc_sa_t == 'neumann' )  THEN
    2074           ibc_sa_t = 1
    2075        ELSE
    2076           message_string = 'unknown boundary condition: bc_sa_t = "' //        &
    2077                            TRIM( bc_sa_t ) // '"'
    2078           CALL message( 'check_parameters', 'PA0068', 1, 2, 0, 6, 0 )
    2079        ENDIF
    2080 
    2081        IF ( top_salinityflux == 9999999.9_wp )  constant_top_salinityflux = .FALSE.
    2082        IF ( ibc_sa_t == 1  .AND.  top_salinityflux == 9999999.9_wp )  THEN
    2083           message_string = 'boundary condition: bc_sa_t = "' //                &
    2084                            TRIM( bc_sa_t ) // '" requires to set ' //          &
    2085                            'top_salinityflux'
    2086           CALL message( 'check_parameters', 'PA0069', 1, 2, 0, 6, 0 )
    2087        ENDIF
    2088 
    2089 !
    2090 !--    A fixed salinity at the top implies Dirichlet boundary condition for
    2091 !--    salinity. In this case specification of a constant salinity flux is
    2092 !--    forbidden.
    2093        IF ( ibc_sa_t == 0  .AND.  constant_top_salinityflux  .AND.             &
    2094             top_salinityflux /= 0.0_wp )  THEN
    2095           message_string = 'boundary condition: bc_sa_t = "' //                &
    2096                            TRIM( bc_sa_t ) // '" is not allowed with ' //      &
    2097                            'top_salinityflux /= 0.0'
    2098           CALL message( 'check_parameters', 'PA0070', 1, 2, 0, 6, 0 )
    2099        ENDIF
    2100 
    2101     ENDIF
    2102 
    2103 !
    21042041!-- Set boundary conditions for total water content
    21052042    IF ( humidity )  THEN
     
    21582095               .AND.  top_scalarflux /= 0.0_wp )  THEN
    21592096          message_string = 'boundary condition: bc_s_t = "' //                 &
    2160                            TRIM( bc_sa_t ) // '" is not allowed with ' //      &
     2097                           TRIM( bc_s_t ) // '" is not allowed with ' //       &
    21612098                           'top_scalarflux /= 0.0'
    21622099          CALL message( 'check_parameters', 'PA0441', 1, 2, 0, 6, 0 )
     
    22302167
    22312168    IF ( rayleigh_damping_height == -1.0_wp )  THEN
    2232        IF (  .NOT.  ocean )  THEN
     2169       IF (  .NOT.  ocean_mode )  THEN
    22332170          rayleigh_damping_height = 0.66666666666_wp * zu(nzt)
    22342171       ELSE
     
    22362173       ENDIF
    22372174    ELSE
    2238        IF (  .NOT.  ocean )  THEN
     2175       IF (  .NOT.  ocean_mode )  THEN
    22392176          IF ( rayleigh_damping_height < 0.0_wp  .OR.                          &
    22402177               rayleigh_damping_height > zu(nzt) )  THEN
     
    25192456             hom(:,2,22,:) = SPREAD( zw, 2, statistic_regions+1 )
    25202457
    2521           CASE ( 'sa', '#sa' )
    2522              IF ( .NOT. ocean )  THEN
    2523                 message_string = 'data_output_pr = ' //                        &
    2524                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2525                                  'lemented for ocean = .FALSE.'
    2526                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2527              ELSE
    2528                 dopr_index(i) = 23
    2529                 dopr_unit(i)  = 'psu'
    2530                 hom(:,2,23,:) = SPREAD( zu, 2, statistic_regions+1 )
    2531                 IF ( data_output_pr(i)(1:1) == '#' )  THEN
    2532                    dopr_initial_index(i) = 26
    2533                    hom(:,2,26,:)         = SPREAD( zu, 2, statistic_regions+1 )
    2534                    hom(nzb,2,26,:)       = 0.0_wp    ! because zu(nzb) is negative
    2535                    data_output_pr(i)     = data_output_pr(i)(2:)
    2536                 ENDIF
    2537              ENDIF
    2538 
    25392458          CASE ( 'u*2' )
    25402459             dopr_index(i) = 30
     
    28462765             hom(:,2,57,:) = SPREAD( zu, 2, statistic_regions+1 )
    28472766
    2848 
    28492767          CASE ( 'u"pt"' )
    28502768             dopr_index(i) = 58
     
    28762794             dopr_unit(i)  = TRIM ( heatflux_output_unit )
    28772795             hom(:,2,63,:) = SPREAD( zu, 2, statistic_regions+1 )
    2878 
    2879           CASE ( 'rho_ocean' )
    2880              IF (  .NOT.  ocean ) THEN
    2881                 message_string = 'data_output_pr = ' //                        &
    2882                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2883                                  'lemented for ocean = .FALSE.'
    2884                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2885              ELSE
    2886                 dopr_index(i) = 64
    2887                 dopr_unit(i)  = 'kg/m3'
    2888                 hom(:,2,64,:) = SPREAD( zu, 2, statistic_regions+1 )
    2889                 IF ( data_output_pr(i)(1:1) == '#' )  THEN
    2890                    dopr_initial_index(i) = 77
    2891                    hom(:,2,77,:)         = SPREAD( zu, 2, statistic_regions+1 )
    2892                    hom(nzb,2,77,:)       = 0.0_wp    ! because zu(nzb) is negative
    2893                    data_output_pr(i)     = data_output_pr(i)(2:)
    2894                 ENDIF
    2895              ENDIF
    2896 
    2897           CASE ( 'w"sa"' )
    2898              IF (  .NOT.  ocean ) THEN
    2899                 message_string = 'data_output_pr = ' //                        &
    2900                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2901                                  'lemented for ocean = .FALSE.'
    2902                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2903              ELSE
    2904                 dopr_index(i) = 65
    2905                 dopr_unit(i)  = 'psu m/s'
    2906                 hom(:,2,65,:) = SPREAD( zw, 2, statistic_regions+1 )
    2907              ENDIF
    2908 
    2909           CASE ( 'w*sa*' )
    2910              IF (  .NOT. ocean  ) THEN
    2911                 message_string = 'data_output_pr = ' //                        &
    2912                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2913                                  'lemented for ocean = .FALSE.'
    2914                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2915              ELSE
    2916                 dopr_index(i) = 66
    2917                 dopr_unit(i)  = 'psu m/s'
    2918                 hom(:,2,66,:) = SPREAD( zw, 2, statistic_regions+1 )
    2919              ENDIF
    2920 
    2921           CASE ( 'wsa' )
    2922              IF (  .NOT.  ocean ) THEN
    2923                 message_string = 'data_output_pr = ' //                        &
    2924                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2925                                  'lemented for ocean = .FALSE.'
    2926                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2927              ELSE
    2928                 dopr_index(i) = 67
    2929                 dopr_unit(i)  = 'psu m/s'
    2930                 hom(:,2,67,:) = SPREAD( zw, 2, statistic_regions+1 )
    2931              ENDIF
    29322796
    29332797          CASE ( 'w*p*' )
     
    29532817             ENDIF
    29542818
    2955           CASE ( 'prho' )
    2956              IF (  .NOT.  ocean ) THEN
    2957                 message_string = 'data_output_pr = ' //                        &
    2958                                  TRIM( data_output_pr(i) ) // ' is not imp' // &
    2959                                  'lemented for ocean = .FALSE.'
    2960                 CALL message( 'check_parameters', 'PA0091', 1, 2, 0, 6, 0 )
    2961              ELSE
    2962                 dopr_index(i) = 71
    2963                 dopr_unit(i)  = 'kg/m3'
    2964                 hom(:,2,71,:) = SPREAD( zu, 2, statistic_regions+1 )
    2965              ENDIF
    2966 
    29672819          CASE ( 'hyp' )
    29682820             dopr_index(i) = 72
     
    30142866             ENDIF
    30152867
    3016 
    3017 
    30182868          CASE DEFAULT
     2869
     2870!
     2871!--          Check for other modules
     2872             IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
     2873                CALL bcm_check_data_output_pr( data_output_pr(i), i, unit,     &
     2874                                               dopr_unit(i) )
     2875             ENDIF
     2876
     2877             IF ( unit == 'illegal' )  THEN
     2878                CALL chem_check_data_output_pr( data_output_pr(i), i, unit,    &
     2879                                                dopr_unit(i) )
     2880             ENDIF
     2881
     2882             IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
     2883                CALL gust_check_data_output_pr( data_output_pr(i), i, unit,    &
     2884                                                dopr_unit(i) )
     2885             ENDIF
     2886
     2887             IF ( unit == 'illegal' )  THEN
     2888                CALL lsf_nudging_check_data_output_pr( data_output_pr(i), i,   &
     2889                                                       unit, dopr_unit(i) )
     2890             ENDIF
    30192891
    30202892             CALL lsm_check_data_output_pr( data_output_pr(i), i, unit,        &
    30212893                                            dopr_unit(i) )
    3022 !
    3023 !--          Block of microphysics module profile outputs
    3024              IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
    3025                    CALL bcm_check_data_output_pr(data_output_pr(i), i, unit,   &
     2894
     2895             IF ( unit == 'illegal' )  THEN
     2896                CALL ocean_check_data_output_pr( data_output_pr(i), i, unit,   &
    30262897                                                 dopr_unit(i) )
    3027              ENDIF
    3028 
    3029              IF ( unit == 'illegal' )  THEN
    3030                 CALL lsf_nudging_check_data_output_pr( data_output_pr(i), i,   &
    3031                                                     unit, dopr_unit(i) )
    30322898             ENDIF
    30332899
     
    30362902                                                     unit, dopr_unit(i) )
    30372903             ENDIF
    3038 !
    3039 !--          Block of gust module profile outputs
    3040              IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
    3041                    CALL gust_check_data_output_pr( data_output_pr(i), i, unit, &
    3042                                                    dopr_unit(i) )
    3043              ENDIF
    3044 
    3045              IF ( unit == 'illegal' )  THEN                                       
    3046                 CALL chem_check_data_output_pr( data_output_pr(i), i,          &
    3047                                                 unit, dopr_unit(i) )
    3048              ENDIF
    3049 
     2904
     2905!
     2906!--          Finally, check for user defined quantities
    30502907             IF ( unit == 'illegal' )  THEN
    30512908                unit = ''
     
    30532910             ENDIF
    30542911
     2912!
     2913!--          No valid quantity found
    30552914             IF ( unit == 'illegal' )  THEN
    30562915                IF ( data_output_pr_user(1) /= ' ' )  THEN
     
    31843043             unit = 'kg/kg'
    31853044
    3186           CASE ( 'rho_ocean' )
    3187              IF (  .NOT.  ocean )  THEN
    3188                 message_string = 'output of "' // TRIM( var ) // '" requi' //  &
    3189                                  'res ocean = .TRUE.'
    3190                 CALL message( 'check_parameters', 'PA0109', 1, 2, 0, 6, 0 )
    3191              ENDIF
    3192              unit = 'kg/m3'
    3193 
    31943045          CASE ( 's' )
    31953046             IF (  .NOT.  passive_scalar )  THEN
     
    31993050             ENDIF
    32003051             unit = 'kg/m3'
    3201 
    3202           CASE ( 'sa' )
    3203              IF (  .NOT.  ocean )  THEN
    3204                 message_string = 'output of "' // TRIM( var ) // '" requi' //  &
    3205                                  'res ocean = .TRUE.'
    3206                 CALL message( 'check_parameters', 'PA0109', 1, 2, 0, 6, 0 )
    3207              ENDIF
    3208              unit = 'psu'
    32093052
    32103053          CASE ( 'p', 'pt', 'u', 'v', 'w' )
     
    32793122          CASE DEFAULT
    32803123
    3281              CALL tcm_check_data_output ( var, unit )
    3282 
    3283 !
    3284 !--          Block of microphysics module outputs
     3124             CALL tcm_check_data_output( var, unit )
     3125
     3126!
     3127!--          Check for other modules
    32853128             IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
    3286                 CALL bcm_check_data_output ( var, unit )
    3287              ENDIF
    3288 
    3289              IF ( unit == 'illegal' )  THEN
    3290                 CALL lsm_check_data_output ( var, unit, i, ilen, k )
    3291              ENDIF
    3292 
    3293              IF ( unit == 'illegal' )  THEN
    3294                 CALL radiation_check_data_output( var, unit, i, ilen, k )
    3295              ENDIF
    3296 
    3297 !
    3298 !--          Block of gust module outputs
    3299              IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
    3300                 CALL gust_check_data_output ( var, unit )
    3301              ENDIF
    3302 
    3303 !
    3304 !--          Block of chemistry model outputs
     3129                CALL bcm_check_data_output( var, unit )
     3130             ENDIF
     3131
    33053132             IF ( unit == 'illegal'  .AND.  air_chemistry                      &
    33063133                                     .AND.  var(1:3) == 'kc_' )  THEN
     
    33083135             ENDIF
    33093136
    3310 !
    3311 !--          Block of urban surface model outputs
    3312              IF ( unit == 'illegal' .AND. urban_surface .AND. var(1:4) == 'usm_' ) THEN
     3137             IF ( unit == 'illegal' )  THEN
     3138                CALL lsm_check_data_output ( var, unit, i, ilen, k )
     3139             ENDIF
     3140
     3141             IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
     3142                CALL gust_check_data_output ( var, unit )
     3143             ENDIF
     3144
     3145             IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
     3146                CALL ocean_check_data_output( var, unit )
     3147             ENDIF
     3148
     3149             IF ( unit == 'illegal'  .AND.  plant_canopy                       &
     3150                                     .AND.  var(1:4) == 'pcm_' )  THEN
     3151                CALL pcm_check_data_output( var, unit )
     3152             ENDIF
     3153
     3154             IF ( unit == 'illegal' )  THEN
     3155                CALL radiation_check_data_output( var, unit, i, ilen, k )
     3156             ENDIF
     3157
     3158             IF ( unit == 'illegal'  .AND.  urban_surface                      &
     3159                                     .AND.  var(1:4) == 'usm_' )  THEN
    33133160                 CALL usm_check_data_output( var, unit )
    33143161             ENDIF
    33153162
    3316 !
    3317 !--          Block of plant canopy model outputs
    3318              IF ( unit == 'illegal' .AND. plant_canopy .AND. var(1:4) == 'pcm_' ) THEN
    3319                  CALL pcm_check_data_output( var, unit )
    3320              ENDIF
    3321 
    3322 !
    3323 !--          Block of uv exposure model outputs
    3324              IF ( unit == 'illegal' .AND. uv_exposure .AND. var(1:5) == 'uvem_' )  THEN
     3163             IF ( unit == 'illegal'  .AND.  uv_exposure                        &
     3164                                     .AND.  var(1:5) == 'uvem_' )  THEN
    33253165                CALL uvem_check_data_output( var, unit, i, ilen, k )
    33263166             ENDIF
    33273167
     3168!
     3169!--          Finally, check for user-defined quantities
    33283170             IF ( unit == 'illegal' )  THEN
    33293171                unit = ''
     
    36283470!-- Determine upper and lower hight level indices for random perturbations
    36293471    IF ( disturbance_level_b == -9999999.9_wp )  THEN
    3630        IF ( ocean )  THEN
     3472       IF ( ocean_mode )  THEN
    36313473          disturbance_level_b     = zu((nzt*2)/3)
    36323474          disturbance_level_ind_b = ( nzt * 2 ) / 3
     
    36533495
    36543496    IF ( disturbance_level_t == -9999999.9_wp )  THEN
    3655        IF ( ocean )  THEN
     3497       IF ( ocean_mode )  THEN
    36563498          disturbance_level_t     = zu(nzt-3)
    36573499          disturbance_level_ind_t = nzt - 3
     
    40743916
    40753917
    4076 
    4077 !------------------------------------------------------------------------------!
    4078 ! Description:
    4079 ! ------------
    4080 !> Inititalizes the vertical profiles of scalar quantities.
    4081 !------------------------------------------------------------------------------!
    4082 
    4083     SUBROUTINE init_vertical_profiles( vertical_gradient_level_ind,            &
    4084                                        vertical_gradient_level,                &
    4085                                        vertical_gradient,                      &
    4086                                        pr_init, surface_value, bc_t_val )
    4087 
    4088 
    4089        IMPLICIT NONE
    4090 
    4091        INTEGER(iwp) ::  i     !< counter
    4092        INTEGER(iwp), DIMENSION(1:10) ::  vertical_gradient_level_ind !< vertical grid indices for gradient levels
    4093 
    4094        REAL(wp)     ::  bc_t_val      !< model top gradient
    4095        REAL(wp)     ::  gradient      !< vertica gradient of the respective quantity
    4096        REAL(wp)     ::  surface_value !< surface value of the respecitve quantity
    4097 
    4098 
    4099        REAL(wp), DIMENSION(0:nz+1) ::  pr_init                 !< initialisation profile
    4100        REAL(wp), DIMENSION(1:10)   ::  vertical_gradient       !< given vertical gradient
    4101        REAL(wp), DIMENSION(1:10)   ::  vertical_gradient_level !< given vertical gradient level
    4102 
    4103        i = 1
    4104        gradient = 0.0_wp
    4105 
    4106        IF (  .NOT.  ocean )  THEN
    4107 
    4108           vertical_gradient_level_ind(1) = 0
    4109           DO  k = 1, nzt+1
    4110              IF ( i < 11 )  THEN
    4111                 IF ( vertical_gradient_level(i) < zu(k)  .AND.            &
    4112                      vertical_gradient_level(i) >= 0.0_wp )  THEN
    4113                    gradient = vertical_gradient(i) / 100.0_wp
    4114                    vertical_gradient_level_ind(i) = k - 1
    4115                    i = i + 1
    4116                 ENDIF
    4117              ENDIF
    4118              IF ( gradient /= 0.0_wp )  THEN
    4119                 IF ( k /= 1 )  THEN
    4120                    pr_init(k) = pr_init(k-1) + dzu(k) * gradient
    4121                 ELSE
    4122                    pr_init(k) = pr_init(k-1) + dzu(k) * gradient
    4123                 ENDIF
    4124              ELSE
    4125                 pr_init(k) = pr_init(k-1)
    4126              ENDIF
    4127    !
    4128    !--       Avoid negative values
    4129              IF ( pr_init(k) < 0.0_wp )  THEN
    4130                 pr_init(k) = 0.0_wp
    4131              ENDIF
    4132           ENDDO
    4133 
    4134        ELSE
    4135 
    4136           vertical_gradient_level_ind(1) = nzt+1
    4137           DO  k = nzt, 0, -1
    4138              IF ( i < 11 )  THEN
    4139                 IF ( vertical_gradient_level(i) > zu(k)  .AND.            &
    4140                      vertical_gradient_level(i) <= 0.0_wp )  THEN
    4141                    gradient = vertical_gradient(i) / 100.0_wp
    4142                    vertical_gradient_level_ind(i) = k + 1
    4143                    i = i + 1
    4144                 ENDIF
    4145              ENDIF
    4146              IF ( gradient /= 0.0_wp )  THEN
    4147                 IF ( k /= nzt )  THEN
    4148                    pr_init(k) = pr_init(k+1) - dzu(k+1) * gradient
    4149                 ELSE
    4150                    pr_init(k)   = surface_value - 0.5_wp * dzu(k+1) * gradient
    4151                    pr_init(k+1) = surface_value + 0.5_wp * dzu(k+1) * gradient
    4152                 ENDIF
    4153              ELSE
    4154                 pr_init(k) = pr_init(k+1)
    4155              ENDIF
    4156    !
    4157    !--       Avoid negative humidities
    4158              IF ( pr_init(k) < 0.0_wp )  THEN
    4159                 pr_init(k) = 0.0_wp
    4160              ENDIF
    4161           ENDDO
    4162 
    4163        ENDIF
    4164 
    4165 !
    4166 !--    In case of no given gradients, choose zero gradient conditions
    4167        IF ( vertical_gradient_level(1) == -999999.9_wp )  THEN
    4168           vertical_gradient_level(1) = 0.0_wp
    4169        ENDIF
    4170 !
    4171 !--    Store gradient at the top boundary for possible Neumann boundary condition
    4172        bc_t_val  = ( pr_init(nzt+1) - pr_init(nzt) ) / dzu(nzt+1)
    4173 
    4174     END SUBROUTINE init_vertical_profiles
    4175 
    4176 
    4177 
    41783918!------------------------------------------------------------------------------!
    41793919! Description:
  • palm/trunk/SOURCE/data_output_2d.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    238241    USE arrays_3d,                                                             &
    239242        ONLY:  dzw, e, heatflux_output_conversion, nc, nr, p, pt,              &
    240                precipitation_amount, prr, q, qc, ql, ql_c, ql_v, qr,           &
    241                rho_ocean, s, sa, tend, u, v, vpt, w, zu, zw,                   &
    242                waterflux_output_conversion, hyrho, d_exner
     243               precipitation_amount, prr, q, qc, ql, ql_c, ql_v, qr, s, tend,  &
     244               u, v, vpt, w, zu, zw, waterflux_output_conversion, hyrho, d_exner
    243245
    244246    USE averaging
     
    258260               ibc_uv_b, io_blocks, io_group, land_surface, message_string,    &
    259261               ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz,                          &
    260                psolver, section, simulated_time,                               &
     262               ocean_mode, psolver, section, simulated_time,                   &
    261263               time_since_reference_point, uv_exposure
    262264
     
    284286               id_var_time_xy, id_var_time_xz, id_var_time_yz, nc_stat,        &
    285287               netcdf_data_format, netcdf_handle_error
     288
     289    USE ocean_mod,                                                             &
     290        ONLY:  ocean_data_output_2d
    286291
    287292    USE particle_attributes,                                                   &
     
    940945                level_z(nzb+1) = zu(nzb+1)
    941946
    942              CASE ( 'rho_ocean_xy', 'rho_ocean_xz', 'rho_ocean_yz' )
    943                 IF ( av == 0 )  THEN
    944                    to_be_resorted => rho_ocean
    945                 ELSE
    946                    IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN
    947                       ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    948                       rho_ocean_av = REAL( fill_value, KIND = wp )
    949                    ENDIF
    950                    to_be_resorted => rho_ocean_av
    951                 ENDIF
    952 
    953947             CASE ( 's_xy', 's_xz', 's_yz' )
    954948                IF ( av == 0 )  THEN
     
    960954                   ENDIF
    961955                   to_be_resorted => s_av
    962                 ENDIF
    963 
    964              CASE ( 'sa_xy', 'sa_xz', 'sa_yz' )
    965                 IF ( av == 0 )  THEN
    966                    to_be_resorted => sa
    967                 ELSE
    968                    IF ( .NOT. ALLOCATED( sa_av ) ) THEN
    969                       ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    970                       sa_av = REAL( fill_value, KIND = wp )
    971                    ENDIF
    972                    to_be_resorted => sa_av
    973956                ENDIF
    974957
     
    13061289
    13071290!
    1308 !--             Turbulence closure variables
    1309                 IF ( .NOT. found )  THEN
    1310                    CALL tcm_data_output_2d( av, do2d(av,if), found, grid, mode,&
    1311                                              local_pf, nzb_do, nzt_do )
    1312                 ENDIF
    1313 
    1314 !
    1315 !--             Microphysics module quantities
     1291!--             Quantities of other modules
    13161292                IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
    13171293                   CALL bcm_data_output_2d( av, do2d(av,if), found, grid, mode,&
     
    13191295                ENDIF
    13201296
    1321 !
    1322 !--             Land surface model quantity
     1297                IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
     1298                   CALL gust_data_output_2d( av, do2d(av,if), found, grid,     &
     1299                                             local_pf, two_d, nzb_do, nzt_do )
     1300                ENDIF
     1301
    13231302                IF ( .NOT. found  .AND.  land_surface )  THEN
    13241303                   CALL lsm_data_output_2d( av, do2d(av,if), found, grid, mode,&
     
    13261305                ENDIF
    13271306
    1328 !
    1329 !--             Radiation quantity
     1307                IF ( .NOT. found  .AND.  ocean_mode )  THEN
     1308                   CALL ocean_data_output_2d( av, do2d(av,if), found, grid,    &
     1309                                              mode, local_pf, nzb_do, nzt_do )
     1310                ENDIF
     1311
    13301312                IF ( .NOT. found  .AND.  radiation )  THEN
    13311313                   CALL radiation_data_output_2d( av, do2d(av,if), found, grid,&
     
    13341316                ENDIF
    13351317
    1336 !
    1337 !--             Gust module quantities
    1338                 IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
    1339                    CALL gust_data_output_2d( av, do2d(av,if), found, grid,     &
    1340                                              local_pf, two_d, nzb_do, nzt_do )
    1341                 ENDIF
    1342 
    1343 !
    1344 !--             UV exposure model quantity
     1318                IF ( .NOT. found )  THEN
     1319                   CALL tcm_data_output_2d( av, do2d(av,if), found, grid, mode,&
     1320                                             local_pf, nzb_do, nzt_do )
     1321                ENDIF
     1322
    13451323                IF ( .NOT. found  .AND.  uv_exposure )  THEN
    13461324                   CALL uvem_data_output_2d( av, do2d(av,if), found, grid,     &
     
    13491327
    13501328!
    1351 !--             User defined quantity
     1329!--             User defined quantities
    13521330                IF ( .NOT. found )  THEN
    13531331                   CALL user_data_output_2d( av, do2d(av,if), found, grid,     &
  • palm/trunk/SOURCE/data_output_3d.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    208211
    209212    USE arrays_3d,                                                             &
    210         ONLY:  e, nc, nr, p, pt, prr, q, qc, ql, ql_c, ql_v, qr, rho_ocean, s, &
    211                sa, tend, u, v, vpt, w, d_exner
     213        ONLY:  d_exner, e, nc, nr, p, pt, prr, q, qc, ql, ql_c, ql_v, qr, s,  &
     214               tend, u, v, vpt, w
    212215
    213216    USE averaging
     
    225228        ONLY:  air_chemistry, do3d, do3d_no, do3d_time_count,                  &
    226229               io_blocks, io_group, land_surface, message_string,              &
    227                ntdim_3d, nz_do3d,  plant_canopy,                               &
     230               ntdim_3d, nz_do3d,  ocean_mode, plant_canopy,                   &
    228231               psolver, simulated_time, time_since_reference_point,            &
    229232               urban_surface, varnamelength
     
    252255               netcdf_data_format, netcdf_handle_error
    253256       
     257    USE ocean_mod,                                                             &
     258        ONLY:  ocean_data_output_3d
     259
    254260    USE particle_attributes,                                                   &
    255261        ONLY:  grid_particles, number_of_particles, particles,                 &
     
    614620             ENDIF
    615621
    616           CASE ( 'rho_ocean' )
    617              IF ( av == 0 )  THEN
    618                 to_be_resorted => rho_ocean
    619              ELSE
    620                 IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN
    621                    ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    622                    u_av = REAL( fill_value, KIND = wp )
    623                 ENDIF
    624                 to_be_resorted => rho_ocean_av
    625              ENDIF
    626 
    627622          CASE ( 's' )
    628623             IF ( av == 0 )  THEN
     
    634629                ENDIF
    635630                to_be_resorted => s_av
    636              ENDIF
    637 
    638           CASE ( 'sa' )
    639              IF ( av == 0 )  THEN
    640                 to_be_resorted => sa
    641              ELSE
    642                 IF ( .NOT. ALLOCATED( sa_av ) ) THEN
    643                    ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    644                    sa_av = REAL( fill_value, KIND = wp )
    645                 ENDIF
    646                 to_be_resorted => sa_av
    647631             ENDIF
    648632
     
    701685          CASE DEFAULT
    702686
    703              IF ( .NOT. found )  THEN
    704                 CALL tcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
    705                                          nzb_do, nzt_do )
    706                 resorted = .TRUE.
    707              ENDIF
    708 
    709 !
    710 !--          Microphysic module quantities
     687!
     688!--          Quantities of other modules
    711689             IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
    712690                CALL bcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
     
    715693             ENDIF
    716694
    717 !
    718 !--          Land surface quantity
     695             IF ( .NOT. found  .AND.  air_chemistry )  THEN
     696                CALL chem_data_output_3d( av, do3d(av,if), found,              &
     697                                          local_pf, fill_value, nzb_do, nzt_do )
     698                resorted = .TRUE.
     699             ENDIF
     700
     701             IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
     702                CALL gust_data_output_3d( av, do3d(av,if), found, local_pf,    &
     703                                          nzb_do, nzt_do )
     704                resorted = .TRUE.
     705             ENDIF
     706
    719707             IF ( .NOT. found  .AND.  land_surface )  THEN
    720708!
     
    742730             ENDIF
    743731
    744 !
    745 !--          Radiation quantity
     732             IF ( .NOT. found  .AND.  ocean_mode )  THEN
     733                CALL ocean_data_output_3d( av, do3d(av,if), found, local_pf,   &
     734                                           nzb_do, nzt_do )
     735                resorted = .TRUE.
     736             ENDIF
     737
     738             IF ( .NOT. found  .AND.  plant_canopy )  THEN
     739                CALL pcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
     740                                         fill_value, nzb_do, nzt_do )
     741                resorted = .TRUE.
     742             ENDIF
     743
    746744             IF ( .NOT. found  .AND.  radiation )  THEN
    747745                CALL radiation_data_output_3d( av, do3d(av,if), found,         &
     
    750748             ENDIF
    751749
    752 !
    753 !--          Gust module quantities
    754              IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
    755                 CALL gust_data_output_3d( av, do3d(av,if), found, local_pf,    &
    756                                           nzb_do, nzt_do )
    757                 resorted = .TRUE.
    758              ENDIF
    759 
    760 !
    761 !--          Chemistry model output
    762              IF ( .NOT. found  .AND.  air_chemistry )  THEN
    763                 CALL chem_data_output_3d( av, do3d(av,if), found,              &
    764                                           local_pf, fill_value, nzb_do, nzt_do )
    765                 resorted = .TRUE.
    766              ENDIF
    767 
    768 !
    769 !--          Plant canopy model output
    770              IF ( .NOT. found  .AND.  plant_canopy )  THEN
    771                 CALL pcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
    772                                          fill_value, nzb_do, nzt_do )
    773                 resorted = .TRUE.
    774              ENDIF
    775 
    776 !
    777 !--          User defined quantity
     750             IF ( .NOT. found )  THEN
     751                CALL tcm_data_output_3d( av, do3d(av,if), found, local_pf,     &
     752                                         nzb_do, nzt_do )
     753                resorted = .TRUE.
     754             ENDIF
     755
     756!
     757!--          User defined quantities
    778758             IF ( .NOT. found )  THEN
    779759                CALL user_data_output_3d( av, do3d(av,if), found, local_pf,    &
  • palm/trunk/SOURCE/flow_statistics.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    296299                dt_3d, humidity, initializing_actions, land_surface,           &
    297300                large_scale_forcing, large_scale_subsidence, max_pr_user,      &
    298                 message_string, neutral, ocean, passive_scalar, simulated_time,&
    299                 simulated_time_at_begin, use_subsidence_tendencies,            &
    300                 use_surface_fluxes, use_top_fluxes, ws_scheme_mom,            &
    301                 ws_scheme_sca
     301                message_string, neutral, ocean_mode, passive_scalar,           &
     302                simulated_time, simulated_time_at_begin,                       &
     303                use_subsidence_tendencies, use_surface_fluxes, use_top_fluxes, &
     304                ws_scheme_mom, ws_scheme_sca
    302305       
    303306    USE cpulog,                                                                &
     
    432435!--       According to the Neumann bc for the horizontal velocity components,
    433436!--       the corresponding fluxes has to satisfiy the same bc.
    434           IF ( ocean )  THEN
     437          IF ( ocean_mode )  THEN
    435438             sums_us2_ws_l(nzt+1,:) = sums_us2_ws_l(nzt,:)
    436439             sums_vs2_ws_l(nzt+1,:) = sums_vs2_ws_l(nzt,:)
     
    459462             sums_l(:,17,i)                        = sums_wspts_ws_l(:,i)      &
    460463                                           * heatflux_output_conversion  ! w*pt*
    461              IF ( ocean          ) sums_l(:,66,i)  = sums_wssas_ws_l(:,i) ! w*sa*
     464             IF ( ocean_mode     ) sums_l(:,66,i)  = sums_wssas_ws_l(:,i) ! w*sa*
    462465             IF ( humidity       ) sums_l(:,49,i)  = sums_wsqs_ws_l(:,i)       &
    463466                                           * waterflux_output_conversion  ! w*q*
     
    490493!
    491494!--    Horizontally averaged profile of salinity
    492        IF ( ocean )  THEN
     495       IF ( ocean_mode )  THEN
    493496          !$OMP DO
    494497          DO  i = nxl, nxr
     
    563566             sums_l(:,2,0) = sums_l(:,2,0) + sums_l(:,2,i)
    564567             sums_l(:,4,0) = sums_l(:,4,0) + sums_l(:,4,i)
    565              IF ( ocean )  THEN
     568             IF ( ocean_mode )  THEN
    566569                sums_l(:,23,0) = sums_l(:,23,0) + sums_l(:,23,i)
    567570             ENDIF
     
    592595       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL,  &
    593596                           MPI_SUM, comm2d, ierr )
    594        IF ( ocean )  THEN
     597       IF ( ocean_mode )  THEN
    595598          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
    596599          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb,       &
     
    623626       sums(:,2) = sums_l(:,2,0)
    624627       sums(:,4) = sums_l(:,4,0)
    625        IF ( ocean )  sums(:,23) = sums_l(:,23,0)
     628       IF ( ocean_mode )  sums(:,23) = sums_l(:,23,0)
    626629       IF ( humidity ) THEN
    627630          sums(:,44) = sums_l(:,44,0)
     
    648651!
    649652!--    Salinity
    650        IF ( ocean )  THEN
     653       IF ( ocean_mode )  THEN
    651654          sums(:,23) = sums(:,23) / ngp_2dh_s_inner(:,sr)
    652655          hom(:,1,23,sr) = sums(:,23)             ! sa
     
    930933!
    931934!--             Salinity flux w"sa"
    932                 IF ( ocean )  THEN
     935                IF ( ocean_mode )  THEN
    933936                   sums_l(k,65,tn) = sums_l(k,65,tn)                           &
    934937                                         - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
     
    10001003                         sums_l(k+ki,61,tn) = sums_l(k+ki,61,tn) + &
    10011004                                    0.0_wp * rmask(j,i,sr)        ! v"pt"
    1002                          IF ( ocean )  THEN
     1005                         IF ( ocean_mode )  THEN
    10031006                            sums_l(k+ki,65,tn) = sums_l(k+ki,65,tn) + &
    10041007                                       surf_def_h(l)%sasws(m) * rmask(j,i,sr)  ! w"sa"
     
    10531056                   sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + &
    10541057                                    0.0_wp * rmask(j,i,sr)        ! v"pt"
    1055                    IF ( ocean )  THEN
     1058                   IF ( ocean_mode )  THEN
    10561059                      sums_l(nzb,65,tn) = sums_l(nzb,65,tn) + &
    10571060                                       surf_lsm_h%sasws(m) * rmask(j,i,sr)  ! w"sa"
     
    11041107                   sums_l(nzb,61,tn) = sums_l(nzb,61,tn) + &
    11051108                                    0.0_wp * rmask(j,i,sr)        ! v"pt"
    1106                    IF ( ocean )  THEN
     1109                   IF ( ocean_mode )  THEN
    11071110                      sums_l(nzb,65,tn) = sums_l(nzb,65,tn) + &
    11081111                                       surf_usm_h%sasws(m) * rmask(j,i,sr)  ! w"sa"
     
    12761279                                    0.0_wp * rmask(j,i,sr)        ! v"pt"
    12771280
    1278                 IF ( ocean )  THEN
     1281                IF ( ocean_mode )  THEN
    12791282                   sums_l(nzt,65,tn) = sums_l(nzt,65,tn) + &
    12801283                                       surf_def_h(2)%sasws(m) * rmask(j,i,sr)  ! w"sa"
     
    13361339!--             Salinity flux and density (density does not belong to here,
    13371340!--             but so far there is no other suitable place to calculate)
    1338                 IF ( ocean )  THEN
     1341                IF ( ocean_mode )  THEN
    13391342                   IF( .NOT. ws_scheme_sca .OR. sr /= 0 )  THEN
    13401343                      pts = 0.5_wp * ( sa(k,j,i)   - hom(k,1,23,sr) +          &
     
    15621565!
    15631566!--    Density at top follows Neumann condition
    1564        IF ( ocean )  THEN
     1567       IF ( ocean_mode )  THEN
    15651568          sums_l(nzt+1,64,tn) = sums_l(nzt,64,tn)
    15661569          sums_l(nzt+1,71,tn) = sums_l(nzt,71,tn)
     
    20322035          first = .TRUE.
    20332036
    2034           IF ( ocean )  THEN
     2037          IF ( ocean_mode )  THEN
    20352038             DO  k = nzt, nzb+1, -1
    20362039                IF ( first  .AND.  hom(k,1,18,sr) < -1.0E-8_wp )  THEN
     
    20802083          dptdz_threshold = 0.2_wp / 100.0_wp
    20812084
    2082           IF ( ocean )  THEN
     2085          IF ( ocean_mode )  THEN
    20832086             DO  k = nzt+1, nzb+5, -1
    20842087                IF ( dptdz(k) > dptdz_threshold  .AND.                         &
  • palm/trunk/SOURCE/header.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    425428    USE netcdf_interface,                                                      &
    426429        ONLY:  netcdf_data_format, netcdf_data_format_string, netcdf_deflate
     430
     431    USE ocean_mod,                                                             &
     432        ONLY:  ibc_sa_t, prho_reference, sa_surface, sa_vertical_gradient,     &
     433               sa_vertical_gradient_level, sa_vertical_gradient_level_ind
    427434
    428435    USE particle_attributes,                                                   &
     
    578585    ENDIF
    579586    IF ( nested_run )  run_classification = 'nested ' // run_classification(1:63)
    580     IF ( ocean )  THEN
     587    IF ( ocean_mode )  THEN
    581588       run_classification = 'ocean - ' // run_classification(1:61)
    582589    ELSE
     
    733740    IF ( use_upstream_for_tke )  WRITE ( io, 143 )
    734741    IF ( rayleigh_damping_factor /= 0.0_wp )  THEN
    735        IF ( .NOT. ocean )  THEN
     742       IF ( .NOT. ocean_mode )  THEN
    736743          WRITE ( io, 123 )  'above', rayleigh_damping_height, &
    737744               rayleigh_damping_factor
     
    815822!
    816823!-- Computational grid
    817     IF ( .NOT. ocean )  THEN
     824    IF ( .NOT. ocean_mode )  THEN
    818825       WRITE ( io, 250 )  dx, dy
    819826       
     
    11761183    ENDIF
    11771184
    1178     IF ( ocean )  THEN
     1185    IF ( ocean_mode )  THEN
    11791186       r_lower = 'sa(0)    = sa(1)'
    11801187       IF ( ibc_sa_t == 0 )  THEN
     
    12531260          WRITE ( io, 316 )
    12541261       ENDIF
    1255        IF ( ocean  .AND.  constant_top_salinityflux )                          &
     1262       IF ( ocean_mode  .AND.  constant_top_salinityflux )                          &
    12561263          WRITE ( io, 309 )  top_salinityflux
    12571264       IF ( humidity       )  WRITE ( io, 315 )
     
    14121419!-- Initial salinity profile
    14131420!-- Building output strings, starting with surface salinity
    1414     IF ( ocean )  THEN
     1421    IF ( ocean_mode )  THEN
    14151422       WRITE ( temperatures, '(F6.2)' )  sa_surface
    14161423       gradients = '------'
     
    18951902    WRITE ( io, 412 )  TRIM( reference_state )
    18961903    IF ( use_single_reference_value )  THEN
    1897        IF ( ocean )  THEN
     1904       IF ( ocean_mode )  THEN
    18981905          WRITE ( io, 413 )  prho_reference
    18991906       ELSE
  • palm/trunk/SOURCE/init_3d_model.f90

    r3289 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3289 2018-09-28 10:23:58Z suehring
    2730! Introduce module parameter for number of inflow profiles
    2831!
     
    549552    USE netcdf_data_input_mod,                                                 &
    550553        ONLY:  init_3d, netcdf_data_input_init_3d
     554
     555    USE ocean_mod,                                                             &
     556        ONLY:  ocean_init, ocean_init_arrays
    551557   
    552558    USE particle_attributes,                                                   &
     
    772778                 s_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                           &
    773779                 s_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    774 #endif
    775     ENDIF
    776 
    777     IF ( ocean )  THEN
    778 #if defined( __nopointer )
    779        ALLOCATE( prho(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                          &
    780                  rho_ocean(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                           &
    781                  sa(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                            &
    782                  sa_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                          &
    783                  tsa_m(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    784 #else
    785        ALLOCATE( prho_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                        &
    786                  rho_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                         &
    787                  sa_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                          &
    788                  sa_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                          &
    789                  sa_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    790        prho => prho_1
    791        rho_ocean  => rho_1  ! routines calc_mean_profile and diffusion_e require
    792                       ! density to be apointer
    793780#endif
    794781    ENDIF
     
    1010997       s => s_1;  s_p => s_2;  ts_m => s_3
    1011998    ENDIF   
    1012 
    1013     IF ( ocean )  THEN
    1014        sa => sa_1;  sa_p => sa_2;  tsa_m => sa_3
    1015     ENDIF
    1016999#endif
     1000
    10171001!
    10181002!-- Initialize arrays for turbulence closure
     
    10221006    CALL init_surface_arrays
    10231007!
    1024 !-- Allocate microphysics module arrays
    1025     IF ( bulk_cloud_model )  THEN
    1026        CALL bcm_init_arrays
    1027     ENDIF
    1028 !
    1029 !-- Allocate land surface model arrays
    1030     IF ( land_surface )  THEN
    1031        CALL lsm_init_arrays
    1032     ENDIF
    1033 
    1034 !
    1035 !-- Allocate wind turbine model arrays
    1036     IF ( wind_turbine )  THEN
    1037        CALL wtm_init_arrays
    1038     ENDIF
    1039 !
    1040 !-- Allocate gust module arrays
    1041     IF ( gust_module_enabled )  THEN
    1042        CALL gust_init_arrays
    1043     ENDIF
     1008!-- Allocate arrays for other modules
     1009    IF ( bulk_cloud_model    )  CALL bcm_init_arrays
     1010    IF ( gust_module_enabled )  CALL gust_init_arrays
     1011    IF ( land_surface        )  CALL lsm_init_arrays
     1012    IF ( ocean_mode          )  CALL ocean_init_arrays
     1013    IF ( wind_turbine        )  CALL wtm_init_arrays
     1014    IF ( uv_exposure         )  CALL uvem_init_arrays
    10441015
    10451016!
     
    10531024    IF ( uv_exposure )  THEN
    10541025       CALL uvem_init
    1055     ENDIF
    1056 !
    1057 !-- Allocate uv exposure arrays
    1058     IF ( uv_exposure )  THEN
    1059        CALL uvem_init_arrays
    10601026    ENDIF
    10611027
     
    12301196          ENDIF
    12311197
    1232           IF ( ocean )  THEN
    1233              DO  i = nxlg, nxrg
    1234                 DO  j = nysg, nyng
    1235                    sa(:,j,i) = sa_init
    1236                 ENDDO
    1237              ENDDO
    1238           ENDIF
    12391198!
    12401199!--       Set velocity components at non-atmospheric / oceanic grid points to
     
    13801339          ENDIF
    13811340
    1382           IF ( ocean )  THEN
    1383              DO  i = nxlg, nxrg
    1384                 DO  j = nysg, nyng
    1385                    sa(:,j,i) = sa_init
    1386                 ENDDO
    1387              ENDDO
    1388           ENDIF
    13891341!
    13901342!--       Compute initial temperature field and other constants used in case
     
    14491401       hom(:,1,7,:)  = SPREAD( pt(:,nys,nxl), 2, statistic_regions+1 )
    14501402
    1451 
    1452 !
    1453 !--    Store initial salinity profile
    1454        IF ( ocean )  THEN
    1455           hom(:,1,26,:)  = SPREAD( sa(:,nys,nxl), 2, statistic_regions+1 )
    1456        ENDIF
    1457 
    14581403       IF ( humidity )  THEN
    14591404!
     
    15571502       ENDIF       
    15581503
    1559        IF ( ocean )  THEN
    1560           tsa_m = 0.0_wp
    1561           sa_p  = sa
    1562        ENDIF
    1563        
    15641504       CALL location_message( 'finished', .TRUE. )
    15651505
     
    18101750       ENDIF
    18111751       IF ( passive_scalar )  s_p  = s
    1812        IF ( ocean          )  sa_p = sa
    1813 
    18141752!
    18151753!--    Allthough tendency arrays are set in prognostic_equations, they have
     
    18211759       ENDIF
    18221760       IF ( passive_scalar )  ts_m  = 0.0_wp
    1823        IF ( ocean          )  tsa_m = 0.0_wp
    18241761!
    18251762!--    Initialize synthetic turbulence generator in case of restart.
     
    22412178    IF ( dt_dvrp /= 9999999.9_wp )  CALL init_dvrp
    22422179
    2243     IF ( ocean )  THEN
    2244 !
    2245 !--    Initialize quantities needed for the ocean model
    2246        CALL init_ocean
    2247 
    2248     ENDIF
    2249 !
    2250 !--    Initialize quantities for handling cloud physics
    2251 !--    This routine must be called before lpm_init, because
    2252 !--    otherwise, array d_exner, needed in data_output_dvrp (called by
    2253 !--    lpm_init) is not defined.
    2254     IF ( .NOT. ocean )  THEN
     2180!
     2181!-- Initialize quantities needed for the ocean model
     2182    IF ( ocean_mode )  CALL ocean_init
     2183
     2184!
     2185!-- Initialize quantities for handling cloud physics.
     2186!-- This routine must be called before lpm_init, becaus otherwise,
     2187!-- array d_exner, needed in data_output_dvrp (called by lpm_init) is not defined.
     2188    IF ( .NOT. ocean_mode )  THEN
    22552189
    22562190       ALLOCATE( hyp(nzb:nzt+1) )
     
    24542388    rdf_sc = 0.0_wp
    24552389    IF ( rayleigh_damping_factor /= 0.0_wp )  THEN
    2456        IF (  .NOT.  ocean )  THEN
     2390
     2391       IF (  .NOT.  ocean_mode )  THEN
    24572392          DO  k = nzb+1, nzt
    24582393             IF ( zu(k) >= rayleigh_damping_height )  THEN
     
    24642399          ENDDO
    24652400       ELSE
     2401!
     2402!--       In ocean mode, rayleigh damping is applied in the lower part of the
     2403!--       model domain
    24662404          DO  k = nzt, nzb+1, -1
    24672405             IF ( zu(k) <= rayleigh_damping_height )  THEN
     
    24732411          ENDDO
    24742412       ENDIF
     2413
    24752414    ENDIF
    24762415    IF ( scalar_rayleigh_damping )  rdf_sc = rdf
  • palm/trunk/SOURCE/init_grid.f90

    r3241 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3241 2018-09-12 15:02:00Z raasch
    2730! unused variables removed
    2831!
     
    359362               dz_stretch_level_start, ibc_uv_b, message_string,               &
    360363               momentum_advec, number_stretch_level_end,                       &
    361                number_stretch_level_start,ocean, psolver, scalar_advec,        &
     364               number_stretch_level_start, ocean_mode, psolver, scalar_advec,  &
    362365               topography, use_surface_fluxes
    363366         
     
    509512!
    510513!-- Define the vertical grid levels
    511     IF ( .NOT. ocean )  THEN
     514    IF ( .NOT. ocean_mode )  THEN
    512515   
    513516!
     
    12931296
    12941297    USE control_parameters,                                                    &
    1295         ONLY:  bc_lr_cyc, bc_ns_cyc, message_string, ocean
     1298        ONLY:  bc_lr_cyc, bc_ns_cyc, message_string, ocean_mode
    12961299
    12971300    USE indices,                                                               &
     
    13861389!-- In order to map topography on PALM grid also in case of ocean simulations,
    13871390!-- pre-calculate an offset value.
    1388     ocean_offset = MERGE( zw(0), 0.0_wp, ocean )
     1391    ocean_offset = MERGE( zw(0), 0.0_wp, ocean_mode )
    13891392!
    13901393!-- Reference buildings on top of orography. This is not necessary
     
    16381641!-- Topography input via ASCII format.
    16391642    ELSE
    1640        ocean_offset     = MERGE( zw(0), 0.0_wp, ocean )
     1643       ocean_offset     = MERGE( zw(0), 0.0_wp, ocean_mode )
    16411644       topo_3d          = IBSET( topo_3d, 0 )
    16421645       topo_3d(nzb,:,:) = IBCLR( topo_3d(nzb,:,:), 0 )
  • palm/trunk/SOURCE/init_masks.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    145148               mask_x_loop, mask_xyz_dimension, mask_y, mask_y_loop, mask_z,   &
    146149               mask_z_loop, max_masks,  message_string, mid,                   &
    147                passive_scalar, ocean, varnamelength
     150               passive_scalar, ocean_mode, varnamelength
    148151
    149152
     
    412415
    413416             CASE ( 'rho_ocean' )
    414                 IF ( .NOT. ocean )  THEN
    415                    WRITE ( message_string, * ) 'output of "', TRIM( var ),     &
    416                         '" requires ocean = .TRUE.'
     417                IF ( .NOT. ocean_mode )  THEN
     418                   WRITE ( message_string, * ) 'output of "', TRIM( var ),     &
     419                        '" requires ocean mode'
    417420                   CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 )
    418421                ENDIF
     
    428431
    429432             CASE ( 'sa' )
    430                 IF ( .NOT. ocean )  THEN
    431                    WRITE ( message_string, * ) 'output of "', TRIM( var ),     &
    432                         '" requires ocean = .TRUE.'
     433                IF ( .NOT. ocean_mode )  THEN
     434                   WRITE ( message_string, * ) 'output of "', TRIM( var ),     &
     435                        '" requires ocean mode'
    433436                   CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 )
    434437                ENDIF
  • palm/trunk/SOURCE/large_scale_forcing_nudging_mod.f90

    r3241 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3241 2018-09-12 15:02:00Z raasch
    2730! unused variables removed
    2831!
     
    9295               large_scale_forcing, large_scale_subsidence, lsf_surf, lsf_vert,&
    9396               lsf_exception, message_string, nesting_offline, neutral,        &
    94                nudging, passive_scalar, pt_surface, ocean, q_surface,          &
     97               nudging, passive_scalar, pt_surface, ocean_mode, q_surface,     &
    9598               surface_heatflux, surface_pressure, surface_waterflux,          &
    9699               topography, use_subsidence_tendencies
     
    696699       ENDIF
    697700
    698        IF ( large_scale_forcing  .AND.  ocean )  THEN
     701       IF ( large_scale_forcing  .AND.  ocean_mode )  THEN
    699702          message_string = 'The usage of large scale forcing from external &'//&
    700                         'file LSF_DATA is not implemented for ocean runs'
     703                        'file LSF_DATA is not implemented for ocean mode'
    701704          CALL message( 'check_parameters', 'PA0378', 1, 2, 0, 6, 0 )
    702705       ENDIF
  • palm/trunk/SOURCE/lpm_init.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    231234    USE control_parameters,                                                    &
    232235        ONLY:  cloud_droplets, constant_flux_layer, current_timestep_number,   &
    233                dt_3d, dz, initializing_actions, message_string, ocean,         &
     236               dt_3d, dz, initializing_actions, message_string, ocean_mode,    &
    234237               simulated_time
    235238
     
    328331!-- In case of oceans runs, the vertical index calculations need an offset,
    329332!-- because otherwise the k indices will become negative
    330     IF ( ocean )  THEN
     333    IF ( ocean_mode )  THEN
    331334       offset_ocean_nzt    = nzt
    332335       offset_ocean_nzt_m1 = nzt - 1
  • palm/trunk/SOURCE/modules.f90

    r3289 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3289 2018-09-28 10:23:58Z suehring
    2730! +num_mean_inflow_profiles
    2831!
     
    11091112    CHARACTER (LEN=20)   ::  bc_s_b = 'dirichlet'                         !< namelist parameter
    11101113    CHARACTER (LEN=20)   ::  bc_s_t = 'initial_gradient'                  !< namelist parameter
    1111     CHARACTER (LEN=20)   ::  bc_sa_t = 'neumann'                          !< namelist parameter
    11121114    CHARACTER (LEN=20)   ::  bc_uv_b = 'dirichlet'                        !< namelist parameter
    11131115    CHARACTER (LEN=20)   ::  bc_uv_t = 'dirichlet'                        !< namelist parameter
     
    11801182    INTEGER(iwp) ::  ibc_s_b                           !< integer flag for bc_s_b
    11811183    INTEGER(iwp) ::  ibc_s_t                           !< integer flag for bc_s_t
    1182     INTEGER(iwp) ::  ibc_sa_t                          !< integer flag for bc_sa_t
    11831184    INTEGER(iwp) ::  ibc_uv_b                          !< integer flag for bc_uv_b
    11841185    INTEGER(iwp) ::  ibc_uv_t                          !< integer flag for bc_uv_t
     
    12421243    INTEGER(iwp) ::  q_vertical_gradient_level_ind(10) = -9999   !< grid index values of q_vertical_gradient_level(s)
    12431244    INTEGER(iwp) ::  s_vertical_gradient_level_ind(10) = -9999   !< grid index values of s_vertical_gradient_level(s)   
    1244     INTEGER(iwp) ::  sa_vertical_gradient_level_ind(10) = -9999  !< grid index values of sa_vertical_gradient_level(s)
    12451245    INTEGER(iwp) ::  section(100,3)                              !< collective array for section_xy/xz/yz
    12461246    INTEGER(iwp) ::  section_xy(100) = -9999                     !< namelist parameter
     
    12931293    LOGICAL ::  constant_top_heatflux = .TRUE.                   !< heat flux at domain top constant?
    12941294    LOGICAL ::  constant_top_momentumflux = .FALSE.              !< momentum flux at domain topconstant?
    1295     LOGICAL ::  constant_top_salinityflux = .TRUE.               !< salinity flux at ocean domain top?
     1295    LOGICAL ::  constant_top_salinityflux = .TRUE.               !< constant salinity flux at ocean surface
    12961296    LOGICAL ::  constant_top_scalarflux = .TRUE.                 !< passive-scalar flux at domain top constant?
    12971297    LOGICAL ::  constant_scalarflux = .TRUE.                     !< passive-scalar flux at surfaces constant?
     
    13281328    LOGICAL ::  neutral = .FALSE.                                !< namelist parameter
    13291329    LOGICAL ::  nudging = .FALSE.                                !< namelist parameter
    1330     LOGICAL ::  ocean = .FALSE.                                  !< namelist parameter
     1330    LOGICAL ::  ocean_mode = .FALSE.                             !< namelist parameter
    13311331    LOGICAL ::  passive_scalar = .FALSE.                         !< namelist parameter
    13321332    LOGICAL ::  plant_canopy = .FALSE.                           !< switch for use of plant canopy model
     
    13801380                                                               !< (galilei transformation)
    13811381    REAL(wp) ::  alpha_surface = 0.0_wp                        !< namelist parameter
    1382     REAL(wp) ::  atmos_ocean_sign = 1.0_wp                     !< vertical-grid conversion factor 
     1382    REAL(wp) ::  atmos_ocean_sign = 1.0_wp                     !< vertical-grid conversion factor
    13831383                                                               !< (=1.0 in atmosphere, =-1.0 in ocean)
    13841384    REAL(wp) ::  averaging_interval = 0.0_wp                   !< namelist parameter
     
    14541454    REAL(wp) ::  particle_maximum_age = 9999999.9_wp           !< namelist parameter
    14551455    REAL(wp) ::  prandtl_number = 1.0_wp                       !< namelist parameter
    1456     REAL(wp) ::  prho_reference                                !< reference state of potential density
    14571456    REAL(wp) ::  pt_damping_factor = 0.0_wp                    !< namelist parameter
    14581457    REAL(wp) ::  pt_damping_width = 0.0_wp                     !< namelist parameter
     
    14721471    REAL(wp) ::  rho_surface                                   !< surface value of density
    14731472    REAL(wp) ::  roughness_length = 0.1_wp                     !< namelist parameter
    1474     REAL(wp) ::  sa_surface = 35.0_wp                          !< namelist parameter
    14751473    REAL(wp) ::  simulated_time = 0.0_wp                       !< elapsed simulated time
    14761474    REAL(wp) ::  simulated_time_at_begin                       !< elapsed simulated time of previous run (job chain)
     
    15501548    REAL(wp) ::  s_vertical_gradient(10) = 0.0_wp                  !< namelist parameter
    15511549    REAL(wp) ::  s_vertical_gradient_level(10) = -999999.9_wp    !< namelist parameter
    1552     REAL(wp) ::  sa_vertical_gradient(10) = 0.0_wp                 !< namelist parameter
    1553     REAL(wp) ::  sa_vertical_gradient_level(10) = -999999.9_wp   !< namelist parameter
    15541550    REAL(wp) ::  skip_time_domask(max_masks) = 9999999.9_wp        !< namelist parameter
    15551551    REAL(wp) ::  threshold(20) = 0.0_wp                            !< namelist parameter
  • palm/trunk/SOURCE/netcdf_interface_mod.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    568571               do3d_time_count, domask_time_count, end_time, land_surface,     &
    569572               mask_size_l, mask_i, mask_i_global, mask_j, mask_j_global,      &
    570                mask_k_global, message_string, mid, ntdim_2d_xy,                &
    571                ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, plant_canopy,      &
     573               mask_k_global, message_string, mid, ntdim_2d_xy, ntdim_2d_xz,   &
     574               ntdim_2d_yz, ntdim_3d, nz_do3d, ocean_mode, plant_canopy,       &
    572575               run_description_header, section, simulated_time,                &
    573576               simulated_time_at_begin, skip_time_data_output_av,              &
     
    589592    USE land_surface_model_mod,                                                &
    590593        ONLY: lsm_define_netcdf_grid, nzb_soil, nzt_soil, nzs, zs
     594
     595    USE ocean_mod,                                                             &
     596        ONLY:  ocean_define_netcdf_grid
    591597
    592598    USE pegrid
     
    943949                CASE ( 'e', 'lpt', 'nc', 'nr', 'p', 'pc', 'pr', 'prr', 'pt',   &
    944950                       'q', 'qc', 'ql', 'ql_c', 'ql_v', 'ql_vp', 'qr', 'qv',   &
    945                        'rho_ocean', 's', 'sa', 'vpt'  )
     951                       's', 'vpt'  )
    946952
    947953                   grid_x = 'x'
     
    971977
    972978!             
    973 !--       Block of urban surface model outputs   
     979!--             Block of urban surface model outputs
    974980                CASE ( 'usm_output' )
    975981
    976                    CALL usm_define_netcdf_grid( domask(mid,av,i), found, &
     982                   CALL usm_define_netcdf_grid( domask( mid,av,i), found,      &
    977983                                                        grid_x, grid_y, grid_z )
    978984
    979985                CASE DEFAULT
    980 
    981                    CALL tcm_define_netcdf_grid( domask(mid,av,i), found, &
    982                                                         grid_x, grid_y, grid_z )
    983 
    984 !
    985 !--                Check for land surface quantities
     986!
     987!--                Check for quantities defined in other modules
     988                   IF ( .NOT. found  .AND.  air_chemistry )  THEN
     989                      CALL chem_define_netcdf_grid( domask(mid,av,i), found,   &
     990                                                    grid_x, grid_y, grid_z )
     991                   ENDIF
     992
     993                   IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
     994                      CALL gust_define_netcdf_grid( domask(mid,av,i), found,   &
     995                                                    grid_x, grid_y, grid_z )
     996                   ENDIF
     997
    986998                   IF ( land_surface )  THEN
    987999                      CALL lsm_define_netcdf_grid( domask(mid,av,i), found,    &
    9881000                                                   grid_x, grid_y, grid_z )
    9891001                   ENDIF
    990 !
    991 !--                Check for plant canopy quantities
     1002
     1003                   IF ( .NOT. found  .AND.  ocean_mode )  THEN
     1004                      CALL ocean_define_netcdf_grid( domask(mid,av,i), found,  &
     1005                                                     grid_x, grid_y, grid_z )
     1006                   ENDIF
     1007
    9921008                   IF ( .NOT. found  .AND.  plant_canopy )  THEN
    9931009                      CALL pcm_define_netcdf_grid( domask(mid,av,i), found,    &
     
    9951011                   ENDIF
    9961012
    997 !
    998 !--                Check for radiation quantities
    9991013                   IF ( .NOT. found  .AND.  radiation )  THEN
    10001014                      CALL radiation_define_netcdf_grid( domask(mid,av,i),     &
     
    10031017                   ENDIF
    10041018
    1005 !
    1006 !--                Check for gust module quantities
    1007                    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
    1008                       CALL gust_define_netcdf_grid( domask(mid,av,i), found,   &
    1009                                                     grid_x, grid_y, grid_z )
    1010                    ENDIF
    1011 
    1012 !
    1013 !--                Check for chemistry quantities                   
    1014                    IF ( .NOT. found  .AND.  air_chemistry )  THEN
    1015                       CALL chem_define_netcdf_grid( domask(mid,av,i),          &
    1016                                                     found, grid_x, grid_y,     &
    1017                                                     grid_z )
    1018                    ENDIF
    1019 
    1020 !
    1021 !--                Check for user-defined quantities
     1019                   CALL tcm_define_netcdf_grid( domask( mid,av,i), found,      &
     1020                                                        grid_x, grid_y, grid_z )
     1021
     1022!
     1023!--                Now check for user-defined quantities
    10221024                   IF ( .NOT. found )  THEN
    10231025                      CALL user_define_netcdf_grid( domask(mid,av,i), found,   &
     
    48064808!
    48074809!--       Define y-axis
    4808           CALL netcdf_create_dim(id_set_sp, 'k_y', ny/2, id_dim_y_sp, 282 )
     4810          CALL netcdf_create_dim( id_set_sp, 'k_y', ny/2, id_dim_y_sp, 282 )
    48094811          CALL netcdf_create_var( id_set_sp, (/ id_dim_y_sp /), 'k_y',         &
    48104812                                  NF90_DOUBLE, id_var_y_sp, 'm-1', '', 283,    &
  • palm/trunk/SOURCE/parin.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    471474        ONLY:  netcdf_data_format, netcdf_deflate, netcdf_precision
    472475
     476    USE ocean_mod,                                                             &
     477        ONLY:  ocean_parin
     478
    473479    USE pegrid
    474480               
     
    527533    NAMELIST /inipar/  alpha_surface, approximation, bc_e_b,     &
    528534                       bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b, &
    529              bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t,                 &
    530              bottom_salinityflux, building_height, building_length_x,          &
     535             bc_q_t,bc_s_b, bc_s_t, bc_uv_b, bc_uv_t,                 &
     536             building_height, building_length_x,          &
    531537             building_length_y, building_wall_left, building_wall_south,       &
    532538             calc_soil_moisture_during_spinup,                                 &
     
    559565             most_method, nesting_offline,                  &
    560566             netcdf_precision, neutral, ngsrb,                                 &
    561              nsor, nsor_ini, nudging, nx, ny, nz, ocean, omega, omega_sor,     &
    562              outflow_source_plane, passive_scalar,                             &
     567             nsor, nsor_ini, nudging, nx, ny, nz, ocean_mode, omega,           &
     568             omega_sor, outflow_source_plane, passive_scalar,                  &
    563569             prandtl_number, psolver, pt_damping_factor,        &
    564570             pt_damping_width, pt_reference, pt_surface,                       &
     
    571577             recycling_width, recycling_yshift,                                &
    572578             reference_state, residual_limit,                                  &
    573              roughness_length, sa_surface,                                     &
    574              sa_vertical_gradient, sa_vertical_gradient_level, scalar_advec,   &
     579             roughness_length,                                                 &
     580             scalar_advec,   &
    575581             scalar_rayleigh_damping,                              &
    576582             spinup_time, spinup_pt_amplitude, spinup_pt_mean,                 &
     
    581587             s_vertical_gradient_level, time_utc_init, timestep_scheme,        &
    582588             topography, topography_grid_convention, top_heatflux,             &
    583              top_momentumflux_u, top_momentumflux_v, top_salinityflux,         &
     589             top_momentumflux_u, top_momentumflux_v,                           &
    584590             top_scalarflux, transpose_compute_overlap,                        &
    585591             tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,     &
     
    593599             vg_vertical_gradient_level, v_bulk, v_profile,&
    594600             wall_adjustment, wall_heatflux, wall_humidityflux,                &
    595              wall_salinityflux, wall_scalarflux, y_shift, zeta_max, zeta_min,  &
     601             wall_scalarflux, y_shift, zeta_max, zeta_min,  &
    596602             z0h_factor
    597603
    598     NAMELIST /initialization_parameters/  alpha_surface,         &
     604    NAMELIST /initialization_parameters/  alpha_surface,                       &
    599605             approximation, bc_e_b,                                            &
    600606             bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t, bc_q_b,           &
    601              bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t,                 &
    602              bottom_salinityflux, building_height, building_length_x,          &
     607             bc_q_t,bc_s_b, bc_s_t, bc_uv_b, bc_uv_t,                          &
     608             building_height, building_length_x,                               &
    603609             building_length_y, building_wall_left, building_wall_south,       &
    604610             calc_soil_moisture_during_spinup,                                 &
    605              call_psolver_at_all_substeps,  &
     611             call_psolver_at_all_substeps,                                     &
    606612             canyon_height,                                                    &
    607613             canyon_width_x, canyon_width_y, canyon_wall_left,                 &
    608              canyon_wall_south, cfl_factor, cloud_droplets,   &
    609              cloud_top_radiation,                 &
    610              collective_wait, complex_terrain,           &
     614             canyon_wall_south, cfl_factor, cloud_droplets,                    &
     615             cloud_top_radiation,                                              &
     616             collective_wait, complex_terrain,                                 &
    611617             conserve_volume_flow,                                             &
    612618             conserve_volume_flow_mode, constant_flux_layer,                   &
    613              coupling_start_time,             &
     619             coupling_start_time,                                              &
    614620             cycle_mg, damp_level_1d,                                          &
    615621             data_output_during_spinup,                                        &
    616622             day_of_year_init,                                                 &
    617623             dissipation_1d,                                                   &
    618              dp_external, dp_level_b, dp_smooth, dpdxy,    &
     624             dp_external, dp_level_b, dp_smooth, dpdxy,                        &
    619625             dt, dt_pr_1d, dt_run_control_1d, dt_spinup, dx, dy, dz, dz_max,   &
    620626             dz_stretch_factor, dz_stretch_level, dz_stretch_level_start,      &
     
    626632             initializing_actions, km_constant,                                &
    627633             large_scale_forcing, large_scale_subsidence, latitude,            &
    628              longitude,                                 &
     634             longitude,                                                        &
    629635             loop_optimization, lsf_exception, masking_method, mg_cycles,      &
    630636             mg_switch_to_pe0_level, mixing_length_1d, momentum_advec,         &
    631              most_method, nesting_offline,                  &
     637             most_method, nesting_offline,                                     &
    632638             netcdf_precision, neutral, ngsrb,                                 &
    633              nsor, nsor_ini, nudging, nx, ny, nz, ocean, omega, omega_sor,     &
    634              outflow_source_plane, passive_scalar,                             &
    635              prandtl_number, psolver, pt_damping_factor,        &
     639             nsor, nsor_ini, nudging, nx, ny, nz, ocean_mode, omega,           &
     640             omega_sor, outflow_source_plane, passive_scalar,                  &
     641             prandtl_number, psolver, pt_damping_factor,                       &
    636642             pt_damping_width, pt_reference, pt_surface,                       &
    637643             pt_surface_initial_change, pt_vertical_gradient,                  &
     
    643649             recycling_width, recycling_yshift,                                &
    644650             reference_state, residual_limit,                                  &
    645              roughness_length, sa_surface,                                     &
    646              sa_vertical_gradient, sa_vertical_gradient_level, scalar_advec,   &
    647              scalar_rayleigh_damping,                              &
     651             roughness_length, scalar_advec,                                   &
     652             scalar_rayleigh_damping,                                          &
    648653             spinup_time, spinup_pt_amplitude, spinup_pt_mean,                 &
    649654             statistic_regions, subs_vertical_gradient,                        &
     
    653658             s_vertical_gradient_level, time_utc_init, timestep_scheme,        &
    654659             topography, topography_grid_convention, top_heatflux,             &
    655              top_momentumflux_u, top_momentumflux_v, top_salinityflux,         &
     660             top_momentumflux_u, top_momentumflux_v,                           &
    656661             top_scalarflux, transpose_compute_overlap,                        &
    657662             tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y,     &
     
    663668             use_free_convection_scaling,                                      &
    664669             uv_heights, u_bulk, u_profile, vg_surface, vg_vertical_gradient,  &
    665              vg_vertical_gradient_level, v_bulk, v_profile,&
     670             vg_vertical_gradient_level, v_bulk, v_profile,                    &
    666671             wall_adjustment, wall_heatflux, wall_humidityflux,                &
    667              wall_salinityflux, wall_scalarflux, y_shift, zeta_max, zeta_min,  &
    668              z0h_factor
     672             wall_scalarflux, y_shift, zeta_max, zeta_min, z0h_factor
    669673             
    670674    NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
     
    858862
    859863!
    860 !--       Check if land surface model is used and read &lsm_par if required
     864!--       Check for module namelists and read them
    861865          CALL lsm_parin
    862 
    863 !
    864 !--       Check if gust module is used and read &gust_par if required
    865866          CALL bcm_parin
    866 
    867 !
    868 !--       Check if urban surface model is used and read &urban_surface_par if required
    869867          CALL usm_parin
    870 
    871 !
    872 !--       Check if spectra shall be calculated and read spectra_par if required
    873868          CALL spectra_parin
    874 
    875 !
    876 !--       Check if radiation model is used and read &radiation_par if required
    877869          CALL radiation_parin
    878 
    879 !
    880 !--       Check if gust module is used and read &gust_par if required
    881870          CALL gust_parin
    882 
    883 !
    884 !--       Check if multi agent system is used and read &agents_par if required
    885871          CALL mas_parin
    886 
    887 !
    888 !--       Check if plant canopy model is used and read &canopy_par if required
     872          CALL ocean_parin
    889873          CALL pcm_parin
    890 
    891 !
    892 !--       Read control parameters for optionally used model software packages
    893874          CALL package_parin
    894 
    895 !
    896 !--       Check if wind turbine model is used and read &wind_turbine_par if
    897 !--       required
    898875          CALL wtm_parin
    899 !
    900 !--       Check if virtual flights should be carried out and read &flight_par
    901 !--       if required
    902876          CALL flight_parin
    903 !
    904 !--       Check if synthetic turbulence generator is used and read stg_par if
    905 !--       required
    906877          CALL stg_parin
    907 !
    908 !--       Read chemistry variables
    909878          CALL chem_parin
    910 !
    911 !--       Check if uv exposure model is used and read &uvexposure_par
    912879          CALL uvem_parin
    913880!
  • palm/trunk/SOURCE/plant_canopy_model_mod.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    685688
    686689       USE control_parameters,                                                 &
    687            ONLY: humidity, message_string, ocean, urban_surface
     690           ONLY: humidity, message_string, ocean_mode, urban_surface
    688691
    689692       USE netcdf_data_input_mod,                                              &
     
    732735          gradient = 0.0_wp
    733736
    734           IF (  .NOT.  ocean )  THEN
     737          IF (  .NOT.  ocean_mode )  THEN
    735738
    736739             lad(0) = lad_surface
  • palm/trunk/SOURCE/prognostic_equations.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    277280
    278281
     282    USE advec_s_bc_mod,                                                        &
     283        ONLY:  advec_s_bc
     284
     285    USE advec_s_pw_mod,                                                        &
     286        ONLY:  advec_s_pw
     287
     288    USE advec_s_up_mod,                                                        &
     289        ONLY:  advec_s_up
     290
     291    USE advec_u_pw_mod,                                                        &
     292        ONLY:  advec_u_pw
     293
     294    USE advec_u_up_mod,                                                        &
     295        ONLY:  advec_u_up
     296
     297    USE advec_v_pw_mod,                                                        &
     298        ONLY:  advec_v_pw
     299
     300    USE advec_v_up_mod,                                                        &
     301        ONLY:  advec_v_up
     302
     303    USE advec_w_pw_mod,                                                        &
     304        ONLY:  advec_w_pw
     305
     306    USE advec_w_up_mod,                                                        &
     307        ONLY:  advec_w_up
     308
     309    USE advec_ws,                                                              &
     310        ONLY:  advec_s_ws, advec_u_ws, advec_v_ws, advec_w_ws
    279311
    280312    USE arrays_3d,                                                             &
     
    287319               flux_l_sa, nc, nc_p, nr, nr_p, pt, ptdf_x, ptdf_y, pt_init,     &
    288320               pt_p, prho, q, q_init, q_p, qc, qc_p, qr, qr_p, rdf, rdf_sc,    &
    289                ref_state, rho_ocean, s,  s_init, s_p, sa, sa_init, sa_p, tend, &
    290                te_m, tnc_m,  tnr_m, tpt_m, tq_m, tqc_m, tqr_m, ts_m, tsa_m,    &
    291                tu_m, tv_m, tw_m, u, ug, u_init, u_p, v, vg, vpt, v_init, v_p,  &
    292                w, w_p
     321               ref_state, rho_ocean, s, s_init, s_p, tend, te_m, tnc_m,        &
     322               tnr_m, tpt_m, tq_m, tqc_m, tqr_m, ts_m, tu_m, tv_m, tw_m, u,    &
     323               ug, u_init, u_p, v, vg, vpt, v_init, v_p, w, w_p
    293324
    294325    USE bulk_cloud_model_mod,                                                  &
     
    297328               microphysics_morrison, microphysics_seifert
    298329
     330    USE buoyancy_mod,                                                          &
     331        ONLY:  buoyancy
     332
     333    USE calc_radiation_mod,                                                    &
     334        ONLY:  calc_radiation
     335
    299336    USE chemistry_model_mod,                                                   &
    300337        ONLY:  chem_integrate, chem_prognostic_equations,                      &
    301338               chem_species, nspec, nvar, spc_names
    302339           
     340    USE chem_modules,                                                          &
     341        ONLY:  call_chem_at_all_substeps, chem_gasphase_on
     342
    303343    USE chem_photolysis_mod,                                                   &
    304344        ONLY:  photolysis_control
    305 
    306     USE chem_modules,                                                          &
    307         ONLY:  call_chem_at_all_substeps, chem_gasphase_on
    308345
    309346    USE control_parameters,                                                    &
     
    315352               large_scale_subsidence,                  &
    316353               neutral, nudging, &
    317                ocean, passive_scalar, plant_canopy,                            &
    318                prho_reference, prho_reference,                                 &
    319                prho_reference, pt_reference, pt_reference, pt_reference,       &
     354               ocean_mode, passive_scalar, plant_canopy, pt_reference,         &
    320355               scalar_advec, scalar_advec, simulated_time, sloping_surface,    &
    321356               timestep_scheme, tsc, use_subsidence_tendencies,                &
     
    323358               ws_scheme_sca, urban_surface, land_surface
    324359
     360    USE coriolis_mod,                                                          &
     361        ONLY:  coriolis
     362
    325363    USE cpulog,                                                                &
    326364        ONLY:  cpu_log, log_point, log_point_s
    327365
    328 
    329     USE eqn_state_seawater_mod,                                                &
    330         ONLY:  eqn_state_seawater
     366    USE diffusion_s_mod,                                                       &
     367        ONLY:  diffusion_s
     368
     369    USE diffusion_u_mod,                                                       &
     370        ONLY:  diffusion_u
     371
     372    USE diffusion_v_mod,                                                       &
     373        ONLY:  diffusion_v
     374
     375    USE diffusion_w_mod,                                                       &
     376        ONLY:  diffusion_w
    331377
    332378    USE indices,                                                               &
     
    334380               nzb, nzt, wall_flags_0
    335381
    336     USE advec_ws,                                                              &
    337         ONLY:  advec_s_ws, advec_u_ws, advec_v_ws, advec_w_ws
    338 
    339     USE advec_s_bc_mod,                                                        &
    340         ONLY:  advec_s_bc
    341 
    342     USE advec_s_pw_mod,                                                        &
    343         ONLY:  advec_s_pw
    344 
    345     USE advec_s_up_mod,                                                        &
    346         ONLY:  advec_s_up
    347 
    348     USE advec_u_pw_mod,                                                        &
    349         ONLY:  advec_u_pw
    350 
    351     USE advec_u_up_mod,                                                        &
    352         ONLY:  advec_u_up
    353 
    354     USE advec_v_pw_mod,                                                        &
    355         ONLY:  advec_v_pw
    356 
    357     USE advec_v_up_mod,                                                        &
    358         ONLY:  advec_v_up
    359 
    360     USE advec_w_pw_mod,                                                        &
    361         ONLY:  advec_w_pw
    362 
    363     USE advec_w_up_mod,                                                        &
    364         ONLY:  advec_w_up
    365 
    366     USE buoyancy_mod,                                                          &
    367         ONLY:  buoyancy
    368 
    369     USE calc_radiation_mod,                                                    &
    370         ONLY:  calc_radiation
    371 
    372     USE coriolis_mod,                                                          &
    373         ONLY:  coriolis
    374 
    375     USE diffusion_s_mod,                                                       &
    376         ONLY:  diffusion_s
    377 
    378     USE diffusion_u_mod,                                                       &
    379         ONLY:  diffusion_u
    380 
    381     USE diffusion_v_mod,                                                       &
    382         ONLY:  diffusion_v
    383 
    384     USE diffusion_w_mod,                                                       &
    385         ONLY:  diffusion_w
    386 
    387382    USE kinds
    388383
    389384    USE lsf_nudging_mod,                                                       &
    390385        ONLY:  ls_advec, nudge
     386
     387    USE ocean_mod,                                                             &
     388        ONLY:  eqn_state_seawater, ocean_prognostic_equations
    391389
    392390    USE plant_canopy_model_mod,                                                &
     
    403401        ONLY:  subsidence
    404402
     403    USE surface_mod,                                                           &
     404        ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
     405                surf_usm_v
     406
    405407    USE turbulence_closure_mod,                                                &
    406408        ONLY:  tcm_prognostic
     
    408410    USE user_actions_mod,                                                      &
    409411        ONLY:  user_actions
    410 
    411     USE surface_mod,                                                           &
    412         ONLY :  surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
    413                 surf_usm_v
    414412
    415413    USE wind_turbine_model_mod,                                                &
     
    699697
    700698          IF ( .NOT. neutral )  THEN
    701              IF ( ocean )  THEN
     699             IF ( ocean_mode )  THEN
    702700                CALL buoyancy( i, j, rho_ocean, 3 )
    703701             ELSE
     
    844842                ENDIF
    845843             ENDIF
    846 
    847           ENDIF
    848 
    849 !
    850 !--       If required, compute prognostic equation for salinity
    851           IF ( ocean )  THEN
    852 
    853 !
    854 !--          Tendency-terms for salinity
    855              tend(:,j,i) = 0.0_wp
    856              IF ( timestep_scheme(1:5) == 'runge' ) &
    857              THEN
    858                 IF ( ws_scheme_sca )  THEN
    859                     CALL advec_s_ws( i, j, sa, 'sa', flux_s_sa,  &
    860                                 diss_s_sa, flux_l_sa, diss_l_sa, i_omp_start, tn  )
    861                 ELSE
    862                     CALL advec_s_pw( i, j, sa )
    863                 ENDIF
    864              ELSE
    865                 CALL advec_s_up( i, j, sa )
    866              ENDIF
    867              CALL diffusion_s( i, j, sa,                                       &
    868                                surf_def_h(0)%sasws, surf_def_h(1)%sasws,       &
    869                                surf_def_h(2)%sasws,                            &
    870                                surf_lsm_h%sasws,    surf_usm_h%sasws,          &
    871                                surf_def_v(0)%sasws, surf_def_v(1)%sasws,       &
    872                                surf_def_v(2)%sasws, surf_def_v(3)%sasws,       &
    873                                surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws,       &
    874                                surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws,       &
    875                                surf_usm_v(0)%sasws, surf_usm_v(1)%sasws,       &
    876                                surf_usm_v(2)%sasws, surf_usm_v(3)%sasws )
    877 
    878              CALL user_actions( i, j, 'sa-tendency' )
    879 
    880 !
    881 !--          Prognostic equation for salinity
    882              DO  k = nzb+1, nzt
    883                 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d *                            &
    884                                                   ( tsc(2) * tend(k,j,i) +     &
    885                                                     tsc(3) * tsa_m(k,j,i) )    &
    886                                                   - tsc(5) * rdf_sc(k)         &
    887                                                    * ( sa(k,j,i) - sa_init(k) )&
    888                                           ) * MERGE( 1.0_wp, 0.0_wp,           &
    889                                                 BTEST( wall_flags_0(k,j,i), 0 )&
    890                                                    )
    891                 IF ( sa_p(k,j,i) < 0.0_wp )  sa_p(k,j,i) = 0.1_wp * sa(k,j,i)
    892              ENDDO
    893 
    894 !
    895 !--          Calculate tendencies for the next Runge-Kutta step
    896              IF ( timestep_scheme(1:5) == 'runge' )  THEN
    897                 IF ( intermediate_timestep_count == 1 )  THEN
    898                    DO  k = nzb+1, nzt
    899                       tsa_m(k,j,i) = tend(k,j,i)
    900                    ENDDO
    901                 ELSEIF ( intermediate_timestep_count < &
    902                          intermediate_timestep_count_max )  THEN
    903                    DO  k = nzb+1, nzt
    904                       tsa_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +              &
    905                                         5.3125_wp * tsa_m(k,j,i)
    906                    ENDDO 
    907                 ENDIF
    908              ENDIF
    909 
    910 !
    911 !--          Calculate density by the equation of state for seawater
    912              CALL eqn_state_seawater( i, j )
    913844
    914845          ENDIF
     
    13241255
    13251256!
    1326 !--       If required, compute prognostic equation for chemical quantites
     1257!--       Calculate prognostic equation for chemical quantites
    13271258          IF ( air_chemistry )  THEN
     1259             !> TODO: remove time measurement since it slows down performance because it will be called extremely often
    13281260             CALL cpu_log( log_point(83), '(chem advec+diff+prog)', 'start' )
    13291261!
    13301262!--          Loop over chemical species
    13311263             DO  lsp = 1, nvar                         
    1332                 CALL chem_prognostic_equations ( chem_species(lsp)%conc_p,     &
     1264                CALL chem_prognostic_equations( chem_species(lsp)%conc_p,      &
    13331265                                     chem_species(lsp)%conc,                   &
    13341266                                     chem_species(lsp)%tconc_m,                &
     
    13421274
    13431275             CALL cpu_log( log_point(83), '(chem advec+diff+prog)', 'stop' )             
    1344           ENDIF   ! Chemicals equations                     
    1345 
    1346        ENDDO
    1347     ENDDO
     1276          ENDIF   ! Chemical equations
     1277!
     1278!--       Calculate prognostic equations for the ocean
     1279          IF ( ocean_mode )  THEN
     1280             CALL ocean_prognostic_equations( i, j, i_omp_start, tn )
     1281          ENDIF
     1282
     1283       ENDDO  ! loop over j
     1284    ENDDO  ! loop over i
    13481285    !$OMP END PARALLEL
    13491286
     
    15761513
    15771514    IF ( .NOT. neutral )  THEN
    1578        IF ( ocean )  THEN
     1515       IF ( ocean_mode )  THEN
    15791516          CALL buoyancy( rho_ocean, 3 )
    15801517       ELSE
     
    17701707
    17711708!
    1772 !-- If required, compute prognostic equation for salinity
    1773     IF ( ocean )  THEN
    1774 
    1775        CALL cpu_log( log_point(37), 'sa-equation', 'start' )
    1776 
    1777 !
    1778 !--    sa-tendency terms with communication
    1779        sbt = tsc(2)
    1780        IF ( scalar_advec == 'bc-scheme' )  THEN
    1781 
    1782           IF ( timestep_scheme(1:5) /= 'runge' )  THEN
    1783 !
    1784 !--          Bott-Chlond scheme always uses Euler time step. Thus:
    1785              sbt = 1.0_wp
    1786           ENDIF
    1787           tend = 0.0_wp
    1788           CALL advec_s_bc( sa, 'sa' )
    1789 
    1790        ENDIF
    1791 
    1792 !
    1793 !--    sa-tendency terms with no communication
    1794        IF ( scalar_advec /= 'bc-scheme' )  THEN
    1795           tend = 0.0_wp
    1796           IF ( timestep_scheme(1:5) == 'runge' )  THEN
    1797              IF ( ws_scheme_sca )  THEN
    1798                  CALL advec_s_ws( sa, 'sa' )
    1799              ELSE
    1800                  CALL advec_s_pw( sa )
    1801              ENDIF
    1802           ELSE
    1803              CALL advec_s_up( sa )
    1804           ENDIF
    1805        ENDIF
    1806 
    1807        CALL diffusion_s( sa,                                                   &
    1808                          surf_def_h(0)%sasws, surf_def_h(1)%sasws,             &
    1809                          surf_def_h(2)%sasws,                                  &
    1810                          surf_lsm_h%sasws,    surf_usm_h%sasws,                &
    1811                          surf_def_v(0)%sasws, surf_def_v(1)%sasws,             &
    1812                          surf_def_v(2)%sasws, surf_def_v(3)%sasws,             &
    1813                          surf_lsm_v(0)%sasws, surf_lsm_v(1)%sasws,             &
    1814                          surf_lsm_v(2)%sasws, surf_lsm_v(3)%sasws,             &
    1815                          surf_usm_v(0)%sasws, surf_usm_v(1)%sasws,             &
    1816                          surf_usm_v(2)%sasws, surf_usm_v(3)%sasws )
    1817 
    1818        CALL user_actions( 'sa-tendency' )
    1819 
    1820 !
    1821 !--    Prognostic equation for salinity
    1822        DO  i = nxl, nxr
    1823           DO  j = nys, nyn
    1824              DO  k = nzb+1, nzt
    1825                 sa_p(k,j,i) = sa(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +      &
    1826                                                    tsc(3) * tsa_m(k,j,i) )     &
    1827                                                  - tsc(5) * rdf_sc(k) *        &
    1828                                                  ( sa(k,j,i) - sa_init(k) )    &
    1829                                           )                                    &
    1830                                    * MERGE( 1.0_wp, 0.0_wp,                    &
    1831                                              BTEST( wall_flags_0(k,j,i), 0 )   &
    1832                                           )
    1833                 IF ( sa_p(k,j,i) < 0.0_wp )  sa_p(k,j,i) = 0.1_wp * sa(k,j,i)
    1834              ENDDO
    1835           ENDDO
    1836        ENDDO
    1837 
    1838 !
    1839 !--    Calculate tendencies for the next Runge-Kutta step
    1840        IF ( timestep_scheme(1:5) == 'runge' )  THEN
    1841           IF ( intermediate_timestep_count == 1 )  THEN
    1842              DO  i = nxl, nxr
    1843                 DO  j = nys, nyn
    1844                    DO  k = nzb+1, nzt
    1845                       tsa_m(k,j,i) = tend(k,j,i)
    1846                    ENDDO
    1847                 ENDDO
    1848              ENDDO
    1849           ELSEIF ( intermediate_timestep_count < &
    1850                    intermediate_timestep_count_max )  THEN
    1851              DO  i = nxl, nxr
    1852                 DO  j = nys, nyn
    1853                    DO  k = nzb+1, nzt
    1854                       tsa_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +              &
    1855                                         5.3125_wp * tsa_m(k,j,i)
    1856                    ENDDO
    1857                 ENDDO
    1858              ENDDO
    1859           ENDIF
    1860        ENDIF
    1861 
    1862        CALL cpu_log( log_point(37), 'sa-equation', 'stop' )
    1863 
    1864 !
    1865 !--    Calculate density by the equation of state for seawater
    1866        CALL cpu_log( log_point(38), 'eqns-seawater', 'start' )
    1867        CALL eqn_state_seawater
    1868        CALL cpu_log( log_point(38), 'eqns-seawater', 'stop' )
    1869 
    1870     ENDIF
    1871 
    1872 !
    18731709!-- If required, compute prognostic equation for total water content
    18741710    IF ( humidity )  THEN
     
    20741910
    20751911          CALL cpu_log( log_point(67), 'qc-equation', 'stop' )
     1912
    20761913          CALL cpu_log( log_point(68), 'nc-equation', 'start' )
    2077 
    20781914!
    20791915!--       Calculate prognostic equation for cloud drop concentration
     
    24612297    ENDIF
    24622298
     2299!
     2300!-- Calculate prognostic equations for turbulence closure
    24632301    CALL tcm_prognostic()
    24642302
    24652303!
    2466 !-- If required, compute prognostic equation for chemical quantites
     2304!-- Calculate prognostic equation for chemical quantites
    24672305    IF ( air_chemistry )  THEN
    24682306       CALL cpu_log( log_point(83), '(chem advec+diff+prog)', 'start' )
     
    24702308!--    Loop over chemical species
    24712309       DO  lsp = 1, nvar                         
    2472           CALL chem_prognostic_equations ( chem_species(lsp)%conc_p,           &
    2473                                            chem_species(lsp)%conc,             &
    2474                                            chem_species(lsp)%tconc_m,          &
    2475                                            chem_species(lsp)%conc_pr_init,     &
    2476                                            lsp )       
     2310          CALL chem_prognostic_equations( chem_species(lsp)%conc_p,            &
     2311                                          chem_species(lsp)%conc,              &
     2312                                          chem_species(lsp)%tconc_m,           &
     2313                                          chem_species(lsp)%conc_pr_init,      &
     2314                                          lsp )
    24772315       ENDDO
    24782316
     
    24802318    ENDIF   ! Chemicals equations
    24812319
     2320!
     2321!-- Calculate prognostic equations for the ocean
     2322    IF ( ocean_mode )  CALL ocean_prognostic_equations()
    24822323
    24832324 END SUBROUTINE prognostic_equations_vector
  • palm/trunk/SOURCE/read_restart_data_mod.f90

    r3289 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3289 2018-09-28 10:23:58Z suehring
    2730! Introduce module parameter for number of inflow profiles
    2831!
     
    7780
    7881    USE control_parameters
    79      
    8082
    8183    IMPLICIT NONE
     
    99101
    100102
    101     PUBLIC rrd_global, rrd_read_parts_of_global, rrd_local,      &
    102            rrd_skip_global
     103    PUBLIC rrd_global, rrd_read_parts_of_global, rrd_local, rrd_skip_global
    103104
    104105
    105106 CONTAINS
    106107
     108!------------------------------------------------------------------------------!
    107109! Description:
    108110! ------------
     
    115117       USE arrays_3d,                                                          &
    116118           ONLY:  inflow_damping_factor, mean_inflow_profiles, pt_init,        &
    117                   q_init, ref_state, s_init, sa_init, u_init, ug, v_init, vg
     119                  q_init, ref_state, sa_init, s_init, u_init, ug, v_init, vg
    118120
    119121       USE bulk_cloud_model_mod,                                               &
     
    140142       USE netcdf_interface,                                                   &
    141143           ONLY:  netcdf_precision, output_for_t0
     144
     145       USE ocean_mod,                                                          &
     146           ONLY:  ocean_rrd_global
    142147
    143148       USE particle_attributes,                                                &
     
    177182
    178183       CALL check_open( 13 )
    179 
    180 !
    181 !-- Make version number check first
     184!
     185!--    Make version number check first
    182186       READ ( 13 )  length
    183187       READ ( 13 )  restart_string(1:length)
     
    196200
    197201!
    198 !-- Read number of PEs and horizontal index bounds of all PEs used in previous
    199 !-- run
     202!--    Read number of PEs and horizontal index bounds of all PEs used in the
     203!--    previous run
    200204       READ ( 13 )  length
    201205       READ ( 13 )  restart_string(1:length)
     
    223227
    224228!
    225 !-- Read vertical number of gridpoints and number of different areas used
    226 !-- for computing statistics. Allocate arrays depending on these values,
    227 !-- which are needed for the following read instructions.
     229!--    Read vertical number of gridpoints and number of different areas used
     230!--    for computing statistics. Allocate arrays depending on these values,
     231!--    which are needed for the following read instructions.
    228232       READ ( 13 )  length
    229233       READ ( 13 )  restart_string(1:length)
     
    257261       ENDIF
    258262       READ ( 13 )  statistic_regions
     263
    259264       IF ( .NOT. ALLOCATED( ug ) )  THEN
    260265          ALLOCATE( ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1),                    &
     
    266271
    267272!
    268 !-- Now read all control parameters:
    269 !-- Caution: When the following read instructions have been changed, the
    270 !-- -------  version number stored in the variable binary_version_global has to
    271 !--          be increased. The same changes must also be done in
    272 !--          wrd_write_global.
     273!--    Now read all control parameters:
     274!--    Caution: When the following read instructions have been changed, the
     275!--    -------  version number stored in the variable binary_version_global has
     276!--             to be increased. The same changes must also be done in
     277!--             wrd_write_global.
    273278       READ ( 13 )  length
    274279       READ ( 13 )  restart_string(1:length)
     
    318323             CASE ( 'bc_s_t' )
    319324                READ ( 13 )  bc_s_t
    320              CASE ( 'bc_sa_t' )
    321                 READ ( 13 )  bc_sa_t
    322325             CASE ( 'bc_uv_b' )
    323326                READ ( 13 )  bc_uv_b
    324327             CASE ( 'bc_uv_t' )
    325328                READ ( 13 )  bc_uv_t
    326              CASE ( 'bottom_salinityflux' )
    327                 READ ( 13 )  bottom_salinityflux
    328329             CASE ( 'building_height' )
    329330                READ ( 13 )  building_height
     
    496497                READ ( 13 )  ny
    497498                ny_on_file = ny
    498              CASE ( 'ocean' )
    499                 READ ( 13 )  ocean
     499             CASE ( 'ocean_mode' )
     500                READ ( 13 )  ocean_mode
    500501             CASE ( 'old_dt' )
    501502                READ ( 13 )  old_dt
     
    580581             CASE ( 's_vertical_gradient_level_ind' )
    581582                READ ( 13 )  s_vertical_gradient_level_ind
    582              CASE ( 'sa_init' )
    583                 READ ( 13 )  sa_init
    584              CASE ( 'sa_surface' )
    585                 READ ( 13 )  sa_surface
    586              CASE ( 'sa_vertical_gradient' )
    587                 READ ( 13 )  sa_vertical_gradient
    588              CASE ( 'sa_vertical_gradient_level' )
    589                 READ ( 13 )  sa_vertical_gradient_level
    590583             CASE ( 'scalar_advec' )
    591584                READ ( 13 )  scalar_advec
     
    662655             CASE ( 'top_momentumflux_v' )
    663656                READ ( 13 )  top_momentumflux_v
    664              CASE ( 'top_salinityflux' )
    665                 READ ( 13 )  top_salinityflux
    666657             CASE ( 'top_scalarflux' )
    667658                READ ( 13 )  top_scalarflux
     
    754745             CASE ( 'wall_humidityflux' )
    755746                READ ( 13 )  wall_humidityflux
    756              CASE ( 'wall_salinityflux' )
    757                 READ ( 13 )  wall_salinityflux
    758747             CASE ( 'wall_scalarflux' )
    759748                READ ( 13 )  wall_scalarflux
     
    769758                READ ( 13 )  z_i
    770759
    771 
    772760             CASE DEFAULT
    773 
    774                 IF ( .NOT. found ) CALL bcm_rrd_global( found )
    775 
    776                 IF ( .NOT. found ) CALL wtm_rrd_global( found )
    777 
    778                 IF ( .NOT. found ) CALL flight_rrd_global( found )
    779 
    780                 IF ( .NOT. found ) CALL stg_rrd_global ( found )
    781 
    782                 IF ( .NOT. found ) CALL gust_rrd_global( found )
    783 
    784                 IF ( .NOT. found ) CALL user_rrd_global( found )
     761!
     762!--             Read global variables from of other modules
     763                IF ( .NOT. found )  CALL bcm_rrd_global( found )
     764                IF ( .NOT. found )  CALL flight_rrd_global( found )
     765                IF ( .NOT. found )  CALL gust_rrd_global( found )
     766                IF ( .NOT. found )  CALL ocean_rrd_global( found )
     767                IF ( .NOT. found )  CALL stg_rrd_global ( found )
     768                IF ( .NOT. found )  CALL wtm_rrd_global( found )
     769!
     770!--             Read user-defined global variables
     771                IF ( .NOT. found )  CALL user_rrd_global( found )
    785772
    786773                IF ( .NOT. found )  THEN
     
    10491036
    10501037    USE arrays_3d,                                                             &
    1051         ONLY:  e, kh, km, p, pt, q, ql, &
    1052                s, sa, u, u_m_l, u_m_n, u_m_r, u_m_s, v, v_m_l, v_m_n,      &
    1053                v_m_r, v_m_s, vpt, w, w_m_l, w_m_n, w_m_r, w_m_s
     1038        ONLY:  e, kh, km, p, pt, q, ql, s, u, u_m_l, u_m_n, u_m_r, u_m_s,      &
     1039               v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, w, w_m_l, w_m_n, w_m_r, w_m_s
     1040
     1041    USE bulk_cloud_model_mod,                                                  &
     1042        ONLY :  bcm_rrd_local
    10541043
    10551044    USE averaging
     
    10731062        ONLY:  lsm_rrd_local
    10741063
    1075     USE bulk_cloud_model_mod,                                                  &
    1076         ONLY :  bcm_rrd_local
     1064    USE ocean_mod,                                                             &
     1065        ONLY:  ocean_rrd_local
    10771066
    10781067    USE particle_attributes,                                                   &
     
    15991588                   DEALLOCATE( tmp_2d_id_random, tmp_2d_seq_random )
    16001589
    1601                 CASE ( 'rho_ocean_av' )
    1602                    IF ( .NOT. ALLOCATED( rho_ocean_av ) )  THEN
    1603                       ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    1604                    ENDIF
    1605                    IF ( k == 1 )  READ ( 13 )  tmp_3d
    1606                    rho_ocean_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =   &
    1607                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
    1608                            
    16091590                CASE ( 's' )
    16101591                   IF ( k == 1 )  READ ( 13 )  tmp_3d
     
    16181599                   IF ( k == 1 )  READ ( 13 )  tmp_3d
    16191600                   s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
    1620                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
    1621 
    1622                 CASE ( 'sa' )
    1623                    IF ( k == 1 )  READ ( 13 )  tmp_3d
    1624                    sa(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
    1625                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
    1626 
    1627                 CASE ( 'sa_av' )
    1628                    IF ( .NOT. ALLOCATED( sa_av ) )  THEN
    1629                       ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    1630                    ENDIF
    1631                    IF ( k == 1 )  READ ( 13 )  tmp_3d
    1632                    sa_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
    16331601                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
    16341602
     
    18841852
    18851853!
    1886 !--                Read microphysics module restart data
     1854!--                Read restart data of other modules
    18871855                   IF ( .NOT. found ) CALL bcm_rrd_local( i, k, nxlf,          &
    18881856                                           nxlc, nxl_on_file, nxrf, nxrc,      &
     
    18911859                                           nys_on_file, tmp_2d, tmp_3d, found )
    18921860
    1893 !
    1894 !--                Read surface related variables
    1895                    IF ( .NOT. found ) CALL surface_rrd_local( i, k, nxlf,      &
    1896                                            nxlc, nxl_on_file, nxrf, nxrc,      &
     1861                   IF ( .NOT. found ) CALL chem_rrd_local( i, k, nxlf,         &
     1862                                           nxlc, nxl_on_file, nxrf, nxrc,      &
    18971863                                           nxr_on_file, nynf, nync,            &
    18981864                                           nyn_on_file, nysf, nysc,            &
    1899                                            nys_on_file, found )
    1900 
    1901 !
    1902 !--                Read urban surface restart data
    1903                    IF ( .NOT. found ) CALL usm_rrd_local( i, k, nxlf,          &
     1865                                           nys_on_file, tmp_3d, found )
     1866
     1867                   IF ( .NOT. found ) CALL gust_rrd_local( i, k, nxlf,         &
    19041868                                           nxlc, nxl_on_file, nxrf, nxrc,      &
    19051869                                           nxr_on_file, nynf, nync,            &
    19061870                                           nyn_on_file, nysf, nysc,            &
    1907                                            nys_on_file, found )
    1908 
    1909 !
    1910 !--                Read land surface restart data
     1871                                           nys_on_file, tmp_2d, tmp_3d, found )
     1872
    19111873                   IF ( .NOT. found ) CALL lsm_rrd_local( i, k, nxlf,          &
    19121874                                           nxlc, nxl_on_file, nxrf, nxrc,      &
     
    19151877                                           nys_on_file, tmp_2d, found )
    19161878
    1917 !
    1918 !--                Read radiation restart data
     1879                   IF ( .NOT. found ) CALL ocean_rrd_local( i, k, nxlf,        &
     1880                                           nxlc, nxl_on_file, nxrf, nxrc,      &
     1881                                           nxr_on_file, nynf, nync,            &
     1882                                           nyn_on_file, nysf, nysc,            &
     1883                                           nys_on_file, tmp_2d, tmp_3d, found )
     1884
    19191885                   IF ( .NOT. found ) CALL radiation_rrd_local( i, k, nxlf,    &
    19201886                                           nxlc, nxl_on_file, nxrf, nxrc,      &
     
    19231889                                           nys_on_file, tmp_2d, tmp_3d, found )
    19241890
    1925 !
    1926 !--                Read chemistry restart data
    1927                    IF ( .NOT. found ) CALL chem_rrd_local( i, k, nxlf,         &
     1891                   IF ( .NOT. found ) CALL surface_rrd_local( i, k, nxlf,      &
    19281892                                           nxlc, nxl_on_file, nxrf, nxrc,      &
    19291893                                           nxr_on_file, nynf, nync,            &
    19301894                                           nyn_on_file, nysf, nysc,            &
    1931                                            nys_on_file, tmp_3d, found )
    1932 
    1933 !
    1934 !--                Read gust module restart data
    1935                    IF ( .NOT. found ) CALL gust_rrd_local( i, k, nxlf,         &
     1895                                           nys_on_file, found )
     1896
     1897                   IF ( .NOT. found ) CALL usm_rrd_local( i, k, nxlf,          &
    19361898                                           nxlc, nxl_on_file, nxrf, nxrc,      &
    19371899                                           nxr_on_file, nynf, nync,            &
    19381900                                           nyn_on_file, nysf, nysc,            &
    1939                                            nys_on_file, tmp_2d, tmp_3d, found )
     1901                                           nys_on_file, found )
    19401902
    19411903!
  • palm/trunk/SOURCE/subsidence_mod.f90

    r3045 r3294  
    2525! -----------------
    2626! $Id$
     27! ocean renamed ocean_mode
     28!
     29! 3045 2018-05-28 07:55:41Z Giersch
    2730! Error message revised
    2831!
     
    126129
    127130       USE control_parameters,                                                 &
    128            ONLY:  message_string, ocean, subs_vertical_gradient,               &
     131           ONLY:  message_string, ocean_mode, subs_vertical_gradient,          &
    129132                  subs_vertical_gradient_level, subs_vertical_gradient_level_i
    130133
     
    147150       ENDIF
    148151
    149        IF ( ocean )  THEN
     152       IF ( ocean_mode )  THEN
    150153          message_string = 'Applying large scale vertical motion is not ' //   &
    151                            'allowed for ocean runs'
     154                           'allowed for ocean mode'
    152155          CALL message( 'init_w_subsidence', 'PA0324', 2, 2, 0, 6, 0 )
    153156       ENDIF
  • palm/trunk/SOURCE/sum_up_3d_data.f90

    r3291 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3291 2018-09-28 11:33:03Z scharf
    2730! corrected previous commit for 3D topography
    2831!
     
    211214
    212215    USE arrays_3d,                                                             &
    213         ONLY:  dzw, e, heatflux_output_conversion, nc, nr, p, prr, pt,         &
    214                q, qc, ql, ql_c, ql_v, qr, rho_ocean, s, sa, u, v, vpt, w,      &
    215                waterflux_output_conversion, d_exner
     216        ONLY:  dzw, d_exner, e, heatflux_output_conversion, nc, nr, p, prr,    &
     217               pt, q, qc, ql, ql_c, ql_v, qr, s, u, v, vpt, w,                 &
     218               waterflux_output_conversion
    216219
    217220    USE averaging,                                                             &
    218         ONLY:  e_av, ghf_av, lpt_av, lwp_av,                                   &
    219                ol_av, p_av, pc_av, pr_av, pt_av, q_av, ql_av,                  &
    220                ql_c_av, ql_v_av, ql_vp_av, qsws_av, qv_av, r_a_av,             &
    221                rho_ocean_av, s_av, sa_av, shf_av, ssws_av, ts_av, tsurf_av,    &
    222                u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av
     221        ONLY:  e_av, ghf_av, lpt_av, lwp_av, ol_av, p_av, pc_av, pr_av, pt_av, &
     222               q_av, ql_av, ql_c_av, ql_v_av, ql_vp_av, qsws_av, qv_av,        &
     223               r_a_av, s_av, shf_av, ssws_av, ts_av, tsurf_av, u_av, us_av,    &
     224               v_av, vpt_av, w_av, z0_av, z0h_av, z0q_av
    223225
    224226    USE basic_constants_and_equations_mod,                                     &
     
    232234
    233235    USE control_parameters,                                                    &
    234         ONLY:  air_chemistry, average_count_3d, doav, doav_n,                  &
    235                land_surface, rho_surface, urban_surface, uv_exposure,          &
     236        ONLY:  air_chemistry, average_count_3d, doav, doav_n, land_surface,    &
     237               ocean_mode, rho_surface, urban_surface, uv_exposure,            &
    236238               varnamelength
    237239
     
    249251    USE land_surface_model_mod,                                                &
    250252        ONLY:  lsm_3d_data_averaging
     253
     254    USE ocean_mod,                                                             &
     255        ONLY:  ocean_3d_data_averaging
    251256
    252257    USE particle_attributes,                                                   &
     
    412417                r_a_av = 0.0_wp
    413418
    414              CASE ( 'rho_ocean' )
    415                 IF ( .NOT. ALLOCATED( rho_ocean_av ) )  THEN
    416                    ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    417                 ENDIF
    418                 rho_ocean_av = 0.0_wp
    419 
    420419             CASE ( 's' )
    421420                IF ( .NOT. ALLOCATED( s_av ) )  THEN
     
    423422                ENDIF
    424423                s_av = 0.0_wp
    425 
    426              CASE ( 'sa' )
    427                 IF ( .NOT. ALLOCATED( sa_av ) )  THEN
    428                    ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    429                 ENDIF
    430                 sa_av = 0.0_wp
    431424
    432425             CASE ( 'shf*' )
     
    501494                ENDIF
    502495                z0q_av = 0.0_wp
     496
     497             CASE ( 'usm_output' )
    503498!             
    504 !--          Block of urban surface model outputs
    505              CASE ( 'usm_output' )
    506 
     499!--             Block of urban surface model outputs
    507500                CALL usm_average_3d_data( 'allocate', doav(ii) )
    508501             
     
    511504
    512505!
    513 !--             Turbulence closure module
    514                 CALL tcm_3d_data_averaging( 'allocate', doav(ii) )
    515 
    516 !
    517 !--             Microphysics module quantities
     506!--             Allocating and initializing data arrays for other modules
    518507                IF ( bulk_cloud_model )  THEN
    519508                   CALL bcm_3d_data_averaging( 'allocate', doav(ii) )
    520509                ENDIF
    521510
    522 !
    523 !--             Land surface quantity
     511                IF ( air_chemistry  .AND.  trimvar(1:3) == 'kc_')  THEN
     512                   CALL chem_3d_data_averaging( 'allocate', doav(ii) )
     513                ENDIF
     514
     515                IF ( gust_module_enabled )  THEN
     516                   CALL gust_3d_data_averaging( 'allocate', doav(ii) )
     517                ENDIF
     518
    524519                IF ( land_surface )  THEN
    525520                   CALL lsm_3d_data_averaging( 'allocate', doav(ii) )
    526521                ENDIF
    527522
    528 !
    529 !--             Radiation quantity
     523                IF ( ocean_mode )  THEN
     524                   CALL ocean_3d_data_averaging( 'allocate', doav(ii) )
     525                ENDIF
     526
    530527                IF ( radiation )  THEN
    531528                   CALL radiation_3d_data_averaging( 'allocate', doav(ii) )
    532529                ENDIF
    533530
    534 !
    535 !--             Gust module quantities
    536                 IF ( gust_module_enabled )  THEN
    537                    CALL gust_3d_data_averaging( 'allocate', doav(ii) )
    538                 ENDIF
    539 
    540 !
    541 !--             Chemical quantity                                           
    542                 IF ( air_chemistry  .AND.  trimvar(1:3) == 'kc_')  THEN
    543                    CALL chem_3d_data_averaging( 'allocate', doav(ii) )
    544                 ENDIF
    545 
    546 !
    547 !--             UV exposure quantity
    548531                IF ( uv_exposure  .AND.  trimvar(1:5) == 'uvem_')  THEN
    549532                   CALL uvem_3d_data_averaging( 'allocate', doav(ii) )
    550533                ENDIF
    551534
    552 !
    553 !--             User-defined quantity
     535                CALL tcm_3d_data_averaging( 'allocate', doav(ii) )
     536
     537!
     538!--             User-defined quantities
    554539                CALL user_3d_data_averaging( 'allocate', doav(ii) )
    555540
     
    877862             ENDIF
    878863
    879           CASE ( 'rho_ocean' )
    880              IF ( ALLOCATED( rho_ocean_av ) ) THEN
    881                 DO  i = nxlg, nxrg
    882                    DO  j = nysg, nyng
    883                       DO  k = nzb, nzt+1
    884                          rho_ocean_av(k,j,i) = rho_ocean_av(k,j,i) + rho_ocean(k,j,i)
    885                       ENDDO
    886                    ENDDO
    887                 ENDDO
    888              ENDIF 
    889 
    890864          CASE ( 's' )
    891865             IF ( ALLOCATED( s_av ) ) THEN
     
    894868                      DO  k = nzb, nzt+1
    895869                         s_av(k,j,i) = s_av(k,j,i) + s(k,j,i)
    896                       ENDDO
    897                    ENDDO
    898                 ENDDO
    899              ENDIF
    900 
    901           CASE ( 'sa' )
    902              IF ( ALLOCATED( sa_av ) ) THEN
    903                 DO  i = nxlg, nxrg
    904                    DO  j = nysg, nyng
    905                       DO  k = nzb, nzt+1
    906                          sa_av(k,j,i) = sa_av(k,j,i) + sa(k,j,i)
    907870                      ENDDO
    908871                   ENDDO
     
    11821145                ENDDO
    11831146             ENDIF
     1147
     1148          CASE ( 'usm_output' )
    11841149!             
    1185 !--       Block of urban surface model outputs.
    1186 !--       In case of urban surface variables it should be always checked
    1187 !--       if respective arrays are allocated, at least in case of a restart
    1188 !--       run, as averaged usm arrays are not read from file at the moment.
    1189           CASE ( 'usm_output' )
     1150!--          Block of urban surface model outputs.
     1151!--          In case of urban surface variables it should be always checked
     1152!--          if respective arrays are allocated, at least in case of a restart
     1153!--          run, as averaged usm arrays are not read from file at the moment.
    11901154             CALL usm_average_3d_data( 'allocate', doav(ii) )
    11911155             CALL usm_average_3d_data( 'sum', doav(ii) )
     
    11931157          CASE DEFAULT
    11941158!
    1195 !--          Turbulence closure module
    1196              CALL tcm_3d_data_averaging( 'sum', doav(ii) )
    1197 
    1198 !
    1199 !--          Microphysics module quantities
     1159!--          Summing up data from other modules
    12001160             IF ( bulk_cloud_model )  THEN
    12011161                CALL bcm_3d_data_averaging( 'sum', doav(ii) )
    12021162             ENDIF
    12031163
    1204 !
    1205 !--          Land surface quantity
     1164             IF ( air_chemistry  .AND.  trimvar(1:3) == 'kc_')  THEN
     1165                CALL chem_3d_data_averaging( 'sum',doav(ii) )
     1166             ENDIF
     1167
     1168             IF ( gust_module_enabled )  THEN
     1169                CALL gust_3d_data_averaging( 'sum', doav(ii) )
     1170             ENDIF
     1171
    12061172             IF ( land_surface )  THEN
    12071173                CALL lsm_3d_data_averaging( 'sum', doav(ii) )
    12081174             ENDIF
    12091175
    1210 !
    1211 !--          Radiation quantity
     1176             IF ( ocean_mode )  THEN
     1177                CALL ocean_3d_data_averaging( 'sum', doav(ii) )
     1178             ENDIF
     1179
    12121180             IF ( radiation )  THEN
    12131181                CALL radiation_3d_data_averaging( 'sum', doav(ii) )
    12141182             ENDIF
    12151183
    1216 !
    1217 !--          Gust module quantities
    1218              IF ( gust_module_enabled )  THEN
    1219                 CALL gust_3d_data_averaging( 'sum', doav(ii) )
    1220              ENDIF
    1221 
    1222 !
    1223 !--          Chemical quantity
    1224              IF ( air_chemistry  .AND.  trimvar(1:3) == 'kc_')  THEN
    1225                 CALL chem_3d_data_averaging( 'sum',doav(ii) )
    1226              ENDIF
    1227 
    1228 !
    1229 !--          UV exposure quantity
     1184             CALL tcm_3d_data_averaging( 'sum', doav(ii) )
     1185
    12301186             IF ( uv_exposure )  THEN
    12311187                CALL uvem_3d_data_averaging( 'sum', doav(ii) )
     
    12331189
    12341190!
    1235 !--          User-defined quantity
     1191!--          User-defined quantities
    12361192             CALL user_3d_data_averaging( 'sum', doav(ii) )
    12371193
  • palm/trunk/SOURCE/surface_mod.f90

    r3274 r3294  
    2626! -----------------
    2727! $Id$
     28! changes concerning modularization of ocean option
     29!
     30! 3274 2018-09-24 15:42:55Z knoop
    2831! Modularization of all bulk cloud physics code components
    2932!
     
    11141117!
    11151118!--    Salinity surface flux
    1116        IF ( ocean )  DEALLOCATE ( surfaces%sasws )
     1119       IF ( ocean_mode )  DEALLOCATE ( surfaces%sasws )
    11171120
    11181121    END SUBROUTINE deallocate_surface_attributes_h
     
    12411244!
    12421245!--    Salinity surface flux
    1243        IF ( ocean )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
     1246       IF ( ocean_mode )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
    12441247
    12451248    END SUBROUTINE allocate_surface_attributes_h
     
    13061309!
    13071310!--    Salinity flux
    1308        IF ( ocean )  DEALLOCATE ( surfaces%sasws )
     1311       IF ( ocean_mode )  DEALLOCATE ( surfaces%sasws )
    13091312
    13101313    END SUBROUTINE deallocate_surface_attributes_h_top
     
    13781381!
    13791382!--    Salinity flux
    1380        IF ( ocean )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
     1383       IF ( ocean_mode )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
    13811384
    13821385    END SUBROUTINE allocate_surface_attributes_h_top
     
    14961499!
    14971500!--    Salinity surface flux
    1498        IF ( ocean )  DEALLOCATE ( surfaces%sasws )
     1501       IF ( ocean_mode )  DEALLOCATE ( surfaces%sasws )
    14991502
    15001503    END SUBROUTINE deallocate_surface_attributes_v
     
    16211624!
    16221625!--    Salinity surface flux
    1623        IF ( ocean )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
     1626       IF ( ocean_mode )  ALLOCATE ( surfaces%sasws(1:surfaces%ns) )
    16241627
    16251628    END SUBROUTINE allocate_surface_attributes_v
     
    22682271                ENDIF
    22692272
    2270                 IF ( ocean )  THEN
     2273                IF ( ocean_mode )  THEN
    22712274                   IF ( upward_facing )  THEN
    22722275                      surf%sasws(num_h) = bottom_salinityflux * rho_air_zw(k-1)
     
    23442347!
    23452348!--          Prescribe top salinity flux
    2346              IF ( ocean .AND. constant_top_salinityflux)                       &
     2349             IF ( ocean_mode .AND. constant_top_salinityflux)                  &
    23472350                surf%sasws(num_h) = top_salinityflux * rho_air_zw(nzt+1)
    23482351!
     
    24882491!--          So far, salinityflux at vertical surfaces is simply zero
    24892492!--          at the moment 
    2490              IF ( ocean )  surf%sasws(num_v) = wall_salinityflux(component)
     2493             IF ( ocean_mode )  surf%sasws(num_v) = wall_salinityflux(component)
    24912494!
    24922495!--          Increment wall indices
  • palm/trunk/SOURCE/swap_timelevel.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    147150        ONLY:  chem_swap_timelevel
    148151
    149     USE land_surface_model_mod,                                                &
    150         ONLY: lsm_swap_timelevel
    151 
    152152    USE cpulog,                                                                &
    153153        ONLY: cpu_log, log_point
    154154
    155155    USE control_parameters,                                                    &
    156         ONLY:  air_chemistry, humidity, land_surface,                          &
    157                neutral, ocean, passive_scalar, timestep_count, urban_surface
     156        ONLY:  air_chemistry, humidity, land_surface, neutral, ocean_mode,     &
     157               passive_scalar, timestep_count, urban_surface
    158158
    159159    USE gust_mod,                                                              &
     
    164164        ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
    165165#endif
     166
     167    USE land_surface_model_mod,                                                &
     168        ONLY: lsm_swap_timelevel
     169
     170    USE ocean_mod,                                                             &
     171        ONLY:  ocean_swap_timelevel
    166172
    167173    USE pmc_interface,                                                         &
     
    202208    ENDDO
    203209
    204     CALL tcm_swap_timelevel ( 0 )
    205 
    206     IF ( ocean )  THEN
    207        sa = sa_p
    208     ENDIF
    209 
    210210    IF ( humidity )  THEN
    211211       q = q_p
     
    214214    IF ( passive_scalar )  s = s_p             
    215215
    216     IF ( humidity  .AND.  bulk_cloud_model )  THEN
    217        CALL bcm_swap_timelevel ( 0 )
    218     ENDIF
    219 
    220     IF ( land_surface )  THEN
    221        CALL lsm_swap_timelevel ( 0 )
    222     ENDIF
    223 
    224     IF ( urban_surface )  THEN
    225        CALL usm_swap_timelevel ( 0 )
    226     ENDIF
    227 
    228     IF ( gust_module_enabled )  THEN
    229        CALL gust_swap_timelevel ( 0 )
    230     ENDIF
    231 
     216!
     217!-- Swapping the timelevel of other modules
     218    IF ( humidity  .AND.  bulk_cloud_model )  CALL bcm_swap_timelevel( 0 )
     219    IF ( gust_module_enabled )                CALL gust_swap_timelevel( 0 )
     220    IF ( land_surface )                       CALL lsm_swap_timelevel( 0 )
     221    IF ( ocean_mode )                         CALL ocean_swap_timelevl( 0 )
     222    CALL tcm_swap_timelevel( 0 )
     223    IF ( urban_surface )                      CALL usm_swap_timelevel( 0 )
    232224
    233225    CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'stop' )
     
    245237             pt => pt_1;  pt_p => pt_2
    246238          ENDIF
    247           IF ( ocean )  THEN
     239          IF ( ocean_mode )  THEN
    248240             sa => sa_1;  sa_p => sa_2
    249241          ENDIF
     
    254246             s => s_1;    s_p => s_2
    255247          ENDIF
    256 
    257           IF ( air_chemistry )  CALL chem_swap_timelevel(0)
    258248
    259249          swap_level = 1
     
    267257             pt => pt_2;  pt_p => pt_1
    268258          ENDIF
    269           IF ( ocean )  THEN
     259          IF ( ocean_mode )  THEN
    270260             sa => sa_2;  sa_p => sa_1
    271261          ENDIF
     
    277267          ENDIF
    278268
    279           IF ( air_chemistry )  CALL chem_swap_timelevel(1)
    280 
    281269          swap_level = 2
    282270
    283271    END SELECT
     272
     273    IF ( air_chemistry )  CALL chem_swap_timelevel( MOD( timestep_count, 2) )
    284274
    285275    CALL tcm_swap_timelevel ( MOD( timestep_count, 2) )
  • palm/trunk/SOURCE/time_integration.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    369372               ref_state, rho_ocean, s, s_p, sa_p, tend, u, u_p, v, vpt,       &
    370373               v_p, w, w_p
     374
     375    USE bulk_cloud_model_mod,                                                  &
     376        ONLY: bulk_cloud_model, calc_liquid_water_content,                     &
     377              collision_turbulence, microphysics_morrison, microphysics_seifert
    371378
    372379    USE calc_mean_profile_mod,                                                 &
     
    399406               multi_agent_system_end, multi_agent_system_start,               &
    400407               nesting_offline, neutral, nr_timesteps_this_run, nudging,       &
    401                ocean, passive_scalar, prho_reference, pt_reference,            &
     408               ocean_mode, passive_scalar, pt_reference,                       &
    402409               pt_slope_offset, random_heatflux, rans_mode,                    &
    403410               rans_tke_e, run_coupled, simulated_time, simulated_time_chr,    &
     
    443450               lsf_nesting_offline, lsf_nesting_offline_mass_conservation
    444451
    445     USE bulk_cloud_model_mod,                                                  &
    446         ONLY: bulk_cloud_model, calc_liquid_water_content,                     &
    447               collision_turbulence, microphysics_morrison, microphysics_seifert
    448 
    449452    USE netcdf_data_input_mod,                                                 &
    450453        ONLY:  nest_offl, netcdf_data_input_lsf
     
    452455    USE multi_agent_system_mod,                                                &
    453456        ONLY:  agents_active, multi_agent_system
     457
     458    USE ocean_mod,                                                             &
     459        ONLY:  prho_reference
    454460
    455461    USE particle_attributes,                                                   &
     
    662668                ref_state(:)  = hom(:,1,4,0) ! this is used in the buoyancy term
    663669             ENDIF
    664              IF ( ocean )  THEN
     670             IF ( ocean_mode )  THEN
    665671                CALL calc_mean_profile( rho_ocean, 64 )
    666672                ref_state(:)  = hom(:,1,64,0)
     
    753759             ENDIF
    754760          ENDIF
    755           IF ( ocean )  THEN
     761          IF ( ocean_mode )  THEN
    756762             CALL exchange_horiz( sa_p, nbgp )
    757763             CALL exchange_horiz( rho_ocean, nbgp )
     
    10531059             CALL cpu_log( log_point(17), 'diffusivities', 'start' )
    10541060             IF ( .NOT. humidity ) THEN
    1055                 IF ( ocean )  THEN
     1061                IF ( ocean_mode )  THEN
    10561062                   CALL tcm_diffusivities( prho, prho_reference )
    10571063                ELSE
  • palm/trunk/SOURCE/turbulence_closure_mod.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    164167               initializing_actions, intermediate_timestep_count,              &
    165168               intermediate_timestep_count_max, km_constant,                   &
    166                les_dynamic, les_mw, ocean, plant_canopy, prandtl_number,       &
    167                prho_reference, pt_reference, rans_mode, rans_tke_e, rans_tke_l,&
     169               les_dynamic, les_mw, ocean_mode, plant_canopy, prandtl_number,  &
     170               pt_reference, rans_mode, rans_tke_e, rans_tke_l,                &
    168171               simulated_time,timestep_scheme, turbulence_closure,             &
    169172               turbulent_inflow, use_upstream_for_tke, vpt_reference,          &
     
    190193
    191194    USE kinds
     195
     196    USE ocean_mod,                                                             &
     197        ONLY:  prho_reference
    192198
    193199    USE pegrid
     
    11161122                e  = e_init
    11171123             ELSE
    1118                 IF ( .NOT. ocean )  THEN
     1124                IF ( .NOT. ocean_mode )  THEN
    11191125                   kh   = 0.01_wp   ! there must exist an initial diffusion, because
    11201126                   km   = 0.01_wp   ! otherwise no TKE would be produced by the
     
    11601166             e  = e_init
    11611167          ELSE
    1162              IF ( .NOT. ocean )  THEN
     1168             IF ( .NOT. ocean_mode )  THEN
    11631169                kh   = 0.01_wp   ! there must exist an initial diffusion, because
    11641170                km   = 0.01_wp   ! otherwise no TKE would be produced by the
     
    21552161
    21562162       IF ( .NOT. humidity )  THEN
    2157           IF ( ocean )  THEN
     2163          IF ( ocean_mode )  THEN
    21582164             CALL diffusion_e( prho, prho_reference )
    21592165          ELSE
     
    24232429
    24242430       IF ( .NOT. humidity )  THEN
    2425           IF ( ocean )  THEN
     2431          IF ( ocean_mode )  THEN
    24262432             CALL diffusion_e( i, j, prho, prho_reference )
    24272433          ELSE
     
    29342940          IF ( .NOT. humidity )  THEN
    29352941
    2936              IF ( ocean )  THEN
     2942             IF ( ocean_mode )  THEN
    29372943!
    29382944!--             So far in the ocean no special treatment of density flux
     
    37383744       IF ( .NOT. humidity )  THEN
    37393745
    3740           IF ( ocean )  THEN
     3746          IF ( ocean_mode )  THEN
    37413747!
    37423748!--          So far in the ocean no special treatment of density flux in
  • palm/trunk/SOURCE/write_restart_data_mod.f90

    r3274 r3294  
    2525! -----------------
    2626! $Id$
     27! changes concerning modularization of ocean option
     28!
     29! 3274 2018-09-24 15:42:55Z knoop
    2730! Modularization of all bulk cloud physics code components
    2831!
     
    9598       USE arrays_3d,                                                          &
    9699           ONLY:  inflow_damping_factor, mean_inflow_profiles, pt_init,        &
    97                   q_init, ref_state, s_init, sa_init, u_init, ug, v_init, vg
     100                  q_init, ref_state, s_init, u_init, ug, v_init, vg
     101
     102       USE bulk_cloud_model_mod,                                               &
     103           ONLY:  bulk_cloud_model, bcm_wrd_global
    98104
    99105       USE date_and_time_mod,                                                  &
     
    112118           ONLY:  nx, ny, nz
    113119
    114        USE bulk_cloud_model_mod,                                               &
    115            ONLY:  bulk_cloud_model, bcm_wrd_global
    116 
    117120       USE model_1d_mod,                                                       &
    118121           ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
     
    120123       USE netcdf_interface,                                                   &
    121124           ONLY:  netcdf_precision, output_for_t0
     125
     126       USE ocean_mod,                                                          &
     127           ONLY:  ocean_wrd_global
    122128
    123129       USE particle_attributes,                                                &
     
    238244       WRITE ( 14 )  bc_s_t
    239245
    240        CALL wrd_write_string( 'bc_sa_t' )
    241        WRITE ( 14 )  bc_sa_t
    242 
    243246       CALL wrd_write_string( 'bc_uv_b' )
    244247       WRITE ( 14 )  bc_uv_b
     
    246249       CALL wrd_write_string( 'bc_uv_t' )
    247250       WRITE ( 14 )  bc_uv_t
    248 
    249        CALL wrd_write_string( 'bottom_salinityflux' )
    250        WRITE ( 14 )  bottom_salinityflux
    251251
    252252       CALL wrd_write_string( 'building_height' )
     
    497497       WRITE ( 14 )  ny
    498498
    499        CALL wrd_write_string( 'ocean' )
    500        WRITE ( 14 )  ocean
     499       CALL wrd_write_string( 'ocean_mode' )
     500       WRITE ( 14 )  ocean_mode
    501501
    502502       CALL wrd_write_string( 'old_dt' )
     
    622622       CALL wrd_write_string( 's_vertical_gradient_level_ind' )
    623623       WRITE ( 14 )  s_vertical_gradient_level_ind
    624 
    625        CALL wrd_write_string( 'sa_init' )
    626        WRITE ( 14 )  sa_init
    627 
    628        CALL wrd_write_string( 'sa_surface' )
    629        WRITE ( 14 )  sa_surface
    630 
    631        CALL wrd_write_string( 'sa_vertical_gradient' )
    632        WRITE ( 14 )  sa_vertical_gradient
    633 
    634        CALL wrd_write_string( 'sa_vertical_gradient_level' )
    635        WRITE ( 14 )  sa_vertical_gradient_level
    636624
    637625       CALL wrd_write_string( 'scalar_advec' )
     
    738726       WRITE ( 14 )  top_momentumflux_v
    739727
    740        CALL wrd_write_string( 'top_salinityflux' )
    741        WRITE ( 14 )  top_salinityflux
    742 
    743728       CALL wrd_write_string( 'top_scalarflux' )
    744729       WRITE ( 14 )  top_scalarflux
     
    876861       WRITE ( 14 )  wall_humidityflux
    877862
    878        CALL wrd_write_string( 'wall_salinityflux' )
    879        WRITE ( 14 )  wall_salinityflux
    880 
    881863       CALL wrd_write_string( 'wall_scalarflux' )
    882864       WRITE ( 14 )  wall_scalarflux
     
    897879       WRITE ( 14 )  z_i
    898880
    899 
    900 !   
    901 !-- The order of the calls can be different as in read_restart_data_mod where
    902 !-- the restart data will be read
    903 
    904 !
    905 !-- If required, write restart data for gust module.
    906        IF ( bulk_cloud_model )  CALL bcm_wrd_global
    907 !
    908 !-- If required, write restart data for wind turbine model.
    909        IF ( wind_turbine )  CALL wtm_wrd_global
    910 
    911 !
    912 !-- If required, write restart data for virtual measurements.
    913        IF ( virtual_flight )  CALL flight_wrd_global
    914 
    915 !
    916 !-- If required, write restart data for turbulence generator.
    917        IF ( syn_turb_gen )  CALL stg_wrd_global
    918 
    919 !
    920 !-- If required, write restart data for gust module.
     881!
     882!--    Write restart data of the other modules
     883!--    The order of the calls can be different as in read_restart_data_mod where
     884!--    the restart data will be read
     885       IF ( bulk_cloud_model )     CALL bcm_wrd_global
     886       IF ( virtual_flight )       CALL flight_wrd_global
    921887       IF ( gust_module_enabled )  CALL gust_wrd_global
    922 
    923 !
    924 !-- Write restart data for user data.
     888       IF ( ocean_mode )           CALL ocean_wrd_global
     889       IF ( syn_turb_gen )         CALL stg_wrd_global
     890       IF ( wind_turbine )         CALL wtm_wrd_global
     891!
     892!--    Write restart data of the user-interface
    925893       CALL user_wrd_global
    926894
     
    940908
    941909       USE arrays_3d,                                                          &
    942            ONLY:  e, kh, km, p, pt, q, ql, s, sa, u, u_m_l, u_m_n, u_m_r,      &
     910           ONLY:  e, kh, km, p, pt, q, ql, s, u, u_m_l, u_m_n, u_m_r,          &
    943911                  u_m_s, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, w, w_m_l, w_m_n,  &
    944912                  w_m_r, w_m_s
     
    960928       USE land_surface_model_mod,                                             &
    961929           ONLY:  lsm_wrd_local
     930
     931       USE ocean_mod,                                                          &
     932           ONLY:  ocean_wrd_local
    962933
    963934       USE particle_attributes,                                                &
     
    11121083       ENDIF
    11131084       
    1114        IF ( ocean )  THEN
    1115 
    1116           IF ( ALLOCATED( rho_ocean_av ) )  THEN
    1117              CALL wrd_write_string( 'rho_ocean_av' )
    1118              WRITE ( 14 )  rho_ocean_av
    1119           ENDIF
    1120 
    1121           CALL wrd_write_string( 'sa' )
    1122           WRITE ( 14 )  sa
    1123 
    1124           IF ( ALLOCATED( sa_av ) )  THEN
    1125              CALL wrd_write_string( 'sa_av' )
    1126              WRITE ( 14 )  sa_av
    1127           ENDIF
    1128 
    1129        ENDIF
    1130 
    11311085       IF ( ALLOCATED( ql_c_av ) )  THEN
    11321086          CALL wrd_write_string( 'ql_c_av' )
     
    13101264
    13111265!
    1312 !-- If required, write restart data for microphysics module.
    1313        IF ( bulk_cloud_model )  THEN
    1314           CALL bcm_wrd_local
    1315        ENDIF
    1316 
    1317 !
    1318 !-- Write surface-related restart data.
     1266!--    Write restart data of other modules
     1267       IF ( bulk_cloud_model )     CALL bcm_wrd_local
     1268       IF ( air_chemistry )        CALL chem_wrd_local
     1269       IF ( gust_module_enabled )  CALL gust_wrd_local
     1270       IF ( land_surface )         CALL lsm_wrd_local
     1271       IF ( ocean_mode )           CALL ocean_wrd_local
    13191272       CALL surface_wrd_local
    1320 
    1321 !
    1322 !-- If required, write restart data for urban surface model.
    1323        IF ( urban_surface )  THEN
    1324           CALL usm_wrd_local
    1325        ENDIF
    1326 
    1327 !
    1328 !-- If required, write restart data for land surface model.
    1329        IF ( land_surface )  THEN
    1330           CALL lsm_wrd_local
    1331        ENDIF
    1332 
    1333 !
    1334 !-- If required, write restart data for radiation model.
    1335        IF ( radiation )  THEN
    1336           CALL radiation_wrd_local
    1337        ENDIF
    1338 
    1339 !
    1340 !-- If required, write restart data for chemistry model.
    1341        IF ( air_chemistry )  THEN
    1342           CALL chem_wrd_local
    1343        ENDIF
    1344 
    1345 !
    1346 !-- If required, write restart data for gust module.
    1347        IF ( gust_module_enabled )  THEN
    1348           CALL gust_wrd_local
    1349        ENDIF
    1350 
    1351 !
    1352 !-- Write user-related restart data.
     1273       IF ( radiation )            CALL radiation_wrd_local
     1274       IF ( urban_surface )        CALL usm_wrd_local
     1275
     1276!
     1277!--    Write user-defined restart data
    13531278       CALL user_wrd_local
    13541279
    1355 !--    Write end label.
     1280!
     1281!--    Write end label
    13561282       CALL wrd_write_string( '*** end ***' )
    13571283
Note: See TracChangeset for help on using the changeset viewer.