Ignore:
Timestamp:
Mar 20, 2020 4:14:41 PM (5 years ago)
Author:
suehring
Message:

Vector branch in advec_ws optimized, symmetric boundary conditions implemented in vector branch

File:
1 edited

Legend:

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

    r4457 r4466  
    2525! -----------------
    2626! $Id$
     27! Add advection fluxes to ACC copyin
     28!
     29! 4457 2020-03-11 14:20:43Z raasch
    2730! use statement for exchange horiz added
    28 ! 
     31!
    2932! 4444 2020-03-05 15:59:50Z raasch
    3033! bugfix: cpp-directives for serial mode added
    31 ! 
     34!
    3235! 4420 2020-02-24 14:13:56Z maronga
    3336! Added output control for wind turbine model
    34 ! 
     37!
    3538! 4403 2020-02-12 13:08:46Z banzhafs
    3639! Allowing both existing and on-demand emission read modes
     
    3841! 4360 2020-01-07 11:25:50Z suehring
    3942! Bugfix, hour_call_emis uninitialized at first call of time_integration
    40 ! 
     43!
    4144! 4346 2019-12-18 11:55:56Z motisi
    4245! Introduction of wall_flags_total_0, which currently sets bits based on static
    4346! topography information used in wall_flags_static_0
    44 ! 
     47!
    4548! 4329 2019-12-10 15:46:36Z motisi
    4649! Renamed wall_flags_0 to wall_flags_static_0
    47 ! 
     50!
    4851! 4281 2019-10-29 15:15:39Z schwenkel
    4952! Moved boundary conditions to module interface
    50 ! 
     53!
    5154! 4276 2019-10-28 16:03:29Z schwenkel
    5255! Further modularization of lpm code components
    53 ! 
     56!
    5457! 4275 2019-10-28 15:34:55Z schwenkel
    5558! Move call oft lpm to the end of intermediate timestep loop
     
    6063! 4227 2019-09-10 18:04:34Z gronemeier
    6164! implement new palm_date_time_mod
    62 ! 
     65!
    6366! 4226 2019-09-10 17:03:24Z suehring
    6467! Changes in interface for the offline nesting
    65 ! 
     68!
    6669! 4182 2019-08-22 15:20:23Z scharf
    6770! Corrected "Former revisions" section
    68 ! 
     71!
    6972! 4170 2019-08-19 17:12:31Z gronemeier
    7073! copy diss, diss_p, tdiss_m to GPU
    71 ! 
     74!
    7275! 4144 2019-08-06 09:11:47Z raasch
    7376! relational operators .EQ., .NE., etc. replaced by ==, /=, etc.
    74 ! 
     77!
    7578! 4126 2019-07-30 11:09:11Z gronemeier
    7679! renamed routine to calculate uv exposure
    77 ! 
     80!
    7881! 4111 2019-07-22 18:16:57Z suehring
    7982! advc_flags_1 / advc_flags_2 renamed to advc_flags_m / advc_flags_s
    80 ! 
     83!
    8184! 4069 2019-07-01 14:05:51Z Giersch
    82 ! Masked output running index mid has been introduced as a local variable to 
     85! Masked output running index mid has been introduced as a local variable to
    8386! avoid runtime error (Loop variable has been modified) in time_integration
    84 ! 
     87!
    8588! 4064 2019-07-01 05:33:33Z gronemeier
    8689! Moved call to radiation module out of intermediate time loop
    87 ! 
     90!
    8891! 4048 2019-06-21 21:00:21Z knoop
    8992! Moved production_e_init call into turbulence_closure_mod
    90 ! 
     93!
    9194! 4047 2019-06-21 18:58:09Z knoop
    9295! Added remainings of swap_timelevel upon its dissolution
    93 ! 
     96!
    9497! 4043 2019-06-18 16:59:00Z schwenkel
    9598! Further LPM modularization
     
    97100! 4039 2019-06-18 10:32:41Z suehring
    98101! Rename subroutines in module for diagnostic quantities
    99 ! 
     102!
    100103! 4029 2019-06-14 14:04:35Z raasch
    101104! exchange of ghost points and boundary conditions separated for chemical species and SALSA module,
    102105! bugfix: decycling of chemistry species after nesting data transfer
    103 ! 
     106!
    104107! 4022 2019-06-12 11:52:39Z suehring
    105108! Call synthetic turbulence generator at last RK3 substep right after boundary
    106 ! conditions are updated in offline nesting in order to assure that 
    107 ! perturbations are always imposed 
    108 ! 
     109! conditions are updated in offline nesting in order to assure that
     110! perturbations are always imposed
     111!
    109112! 4017 2019-06-06 12:16:46Z schwenkel
    110113! Mass (volume) flux correction included to ensure global mass conservation for child domains.
    111 ! 
     114!
    112115! 3994 2019-05-22 18:08:09Z suehring
    113116! output of turbulence intensity added
    114 ! 
     117!
    115118! 3988 2019-05-22 11:32:37Z kanani
    116119! Implement steerable output interval for virtual measurements
    117 ! 
     120!
    118121! 3968 2019-05-13 11:04:01Z suehring
    119122! replace nspec_out with n_matched_vars
    120 ! 
     123!
    121124! 3929 2019-04-24 12:52:08Z banzhafs
    122125! Reverse changes back from revision 3878: use chem_boundary_conds instead of
    123126! chem_boundary_conds_decycle
    124 ! 
    125 ! 
     127!
     128!
    126129! 3885 2019-04-11 11:29:34Z kanani
    127 ! Changes related to global restructuring of location messages and introduction 
     130! Changes related to global restructuring of location messages and introduction
    128131! of additional debug messages
    129132!
    130133! 3879 2019-04-08 20:25:23Z knoop
    131134! Moved wtm_forces to module_interface_actions
    132 ! 
     135!
    133136! 3872 2019-04-08 15:03:06Z knoop
    134137! Modifications made for salsa:
     
    136139!   salsa_emission_update (i.e. skip_time_do_salsa >= time_since_reference_point
    137140!   and next_aero_emission_update <= time_since_reference_point ).
    138 ! - Renamed nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and 
     141! - Renamed nbins --> nbins_aerosol, ncc_tot --> ncomponents_mass and
    139142!   ngast --> ngases_salsa and loop indices b, c and sg to ib, ic and ig
    140143! - Apply nesting for salsa variables
    141144! - Removed cpu_log calls speciffic for salsa.
    142 ! 
     145!
    143146! 3833 2019-03-28 15:04:04Z forkel
    144147! added USE chem_gasphase_mod, replaced nspec by nspec since fixed compounds are not integrated
    145 ! 
     148!
    146149! 3820 2019-03-27 11:53:41Z forkel
    147150! renamed do_emiss to emissions_anthropogenic (ecc)
    148 ! 
    149 ! 
     151!
     152!
    150153! 3774 2019-03-04 10:52:49Z moh.hefny
    151154! rephrase if statement to avoid unallocated array in case of
     
    155158! module section re-formatted and openacc required variables moved to separate section,
    156159! re-formatting to 100 char line width
    157 ! 
     160!
    158161! 3745 2019-02-15 18:57:56Z suehring
    159162! Call indoor model after first timestep
    160 ! 
     163!
    161164! 3744 2019-02-15 18:38:58Z suehring
    162165! - Moved call of bio_calculate_thermal_index_maps from biometeorology module to
    163166! time_integration to make sure averaged input is updated before calculating.
    164 ! 
     167!
    165168! 3739 2019-02-13 08:05:17Z dom_dwd_user
    166169! Removed everything related to "time_bio_results" as this is never used.
    167 ! 
     170!
    168171! 3724 2019-02-06 16:28:23Z kanani
    169 ! Correct double-used log_point_s unit 
    170 ! 
     172! Correct double-used log_point_s unit
     173!
    171174! 3719 2019-02-06 13:10:18Z kanani
    172175! - removed wind_turbine cpu measurement, since same time is measured inside
     
    176179!   moved radiation_interactions cpulog to special measures
    177180! - moved some cpu_log calls to this routine for better overview
    178 ! 
     181!
    179182! 3705 2019-01-29 19:56:39Z suehring
    180183! Data output for virtual measurements added
    181 ! 
     184!
    182185! 3704 2019-01-29 19:51:41Z suehring
    183186! Rename subroutines for surface-data output
    184 ! 
     187!
    185188! 3647 2019-01-02 14:10:44Z kanani
    186189! Bugfix: add time_since_reference_point to IF clause for data_output calls
     
    198201!------------------------------------------------------------------------------!
    199202 SUBROUTINE time_integration
    200  
     203
    201204
    202205    USE advec_ws,                                                                                  &
     
    400403               vm_time_start
    401404
    402                
     405
    403406    USE wind_turbine_model_mod,                                                                    &
    404407        ONLY:  dt_data_output_wtm, time_wtm, wind_turbine, wtm_data_output
     
    406409#if defined( _OPENACC )
    407410    USE arrays_3d,                                                                                 &
    408         ONLY:  d, dd2zu, ddzu, ddzw, drho_air, drho_air_zw, dzw, e, heatflux_output_conversion,    &
     411        ONLY:  d, dd2zu, ddzu, ddzw,                                                               &
     412               diss_l_u,                                                                           &
     413               diss_l_v,                                                                           &
     414               diss_l_w,                                                                           &
     415               diss_s_u,                                                                           &
     416               diss_s_v,                                                                           &
     417               diss_s_w,                                                                           &
     418               drho_air, drho_air_zw, dzw, e,                                                      &
     419               flux_l_u,                                                                           &
     420               flux_l_v,                                                                           &
     421               flux_l_w,                                                                           &
     422               flux_s_u,                                                                           &
     423               flux_s_v,                                                                           &
     424               flux_s_w,                                                                           &
     425               heatflux_output_conversion,                                                         &
    409426               kh, km, momentumflux_output_conversion, nc, nr, p, ptdf_x, ptdf_y, qc, qr, rdf,     &
    410427               rdf_sc, rho_air, rho_air_zw, s, tdiss_m, te_m, tpt_m, tu_m, tv_m, tw_m, ug, u_init, &
     
    453470!
    454471!-- Copy data from arrays_3d
    455 !$ACC DATA & 
     472!$ACC DATA &
    456473!$ACC COPY(d(nzb+1:nzt,nys:nyn,nxl:nxr)) &
    457474!$ACC COPY(diss(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     
    466483
    467484!$ACC DATA &
     485!$ACC COPYIN(diss_l_u(0:nz+1,nys:nyn,0), flux_l_u(0:nz+1,nys:nyn,0)) &
     486!$ACC COPYIN(diss_l_v(0:nz+1,nys:nyn,0), flux_l_v(0:nz+1,nys:nyn,0)) &
     487!$ACC COPYIN(diss_l_w(0:nz+1,nys:nyn,0), flux_l_w(0:nz+1,nys:nyn,0)) &
     488!$ACC COPYIN(diss_s_u(0:nz+1,0), flux_s_u(0:nz+1,0)) &
     489!$ACC COPYIN(diss_s_v(0:nz+1,0), flux_s_v(0:nz+1,0)) &
     490!$ACC COPYIN(diss_s_w(0:nz+1,0), flux_s_w(0:nz+1,0)) &
    468491!$ACC COPY(diss_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
    469492!$ACC COPY(e_p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) &
     
    569592    CALL run_control
    570593!
    571 !-- Data exchange between coupled models in case that a call has been omitted 
     594!-- Data exchange between coupled models in case that a call has been omitted
    572595!-- at the end of the previous run of a job chain.
    573596    IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled  .AND. .NOT. vnested )  THEN
    574597!
    575 !--    In case of model termination initiated by the local model the coupler 
    576 !--    must not be called because this would again cause an MPI hang. 
     598!--    In case of model termination initiated by the local model the coupler
     599!--    must not be called because this would again cause an MPI hang.
    577600       DO WHILE ( time_coupling >= dt_coupling  .AND.  terminate_coupled == 0 )
    578601          CALL surface_coupler
     
    606629
    607630!
    608 !--    Determine ug, vg and w_subs in dependence on data from external file 
     631!--    Determine ug, vg and w_subs in dependence on data from external file
    609632!--    LSF_DATA
    610633       IF ( large_scale_forcing .AND. lsf_vert )  THEN
     
    614637
    615638!
    616 !--    Set pt_init and q_init to the current profiles taken from 
    617 !--    NUDGING_DATA 
     639!--    Set pt_init and q_init to the current profiles taken from
     640!--    NUDGING_DATA
    618641       IF ( nudging )  THEN
    619642           CALL nudge_ref ( simulated_time )
     
    649672       ENDIF
    650673!
    651 !--    Input of boundary data. 
     674!--    Input of boundary data.
    652675       IF ( nesting_offline )  CALL nesting_offl_input
    653676!
    654677!--    Execute all other module actions routines
    655678       CALL module_interface_actions( 'before_timestep' )
    656        
     679
    657680!--    Start of intermediate step loop
    658681       intermediate_timestep_count = 0
     
    689712!
    690713!--          Assure that ref_state does not become zero at any level
    691 !--          ( might be the case if a vertical level is completely occupied 
     714!--          ( might be the case if a vertical level is completely occupied
    692715!--            with topography ).
    693716             ref_state = MERGE( MAXVAL(ref_state), ref_state, ref_state == 0.0_wp )
     
    856879                ENDIF
    857880
    858                 IF ( passive_scalar )  CALL exchange_horiz( s, nbgp ) 
     881                IF ( passive_scalar )  CALL exchange_horiz( s, nbgp )
    859882
    860883                IF ( .NOT. constant_diffusion )  CALL exchange_horiz( e, nbgp )
     
    866889                IF ( air_chemistry )  THEN
    867890                   DO  n = 1, nvar
    868                       CALL exchange_horiz( chem_species(n)%conc, nbgp ) 
     891                      CALL exchange_horiz( chem_species(n)%conc, nbgp )
    869892                   ENDDO
    870893                ENDIF
     
    973996
    974997!
    975 !--       Map forcing data derived from larger scale model onto domain 
     998!--       Map forcing data derived from larger scale model onto domain
    976999!--       boundaries. Further, update geostrophic wind components.
    9771000          IF ( nesting_offline  .AND.  intermediate_timestep_count ==                              &
    9781001                                       intermediate_timestep_count_max  )  THEN
    979 !--          Determine interpolation factor before boundary conditions and geostrophic wind 
     1002!--          Determine interpolation factor before boundary conditions and geostrophic wind
    9801003!--          is updated.
    9811004             CALL nesting_offl_interpolation_factor
     
    9941017!--       Ensure mass conservation. This need to be done after imposing
    9951018!--       synthetic turbulence and top boundary condition for pressure is set to
    996 !--       Neumann conditions. 
     1019!--       Neumann conditions.
    9971020!--       Is this also required in case of Dirichlet?
    9981021          IF ( nesting_offline )  CALL nesting_offl_mass_conservation
     
    10131036                CALL vnest_boundary_conds
    10141037                CALL cpu_log( log_point_s(30), 'vnest_bc', 'stop' )
    1015  
     1038
    10161039                IF ( coupling_mode == 'vnested_fine' )  CALL pres
    10171040
     
    10581081          ENDIF
    10591082!
    1060 !--       If required, compute virtual potential temperature 
    1061           IF ( humidity )  THEN 
    1062              CALL compute_vpt 
    1063           ENDIF 
     1083!--       If required, compute virtual potential temperature
     1084          IF ( humidity )  THEN
     1085             CALL compute_vpt
     1086          ENDIF
    10641087
    10651088!
     
    10681091
    10691092!
    1070 !--          Determine surface fluxes shf and qsws and surface values 
    1071 !--          pt_surface and q_surface in dependence on data from external 
     1093!--          Determine surface fluxes shf and qsws and surface values
     1094!--          pt_surface and q_surface in dependence on data from external
    10721095!--          file LSF_DATA respectively
    10731096             IF ( ( large_scale_forcing .AND. lsf_surf ) .AND.                                     &
     
    10781101
    10791102!
    1080 !--          First the vertical (and horizontal) fluxes in the surface 
     1103!--          First the vertical (and horizontal) fluxes in the surface
    10811104!--          (constant flux) layer are computed
    10821105             IF ( constant_flux_layer )  THEN
     
    10861109             ENDIF
    10871110!
    1088 !--          If required, solve the energy balance for the surface and run soil 
     1111!--          If required, solve the energy balance for the surface and run soil
    10891112!--          model. Call for horizontal as well as vertical surfaces
    10901113             IF ( land_surface .AND. time_since_reference_point >= skip_time_do_lsm)  THEN
     
    11141137!
    11151138!--             At the end, set boundary conditons for potential temperature
    1116 !--             and humidity after running the land-surface model. This 
     1139!--             and humidity after running the land-surface model. This
    11171140!--             might be important for the nesting, where arrays are transfered.
    11181141                CALL lsm_boundary_condition
     
    11221145             ENDIF
    11231146!
    1124 !--          If required, solve the energy balance for urban surfaces and run 
     1147!--          If required, solve the energy balance for urban surfaces and run
    11251148!--          the material heat model
    11261149             IF (urban_surface) THEN
     
    11351158!
    11361159!--             At the end, set boundary conditons for potential temperature
    1137 !--             and humidity after running the urban-surface model. This 
     1160!--             and humidity after running the urban-surface model. This
    11381161!--             might be important for the nesting, where arrays are transfered.
    11391162                CALL usm_boundary_condition
     
    12001223!
    12011224!--          Adjust the current time to the time step of the radiation model.
    1202 !--          Needed since radiation is pre-calculated and stored only on apparent 
     1225!--          Needed since radiation is pre-calculated and stored only on apparent
    12031226!--          solar positions
    12041227             time_since_reference_point_save = time_since_reference_point
     
    12131236                CALL cpu_log( log_point_s(46), 'radiation_interaction', 'stop' )
    12141237             ENDIF
    1215  
     1238
    12161239!
    12171240!--          Return the current time to its original value
     
    12231246       ENDIF
    12241247
    1225        
     1248
    12261249!
    12271250!-- 20200203 (ECC)
     
    12711294!--    dt_indoor steers the frequency of the indoor model calculations.
    12721295!--    Note, at first timestep indoor model is called, in order to provide
    1273 !--    a waste heat flux. 
     1296!--    a waste heat flux.
    12741297       IF ( indoor_model )  THEN
    12751298
     
    13421365          time_virtual_measurement = time_virtual_measurement + dt_3d
    13431366       ENDIF
    1344        
     1367
    13451368!
    13461369!--    Increment time-counter for wind turbine data output
     
    13481371          time_wtm = time_wtm + dt_3d
    13491372       ENDIF
    1350  
     1373
    13511374!
    13521375!--    In case of synthetic turbulence generation and parametrized turbulence
    1353 !--    information, update the time counter and if required, adjust the 
     1376!--    information, update the time counter and if required, adjust the
    13541377!--    STG to new atmospheric conditions.
    13551378       IF ( use_syn_turb_gen  )  THEN
     
    13711394
    13721395!
    1373 !--       In case of model termination initiated by the local model 
    1374 !--       (terminate_coupled > 0), the coupler must be skipped because it would 
     1396!--       In case of model termination initiated by the local model
     1397!--       (terminate_coupled > 0), the coupler must be skipped because it would
    13751398!--       cause an MPI intercomminucation hang.
    1376 !--       If necessary, the coupler will be called at the beginning of the 
     1399!--       If necessary, the coupler will be called at the beginning of the
    13771400!--       next restart run.
    13781401          DO WHILE ( time_coupling >= dt_coupling  .AND.  terminate_coupled == 0 )
     
    14691492                .AND.  ( dt_dosurf_av - time_dosurf_av ) <= averaging_interval_surf                &
    14701493                .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
    1471              IF ( time_dosurf_av >= dt_averaging_input )  THEN       
     1494             IF ( time_dosurf_av >= dt_averaging_input )  THEN
    14721495                CALL surface_data_output_averaging
    14731496                average_count_surf = average_count_surf + 1
     
    15021525                                          MAX( dt_virtual_measurement, dt_3d ) )
    15031526       ENDIF
    1504        
     1527
    15051528!
    15061529!--    Output wind turbine data
     
    15091532          time_wtm = MOD( time_wtm, MAX( dt_data_output_wtm, dt_3d ) )
    15101533       ENDIF
    1511        
     1534
    15121535!
    15131536!--    Profile output (ASCII) on file
     
    17071730#if defined( __parallel )
    17081731!
    1709 !-- Vertical nesting: Deallocate variables initialized for vertical nesting   
     1732!-- Vertical nesting: Deallocate variables initialized for vertical nesting
    17101733    IF ( vnest_init )  CALL vnest_deallocate
    17111734#endif
Note: See TracChangeset for help on using the changeset viewer.