Ignore:
Timestamp:
Dec 14, 2017 5:12:51 PM (6 years ago)
Author:
kanani
Message:

Merge of branch palm4u into trunk

Location:
palm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk

  • palm/trunk/SOURCE

  • palm/trunk/SOURCE/time_integration.f90

    r2617 r2696  
    11!> @file time_integration.f90
    22!------------------------------------------------------------------------------!
    3 ! This file is part of PALM.
     3! This file is part of the PALM model system.
    44!
    55! PALM is free software: you can redistribute it and/or modify it under the
     
    2525! -----------------
    2626! $Id$
     27! - Implementation of uv exposure model (FK)
     28! - Moved vnest_boundary_conds_khkm from tcm_diffusivities to here (TG)
     29! - renamed diffusivities to tcm_diffusivities (TG)
     30! - implement prognostic equation for diss (TG)
     31! - Moved/commented CALL to chem_emissions (FK)
     32! - Added CALL to chem_emissions (FK)
     33! - Implementation of chemistry module (FK)
     34! - Calls for setting boundary conditions in USM and LSM (MS)
     35! - Large-scale forcing with larger-scale models implemented (MS)
     36! - Rename usm_radiation into radiation_interactions; merge with branch
     37!   radiation (MS)
     38! - added call for usm_green_heat_model for green building surfaces (RvT)
     39! - added call for usm_temperature_near_surface for use in indoor model (RvT)
     40!
     41! 2617 2017-11-16 12:47:24Z suehring
    2742! Bugfix, assure that the reference state does not become zero.
    2843!
     
    287302
    288303    USE arrays_3d,                                                             &
    289         ONLY:  diss, dzu, e, e_p, nc, nc_p, nr, nr_p, prho, pt, pt_p, pt_init, &
     304        ONLY:  diss, diss_p, dzu, e, e_p, nc, nc_p, nr, nr_p, prho, pt, pt_p, pt_init, &
    290305               q_init, q, qc, qc_p, ql, ql_c, ql_v, ql_vp, qr, qr_p, q_p,      &
    291306               ref_state, rho_ocean, s, s_p, sa_p, tend, u, u_p, v, vpt,       &
     
    295310        ONLY:  calc_mean_profile
    296311
     312#if defined( __chem )
     313    USE chemistry_model_mod,                                                   &
     314        ONLY:  chem_emissions, chem_species
     315
     316    USE chem_modules,                                                          &
     317        ONLY:  nspec
     318#endif
     319
    297320    USE control_parameters,                                                    &
    298         ONLY:  advected_distance_x, advected_distance_y, average_count_3d,     &
    299                averaging_interval, averaging_interval_pr,                      &
     321        ONLY:  advected_distance_x, advected_distance_y, air_chemistry,        &
     322               average_count_3d, averaging_interval, averaging_interval_pr,    &
    300323               bc_lr_cyc, bc_ns_cyc, bc_pt_t_val,                              &
    301324               bc_q_t_val, call_psolver_at_all_substeps, cloud_droplets,       &
     
    307330               dt_coupling, dt_data_output_av, dt_disturb, dt_do2d_xy,         &
    308331               dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr,   &
    309                dt_dopr_listing, dt_dots, dt_dvrp, dt_run_control,              &
    310                end_time, first_call_lpm, galilei_transformation, humidity,     &
     332               dt_dopr_listing, dt_dots, dt_dvrp, dt_run_control, end_time,    &
     333               first_call_lpm, forcing, galilei_transformation, humidity,      &
    311334               intermediate_timestep_count, intermediate_timestep_count_max,   &
    312335               land_surface, large_scale_forcing,                              &
     
    316339               ocean, passive_scalar,                                          &
    317340               prho_reference, pt_reference, pt_slope_offset, random_heatflux, &
    318                run_coupled, simulated_time, simulated_time_chr,                &
     341               rans_tke_e, run_coupled, simulated_time, simulated_time_chr,    &
    319342               skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,        &
    320343               skip_time_do3d, skip_time_domask, skip_time_dopr,               &
     
    328351               turbulent_inflow, turbulent_outflow, urban_surface,             &
    329352               use_initial_profile_as_reference,                               &
    330                use_single_reference_value, u_gtrans, v_gtrans, virtual_flight, &
    331                wind_turbine, ws_scheme_mom, ws_scheme_sca
     353               use_single_reference_value, uv_exposure, u_gtrans, v_gtrans,    &
     354               virtual_flight, wind_turbine, ws_scheme_mom, ws_scheme_sca
    332355
    333356    USE cpulog,                                                                &
     
    349372
    350373    USE land_surface_model_mod,                                                &
    351         ONLY:  lsm_energy_balance, lsm_soil_model,                             &
     374        ONLY:  lsm_boundary_condition, lsm_energy_balance, lsm_soil_model,     &
    352375               skip_time_do_lsm
    353376
    354377    USE lsf_nudging_mod,                                                       &
    355         ONLY:  calc_tnudge, ls_forcing_surf, ls_forcing_vert, nudge_ref
     378        ONLY:  calc_tnudge, ls_forcing_surf, ls_forcing_vert, nudge_ref,       &
     379               forcing_bc, forcing_bc_mass_conservation
     380
     381    USE netcdf_data_input_mod,                                                 &
     382        ONLY:  force, netcdf_data_input_lsf
    356383
    357384    USE microphysics_mod,                                                      &
     
    368395               pmci_ensure_nest_mass_conservation, pmci_synchronize
    369396
    370     USE production_e_mod,                                                      &
    371         ONLY:  production_e_init
    372 
    373397    USE progress_bar,                                                          &
    374398        ONLY:  finish_progress_bar, output_progress_bar
     
    379403    USE radiation_model_mod,                                                   &
    380404        ONLY: dt_radiation, force_radiation_call, radiation, radiation_control,&
     405              radiation_interaction, radiation_interactions,                   &
    381406              skip_time_do_radiation, time_radiation
    382407
     
    395420        ONLY:  surf_def_h, surf_lsm_h, surf_usm_h
    396421
     422    USE turbulence_closure_mod,                                                &
     423        ONLY:  tcm_diffusivities, production_e_init
     424
    397425    USE urban_surface_mod,                                                     &
    398         ONLY:  usm_material_heat_model, usm_material_model,                    &
    399                usm_radiation, usm_surface_energy_balance
     426        ONLY:  usm_boundary_condition, usm_material_heat_model,                &
     427               usm_material_model,                                             &
     428               usm_surface_energy_balance, usm_green_heat_model,               &
     429               usm_temperature_near_surface
    400430
    401431    USE synthetic_turbulence_generator_mod,                                    &
     
    404434    USE user_actions_mod,                                                      &
    405435        ONLY:  user_actions
     436
     437    USE uv_exposure_model_mod,                                                 &
     438        ONLY:  uvem_calc_exposure
    406439
    407440    USE wind_turbine_model_mod,                                                &
     
    417450
    418451    CHARACTER (LEN=9) ::  time_to_string          !<
     452    INTEGER           ::  n
     453    INTEGER           ::  lsp
    419454
    420455    REAL(wp) ::  dt_3d_old  !< temporary storage of timestep to be used for
    421456                            !< steering of run control output interval
    422 
    423457!
    424458!-- At beginning determine the first time step
     
    501535           bc_q_t_val  = ( q_init(nzt+1) - q_init(nzt) ) / dzu(nzt+1)
    502536       ENDIF
     537!
     538!--    If forcing by larger-scale models is applied, check if new data
     539!--    at domain boundaries need to be read.
     540       IF ( forcing )  THEN
     541          IF ( force%time(force%tind_p) <= simulated_time )                    &
     542             CALL netcdf_data_input_lsf
     543       ENDIF
    503544
    504545!
     
    617658          CALL exchange_horiz( pt_p, nbgp )
    618659          IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e_p, nbgp )
     660          IF ( rans_tke_e  .OR.  wang_kernel  .OR.  collision_turbulence       &
     661               .OR.  use_sgs_for_particles )  THEN
     662             IF ( rans_tke_e )  THEN
     663                CALL exchange_horiz( diss_p, nbgp )
     664             ELSE
     665                CALL exchange_horiz( diss, nbgp )
     666             ENDIF
     667          ENDIF
    619668          IF ( ocean )  THEN
    620669             CALL exchange_horiz( sa_p, nbgp )
     
    639688             CALL exchange_horiz( ql_vp, nbgp )
    640689          ENDIF
    641           IF ( wang_kernel  .OR.  collision_turbulence  .OR.                &
    642                use_sgs_for_particles )  THEN
    643              CALL exchange_horiz( diss, nbgp )
    644           ENDIF
    645690          IF ( passive_scalar )  CALL exchange_horiz( s_p, nbgp )
    646 
     691#if defined( __chem )
     692          IF ( air_chemistry )  THEN
     693             DO  n = 1, nspec     
     694                CALL exchange_horiz( chem_species(n)%conc_p, nbgp )
     695             ENDDO
     696          ENDIF
     697#endif
    647698          CALL cpu_log( log_point(26), 'exchange-horiz-progn', 'stop' )
    648699
     
    756807                   CALL disturb_field( 'v', tend, v )
    757808                ELSEIF ( ( .NOT. bc_lr_cyc  .OR.  .NOT. bc_ns_cyc )            &
    758                      .AND. .NOT. nest_domain )  THEN
     809                     .AND. .NOT. nest_domain  .AND.  .NOT.  forcing )  THEN
    759810!
    760811!--                Runs with a non-cyclic lateral wall need perturbations
     
    770821
    771822!
     823!--       Map forcing data derived from larger scale model onto domain
     824!--       boundaries.
     825          IF ( forcing  .AND.  intermediate_timestep_count ==                  &
     826                               intermediate_timestep_count_max  )  THEN
     827             CALL forcing_bc
     828          ENDIF
     829!
     830!--       Moreover, ensure mass conservation at each RK substep.
     831          IF ( forcing )  CALL forcing_bc_mass_conservation
     832
     833!
    772834!--       Reduce the velocity divergence via the equation for perturbation
    773835!--       pressure.
     
    833895                CALL cpu_log( log_point(19), 'surface_layer_fluxes', 'stop' )
    834896             ENDIF
    835 
    836897!
    837898!--          If required, solve the energy balance for the surface and run soil
    838899!--          model. Call for horizontal as well as vertical surfaces
    839              IF ( land_surface .AND. time_since_reference_point > skip_time_do_lsm)  THEN
     900             IF ( land_surface .AND. time_since_reference_point >= skip_time_do_lsm)  THEN
    840901
    841902                CALL cpu_log( log_point(54), 'land_surface', 'start' )
     
    860921                CALL lsm_energy_balance( .FALSE., 3 )
    861922                CALL lsm_soil_model( .FALSE., 3, .TRUE. )
     923!
     924!--             At the end, set boundary conditons for potential temperature
     925!--             and humidity after running the land-surface model. This
     926!--             might be important for the nesting, where arrays are transfered.
     927                CALL lsm_boundary_condition
    862928
    863929                CALL cpu_log( log_point(54), 'land_surface', 'stop' )
    864930             ENDIF
    865 
    866931!
    867932!--          If required, solve the energy balance for urban surfaces and run
     
    871936                CALL usm_surface_energy_balance
    872937                IF ( usm_material_model )  THEN
     938                   CALL usm_green_heat_model
    873939                   CALL usm_material_heat_model
    874940                ENDIF
     941
     942                CALL usm_temperature_near_surface
     943!
     944!--             At the end, set boundary conditons for potential temperature
     945!--             and humidity after running the urban-surface model. This
     946!--             might be important for the nesting, where arrays are transfered.
     947                CALL usm_boundary_condition
     948
    875949                CALL cpu_log( log_point(74), 'urban_surface', 'stop' )
    876950             ENDIF
    877 
    878951!
    879952!--          Compute the diffusion coefficients
     
    881954             IF ( .NOT. humidity ) THEN
    882955                IF ( ocean )  THEN
    883                    CALL diffusivities( prho, prho_reference )
     956                   CALL tcm_diffusivities( prho, prho_reference )
    884957                ELSE
    885                    CALL diffusivities( pt, pt_reference )
     958                   CALL tcm_diffusivities( pt, pt_reference )
    886959                ENDIF
    887960             ELSE
    888                 CALL diffusivities( vpt, pt_reference )
    889              ENDIF
    890 
     961                CALL tcm_diffusivities( vpt, pt_reference )
     962             ENDIF
    891963             CALL cpu_log( log_point(17), 'diffusivities', 'stop' )
     964!
     965!--          Vertical nesting: set fine grid eddy viscosity top boundary condition
     966             IF ( vnest_init )  CALL vnest_boundary_conds_khkm
    892967
    893968          ENDIF
     
    914989                CALL cpu_log( log_point(50), 'radiation', 'stop' )
    915990
    916                 IF (urban_surface)  THEN
    917                    CALL cpu_log( log_point(75), 'usm_radiation', 'start' )
    918                    CALL usm_radiation
    919                    CALL cpu_log( log_point(75), 'usm_radiation', 'stop' )
     991                IF ( urban_surface  .OR.  land_surface  .AND.                  &
     992                     radiation_interactions )  THEN
     993                   CALL cpu_log( log_point(75), 'radiation_interaction', 'start' )
     994                   CALL radiation_interaction
     995                   CALL cpu_log( log_point(75), 'radiation_interaction', 'stop' )
    920996                ENDIF
    921997
     
    9241000
    9251001       ENDDO   ! Intermediate step loop
    926 
     1002!
     1003!--          If required, consider chemical emissions
     1004!--          (todo (FK): Implement hourly call of emissions, using time_utc from
     1005!--                      data_and_time_mod.f90;
     1006!--                      move the CALL to appropriate location)
     1007! #if defined( __chem )
     1008!              IF ( air_chemistry ) THEN
     1009!                 CALL chem_emissions
     1010!              ENDIF
     1011! #endif
     1012!
     1013!--    If required, do UV exposure calculations
     1014       IF ( uv_exposure )  THEN
     1015          CALL uvem_calc_exposure
     1016       ENDIF
    9271017!
    9281018!--    Increase simulation time and output times
Note: See TracChangeset for help on using the changeset viewer.