Ignore:
Timestamp:
Jan 21, 2019 1:02:11 AM (6 years ago)
Author:
knoop
Message:

Some interface calls moved to module_interface + cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/init_3d_model.f90

    r3648 r3685  
    2525! -----------------
    2626! $Id$
     27! Some interface calls moved to module_interface + cleanup
     28!
     29! 3648 2019-01-02 16:35:46Z suehring
    2730! Rename subroutines for surface-data output
    2831!
     
    583586               ideal_gas_law_rho, ideal_gas_law_rho_pt, barometric_formula
    584587
    585     USE biometeorology_mod,                                                    &
    586         ONLY:  bio_init
    587 
    588588    USE bulk_cloud_model_mod,                                                  &
    589         ONLY:  bulk_cloud_model, bcm_init, bcm_init_arrays
    590 
    591     USE chem_emissions_mod,                                                    &
    592         ONLY:  chem_emissions_init
     589        ONLY:  bulk_cloud_model
    593590
    594591    USE chem_modules,                                                          &
    595         ONLY:  do_emis, max_pr_cs, nspec_out
     592        ONLY:  max_pr_cs ! ToDo: this dependency needs to be removed cause it is ugly #new_dom
    596593
    597594    USE control_parameters
    598 
    599     USE flight_mod,                                                            &
    600         ONLY:  flight_init
    601595
    602596    USE grid_variables,                                                        &
    603597        ONLY:  dx, dy, ddx2_mg, ddy2_mg
    604598
    605     USE gust_mod,                                                              &
    606         ONLY:  gust_init, gust_init_arrays, gust_module_enabled
    607 
    608599    USE indices
    609600
    610     USE indoor_model_mod,                                                      &
    611         ONLY:  im_init
    612 
    613601    USE kinds
    614 
    615     USE land_surface_model_mod,                                                &
    616         ONLY:  lsm_init, lsm_init_arrays
    617602
    618603    USE lpm_init_mod,                                                          &
     
    620605 
    621606    USE lsf_nudging_mod,                                                       &
    622         ONLY:  lsf_init, ls_forcing_surf, nudge_init
     607        ONLY:  ls_forcing_surf
    623608
    624609    USE model_1d_mod,                                                          &
    625610        ONLY:  init_1d_model, l1d, u1d, v1d
     611
     612    USE module_interface,                                                      &
     613        ONLY:  module_interface_init_arrays, module_interface_init
    626614
    627615    USE multi_agent_system_mod,                                                &
     
    638626        ONLY:  nesting_offl_init
    639627
    640     USE ocean_mod,                                                             &
    641         ONLY:  ocean_init, ocean_init_arrays
    642 
    643628    USE particle_attributes,                                                   &
    644629        ONLY:  particle_advection
    645630
    646631    USE pegrid
    647 
    648     USE plant_canopy_model_mod,                                                &
    649         ONLY:  pcm_init
    650632
    651633#if defined( __parallel )
     
    655637
    656638    USE radiation_model_mod,                                                   &
    657         ONLY:  average_radiation,                                              &
    658                radiation_init, radiation, radiation_scheme,                    &
    659                radiation_calc_svf, radiation_write_svf,                        &
    660                radiation_interaction, radiation_interactions,                  &
    661                radiation_interaction_init, radiation_read_svf,                 &
    662                radiation_presimulate_solar_pos, radiation_interactions_on
    663    
     639        ONLY:  radiation, radiation_scheme
     640
    664641    USE random_function_mod
    665    
     642
    666643    USE random_generator_parallel,                                             &
    667644        ONLY:  init_parallel_random_generator
    668        
     645
    669646    USE read_restart_data_mod,                                                 &
    670         ONLY:  rrd_read_parts_of_global, rrd_local   
    671              
    672     USE salsa_mod,                                                             &
    673         ONLY:  salsa_init, salsa_init_arrays     
    674    
     647        ONLY:  rrd_read_parts_of_global, rrd_local
     648
    675649    USE statistics,                                                            &
    676650        ONLY:  hom, hom_sum, mean_surface_level_height, pr_palm, rmask,        &
     
    682656        ONLY:  parametrize_inflow_turbulence, stg_adjust, stg_init,            &
    683657               use_syn_turb_gen
    684                
     658
    685659    USE surface_layer_fluxes_mod,                                              &
    686660        ONLY:  init_surface_layer_fluxes
     
    689663        ONLY :  init_surface_arrays, init_surfaces, surf_def_h, surf_lsm_h,    &
    690664                surf_usm_h, get_topography_top_index_ji, vertical_surfaces_exist
    691    
     665
    692666    USE surface_data_output_mod,                                               &
    693667        ONLY:  surface_data_output_init
    694    
     668
    695669    USE transpose_indices
    696670
    697671    USE turbulence_closure_mod,                                                &
    698672        ONLY:  tcm_init_arrays, tcm_init
    699 
    700     USE urban_surface_mod,                                                     &
    701         ONLY:  usm_init_urban_surface, usm_allocate_surface
    702 
    703     USE virtual_measurement_mod,                                               &
    704         ONLY:  vm_init
    705 
    706     USE wind_turbine_model_mod,                                                &
    707         ONLY:  wtm_init, wtm_init_arrays
    708673
    709674    IMPLICIT NONE
     
    10761041!
    10771042!-- Allocate arrays for other modules
    1078     IF ( bulk_cloud_model    )  CALL bcm_init_arrays
    1079     IF ( gust_module_enabled )  CALL gust_init_arrays
    1080     IF ( land_surface        )  CALL lsm_init_arrays
    1081     IF ( ocean_mode          )  CALL ocean_init_arrays
    1082     IF ( salsa               )  CALL salsa_init_arrays
    1083     IF ( wind_turbine        )  CALL wtm_init_arrays
    1084 
    1085 !
    1086 !-- Initialize virtual flight measurements
    1087     IF ( virtual_flight )  THEN
    1088        CALL flight_init
    1089     ENDIF
     1043    CALL module_interface_init_arrays
    10901044
    10911045
     
    20982052       ENDIF
    20992053    ENDIF
    2100 !
    2101 !-- User-defined initializing actions
    2102     CALL user_init
    21032054!
    21042055!-- To do: New concept for these non-topography grid points!
     
    22052156    DEALLOCATE( mean_surface_level_height_l, ngp_2dh_l, ngp_2dh_outer_l,       &
    22062157                ngp_3d_inner_l, ngp_3d_inner_tmp )
    2207 
    2208 !
    2209 !-- Initialize nudging if required
    2210     IF ( nudging )  CALL nudge_init
    2211 !
    2212 !-- Initialize 1D large-scale forcing and nudging and read data from external
    2213 !-- ASCII file
    2214     IF ( large_scale_forcing )  CALL lsf_init
    22152158!
    22162159!-- Initialize surface forcing corresponding to large-scale forcing. Therein,
     
    22502193
    22512194!
    2252 !-- If required, initialize quantities needed for the plant canopy model
    2253     IF ( plant_canopy )  THEN
    2254        CALL location_message( 'initializing plant canopy model', .FALSE. )   
    2255        CALL pcm_init
    2256        CALL location_message( 'finished', .TRUE. )
    2257     ENDIF
    2258 
    2259 !
    22602195!-- If required, initialize dvrp-software
    22612196    IF ( dt_dvrp /= 9999999.9_wp )  CALL init_dvrp
    2262 
    2263 !
    2264 !-- Initialize quantities needed for the ocean model
    2265     IF ( ocean_mode )  CALL ocean_init
    22662197
    22672198!
     
    22812212             WRITE( message_string, * )  'absolute temperature < 0.0 at zu(', k, &
    22822213                                         ') = ', zu(k)
    2283              CALL message( 'init_bulk_cloud_model', 'PA0142', 1, 2, 0, 6, 0 )
     2214             CALL message( 'init_3d_model', 'PA0142', 1, 2, 0, 6, 0 )
    22842215          ENDIF
    22852216       ENDDO
     
    22962227
    22972228    ENDIF
    2298 !
    2299 !-- If required, initialize quantities needed for the microphysics module
    2300     IF ( bulk_cloud_model )  THEN
    2301        CALL bcm_init
    2302     ENDIF
    23032229
    23042230!
    23052231!-- If required, initialize particles
    23062232    IF ( particle_advection )  CALL lpm_init
    2307 
    23082233!
    23092234!-- If required, initialize particles
    23102235    IF ( agents_active )  CALL mas_init
    2311 
    2312 !
    2313 !-- If required, initialize quantities needed for the LSM
    2314     IF ( land_surface )  THEN
    2315        CALL location_message( 'initializing land surface model', .FALSE. )
    2316        CALL lsm_init
    2317        CALL location_message( 'finished', .TRUE. )
    2318     ENDIF
    2319 
    2320 !
    2321 !-- If required, allocate USM and LSM surfaces
    2322     IF ( urban_surface )  THEN
    2323        CALL location_message( 'initializing and allocating urban surfaces', .FALSE. )
    2324        CALL usm_allocate_surface
    2325        CALL location_message( 'finished', .TRUE. )
    2326     ENDIF
    2327 !
    2328 !-- If required, initialize urban surface model
    2329     IF ( urban_surface )  THEN
    2330        CALL location_message( 'initializing urban surface model', .FALSE. )
    2331        CALL usm_init_urban_surface
    2332        CALL location_message( 'finished', .TRUE. )
    2333     ENDIF
    2334 
    2335 !
    2336 !-- Initialize surface layer (done after LSM as roughness length are required
    2337 !-- for initialization
    2338     IF ( constant_flux_layer )  THEN
    2339        CALL location_message( 'initializing surface layer', .FALSE. )
    2340        CALL init_surface_layer_fluxes
    2341        CALL location_message( 'finished', .TRUE. )
    2342     ENDIF
    23432236!
    23442237!-- In case the synthetic turbulence generator does not have any information
     
    23472240!-- Please note, within pre-determined time intervals these turbulence
    23482241!-- information can be updated if desired.
    2349     IF ( use_syn_turb_gen  .AND.  parametrize_inflow_turbulence )              &
     2242    IF ( use_syn_turb_gen  .AND.  parametrize_inflow_turbulence )  THEN
    23502243       CALL stg_adjust
    2351 !
    2352 !-- If required, set chemical emissions
    2353 !-- Initialize values of cssws according to chemistry emission values
    2354     IF ( air_chemistry  .AND.  do_emis )  THEN
    2355        CALL chem_emissions_init( chem_emis_att, chem_emis, nspec_out )
    2356     ENDIF
    2357 !
    2358 !-- Initialize radiation processes
    2359     IF ( radiation )  THEN
    2360 !
    2361 !--    Activate radiation_interactions according to the existence of vertical surfaces and/or trees.
    2362 !--    The namelist parameter radiation_interactions_on can override this behavior.
    2363 !--    (This check cannot be performed in check_parameters, because vertical_surfaces_exist is first set in
    2364 !--    init_surface_arrays.)
    2365        IF ( radiation_interactions_on )  THEN
    2366           IF ( vertical_surfaces_exist  .OR.  plant_canopy )  THEN
    2367              radiation_interactions    = .TRUE.
    2368              average_radiation         = .TRUE.
    2369           ELSE
    2370              radiation_interactions_on = .FALSE.   !< reset namelist parameter: no interactions
    2371                                                    !< calculations necessary in case of flat surface
    2372           ENDIF
    2373        ELSEIF ( vertical_surfaces_exist  .OR.  plant_canopy )  THEN
    2374           message_string = 'radiation_interactions_on is set to .FALSE. although '     // &
    2375                            'vertical surfaces and/or trees exist. The model will run ' // &
    2376                            'without RTM (no shadows, no radiation reflections)'
    2377           CALL message( 'init_3d_model', 'PA0348', 0, 1, 0, 6, 0 )
    2378        ENDIF
    2379 !
    2380 !--    If required, initialize radiation interactions between surfaces
    2381 !--    via sky-view factors. This must be done before radiation is initialized.
    2382        IF ( radiation_interactions )  CALL radiation_interaction_init
    2383 
    2384 !
    2385 !--    Initialize radiation model
    2386        CALL location_message( 'initializing radiation model', .FALSE. )
    2387        CALL radiation_init
    2388        CALL location_message( 'finished', .TRUE. )
    2389 
    2390 !
    2391 !--    Find all discretized apparent solar positions for radiation interaction.
    2392 !--    This must be done after radiation_init.
    2393        IF ( radiation_interactions )  CALL radiation_presimulate_solar_pos
    2394 
    2395 !
    2396 !--    If required, read or calculate and write out the SVF
    2397        IF ( radiation_interactions .AND. read_svf)  THEN
    2398 !
    2399 !--       Read sky-view factors and further required data from file
    2400           CALL location_message( '    Start reading SVF from file', .FALSE. )
    2401           CALL radiation_read_svf()
    2402           CALL location_message( '    Reading SVF from file has finished', .TRUE. )
    2403 
    2404        ELSEIF ( radiation_interactions .AND. .NOT. read_svf)  THEN
    2405 !
    2406 !--       calculate SFV and CSF
    2407           CALL location_message( '    Start calculation of SVF', .FALSE. )
    2408           CALL radiation_calc_svf()
    2409           CALL location_message( '    Calculation of SVF has finished', .TRUE. )
    2410        ENDIF
    2411 
    2412        IF ( radiation_interactions .AND. write_svf)  THEN
    2413 !
    2414 !--       Write svf, csf svfsurf and csfsurf data to file
    2415           CALL location_message( '    Start writing SVF in file', .FALSE. )
    2416           CALL radiation_write_svf()
    2417           CALL location_message( '    Writing SVF in file has finished', .TRUE. )
    2418        ENDIF
    2419 
    2420 !
    2421 !--    Adjust radiative fluxes. In case of urban and land surfaces, also
    2422 !--    call an initial interaction.
    2423        IF ( radiation_interactions )  THEN
    2424           CALL radiation_interaction
    2425        ENDIF
    2426     ENDIF
    2427  
    2428 !
    2429 !-- If required, initialize quantities needed for the wind turbine model
    2430     IF ( wind_turbine )  THEN
    2431        CALL location_message( 'initializing wind turbine model', .FALSE. )
    2432        CALL wtm_init
    2433        CALL location_message( 'finished', .TRUE. )
    2434     ENDIF
    2435 
    2436 !
    2437 !-- If required, initialize quantities needed in SALSA
    2438     IF ( salsa )  THEN
    2439        CALL location_message( 'initializing SALSA model', .TRUE. )
    2440        CALL salsa_init
    2441        CALL location_message( 'finished', .TRUE. )
    2442     ENDIF
    2443 
    2444 !
    2445 !-- If required, initialize quantities needed for the gust module
    2446     IF ( gust_module_enabled )  THEN
    2447        CALL gust_init( dots_label, dots_unit, dots_num, dots_max )
    2448     ENDIF
     2244    ENDIF
     2245!
     2246!-- Initializing actions for all other modules
     2247    CALL module_interface_init
     2248!
     2249!-- Initialize surface layer (done after LSM as roughness length are required
     2250!-- for initialization
     2251    IF ( constant_flux_layer )  CALL init_surface_layer_fluxes
    24492252!
    24502253!-- Initialize surface data output
    2451     IF ( surface_output )  THEN
    2452        CALL surface_data_output_init
    2453     ENDIF
    2454 !
    2455 !-- If virtual measurements should be taken, initialize all relevant
    2456 !-- arrays and quantities.
    2457     IF ( virtual_measurement )  CALL vm_init
    2458 
    2459 !
    2460 !-- If required initialize biometeorology module
    2461     IF ( biometeorology )  THEN
    2462         CALL location_message( 'initializing biometeorology module', .FALSE. )
    2463         CALL bio_init
    2464         CALL location_message( 'finished', .TRUE. )
    2465     ENDIF
    2466 
    2467 !
    2468 !-- If required, initialize indoor model
    2469     IF ( indoor_model )  THEN
    2470        CALL location_message( 'initializing indoor model', .FALSE. )
    2471        CALL im_init
    2472        CALL location_message( 'finished', .TRUE. )
    2473     ENDIF
    2474 
     2254    IF ( surface_output )  CALL surface_data_output_init
    24752255!
    24762256!-- Initialize the ws-scheme.   
Note: See TracChangeset for help on using the changeset viewer.