Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 4679)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 4680)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! Add option to fix date or time of the simulation
+!
+! 4671 2020-09-09 20:27:58Z pavelkrc
 ! Implementation of downward facing USM and LSM surfaces
 !
@@ -198,5 +201,5 @@
 
     USE palm_date_time_mod,                                                                        &
-        ONLY:  set_reference_date_time
+        ONLY:  init_date_time
 
     USE pegrid
@@ -292,5 +295,7 @@
 !
 !-- Set reference date-time
-    CALL set_reference_date_time( date_time_str=origin_date_time )
+    CALL init_date_time( date_time_str=origin_date_time,                                           &
+                         use_fixed_date=use_fixed_date,                                            &
+                         use_fixed_time=use_fixed_time )
 
     IF ( debug_output )  CALL debug_message( 'allocating arrays', 'start' )
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 4679)
+++ /palm/trunk/SOURCE/modules.f90	(revision 4680)
@@ -25,9 +25,12 @@
 ! -----------------
 ! $Id$
+! Add option to fix date or time of the simulation
+!
+! 4658 2020-08-28 18:15:50Z suehring
 ! Change default value of dt_spinup
 !
 ! 4629 2020-07-29 09:37:56Z raasch
 ! support for MPI Fortran77 interface (mpif.h) removed
-! 
+!
 ! 4581 2020-06-29 08:49:58Z suehring
 ! +sums_wschs_ws_l
@@ -848,4 +851,6 @@
     LOGICAL ::  urban_surface = .FALSE.                          !< use urban surface model?
     LOGICAL ::  use_cmax = .TRUE.                                !< namelist parameter
+    LOGICAL ::  use_fixed_date = .FALSE.                         !< date of simulation does not change (namelist parameter)
+    LOGICAL ::  use_fixed_time = .FALSE.                         !< time of simulation does not change (namelist parameter)
     LOGICAL ::  use_free_convection_scaling = .FALSE.            !< namelist parameter to switch on free convection velocity scale in calculation of horizontal wind speed (surface_layer_fluxes)
     LOGICAL ::  use_initial_profile_as_reference = .FALSE.       !< use of initial profiles as reference state?
Index: /palm/trunk/SOURCE/palm_date_time_mod.f90
===================================================================
--- /palm/trunk/SOURCE/palm_date_time_mod.f90	(revision 4679)
+++ /palm/trunk/SOURCE/palm_date_time_mod.f90	(revision 4680)
@@ -1,30 +1,32 @@
 !> @file palm_date_time_mod.f90
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! This file is part of the PALM model system.
 !
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
+! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
+! Public License as published by the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+! Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along with PALM. If not, see
+! <http://www.gnu.org/licenses/>.
 !
 ! Copyright 1997-2020 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Add option to fix date and time; renamed set_reference_date_time to init_date_time
+!
+! 4360 2020-01-07 11:25:50Z suehring
 ! Add days of northward- and southward equinox
-! 
+!
 ! 4227 2019-09-10 18:04:34Z gronemeier
 ! Complete rework of module date_and_time_mod:
@@ -48,10 +50,10 @@
 !>
 !> @todo Consider leap seconds
-!> @note Time_zone only supports full-hour time zones, i.e., time zones like
-!>       Australian Central Standard Time (UTC+9.5) are not possible
-!------------------------------------------------------------------------------!
+!> @note Time_zone only supports full-hour time zones, i.e., time zones like Australian Central
+!>       Standard Time (UTC+9.5) are not possible
+!--------------------------------------------------------------------------------------------------!
  MODULE palm_date_time_mod
 
-    USE control_parameters,                                                    &
+    USE control_parameters,                                                                        &
          ONLY:  message_string
 
@@ -68,8 +70,7 @@
     INTEGER(iwp), PARAMETER ::  months_per_year    = 12_iwp                                 !< months in a year
 !
-!-- Definition of mean northward and southward equinox (summer and winter half year) 
-!-- in days of year. For simplicity, March 21 and September 21 is assumed.
-    INTEGER(iwp), PARAMETER ::  northward_equinox  = 80_iwp
-    INTEGER(iwp), PARAMETER ::  southward_equinox  = 264_iwp
+!-- Day of year of the mean northward and southward equinox (summer and winter half year)
+    INTEGER(iwp), PARAMETER ::  northward_equinox  = 80_iwp                                 !< Mar 21 (leap year: Mar 20)
+    INTEGER(iwp), PARAMETER ::  southward_equinox  = 264_iwp                                !< Sep 21 (leap year: Sep 20)
 
     REAL(wp),     PARAMETER ::  seconds_per_minute = 60.0_wp                                !< seconds in a minute
@@ -124,5 +125,7 @@
 !
 !-- Variable Declaration
+    LOGICAL              ::  date_is_fixed              = .FALSE.  !< if true, date is fixed (time can still change)
     LOGICAL              ::  reference_date_time_is_set = .FALSE.  !< true if reference_date_time is set
+    LOGICAL              ::  time_is_fixed              = .FALSE.  !< if true, time does not change at all
 
     TYPE(date_time_type) ::  reference_date_time                   !< reference date-time
@@ -133,7 +136,7 @@
 !
 !-- Set reference date and time
-    INTERFACE set_reference_date_time
-        MODULE PROCEDURE set_reference_date_time
-    END INTERFACE set_reference_date_time
+    INTERFACE init_date_time
+        MODULE PROCEDURE init_date_time
+    END INTERFACE init_date_time
 !
 !-- Return date and time information
@@ -145,5 +148,5 @@
     PUBLIC &
        get_date_time, &
-       set_reference_date_time
+       init_date_time
 !
 !-- Public variables
@@ -167,11 +170,14 @@
 ! Description:
 ! ------------
-!> Set reference date-time.
+!> Initialize date-time setting by defining a global reference date-time and choosing a variable or
+!> fixed date.
 !> Only a single call is allowed to this routine during execution.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE set_reference_date_time( date_time_str )
+ SUBROUTINE init_date_time( date_time_str, use_fixed_date, use_fixed_time )
 
     CHARACTER(LEN=date_time_str_len), INTENT(IN) ::  date_time_str  !< string containing date-time information
 
+    LOGICAL, INTENT(IN), OPTIONAL ::  use_fixed_date  !< flag to fix date
+    LOGICAL, INTENT(IN), OPTIONAL ::  use_fixed_time  !< flag to fix time
 !
 !-- Check if date and time are already set
@@ -179,7 +185,7 @@
        !> @note This error should never be observed by a user.
        !>       It can only appear if the code was modified.
-       WRITE( message_string, * ) 'Multiple calls to set_reference_date_time detected.&' //  &
-                                  'The reference date-time must be set only once.'
-       CALL message( 'set_reference_date_time', 'PA0680', 2, 2, 0, 6, 0 )
+       WRITE( message_string, * ) 'Multiple calls to init_date_time detected.&' //  &
+                                  'This routine must not be called more than once.'
+       CALL message( 'init_date_time', 'PA0680', 2, 2, 0, 6, 0 )
        RETURN
 
@@ -190,7 +196,10 @@
        reference_date_time_is_set = .TRUE.
 
-    ENDIF
-
- END SUBROUTINE set_reference_date_time
+       IF ( PRESENT( use_fixed_date ) )  date_is_fixed = use_fixed_date
+       IF ( PRESENT( use_fixed_time ) )  time_is_fixed = use_fixed_time
+
+    ENDIF
+
+ END SUBROUTINE init_date_time
 
 
@@ -201,5 +210,5 @@
 !> An alternative reference date-time string can be specified via 'reference_date_time_str'.
 !> Call to this routine is only possible if a reference time is either specified in the call itself
-!> via 'reference_date_time_str' or previously set by calling routine 'set_reference_date_time'.
+!> via 'reference_date_time_str' or previously set by calling routine 'init_date_time'.
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE get_date_time( time_since_reference, reference_date_time_str,    &
@@ -241,5 +250,5 @@
                                   'Returning date-time information is not possible. ' // &
                                   'Either specify reference_date_time_str ' //           &
-                                  'or set a reference via set_reference_date_time.'
+                                  'or set a reference via init_date_time.'
        CALL message( 'get_date_time', 'PA0677', 2, 2, 0, 6, 0 )
        RETURN
@@ -252,7 +261,31 @@
        internal_reference_date_time = reference_date_time
     ENDIF
-!
-!-- Add time to reference time
-    date_time = add_date_time( time_since_reference, internal_reference_date_time )
+
+    IF ( time_is_fixed )  THEN
+!
+!--    If time shall not change, set new time to reference time
+       date_time = internal_reference_date_time
+    ELSE
+!
+!--    Add time to reference time
+       date_time = add_date_time( time_since_reference, internal_reference_date_time )
+!
+!--    If date shall be fixed, revert it to the reference date if changed
+       IF ( date_is_fixed )  THEN
+          IF ( date_time%year /= internal_reference_date_time%year  .OR.                          &
+               get_day_of_year( date_time ) /= get_day_of_year( internal_reference_date_time ) )  &
+          THEN
+
+             date_time%year           = internal_reference_date_time%year
+             date_time%month          = internal_reference_date_time%month
+             date_time%day            = internal_reference_date_time%day
+
+             date_time = update_leapyear_setting( date_time )
+
+             date_time%second_of_year = get_second_of_year( date_time )
+
+          ENDIF
+       ENDIF
+    ENDIF
 !
 !-- Set requested return values
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 4679)
+++ /palm/trunk/SOURCE/parin.f90	(revision 4680)
@@ -20,73 +20,76 @@
 ! Current revisions:
 ! -----------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Add option to fix date or time of the simulation
+!
+! 4565 2020-06-15 08:30:38Z oliver.maas
 ! added pt_surface_heating_rate
-! 
+!
 ! 4564 2020-06-12 14:03:36Z raasch
 ! Vertical nesting method of Huq et al. (2019) removed
-! 
+!
 ! 4536 2020-05-17 17:24:13Z raasch
 ! bugfix for restart data format query
-! 
+!
 ! 4505 2020-04-20 15:37:15Z schwenkel
 ! Add flag for saturation check
-! 
+!
 ! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
-! 
+!
 ! 4360 2020-01-07 11:25:50Z suehring
 ! removed recycling_yshift
-! 
+!
 ! 4227 2019-09-10 18:04:34Z gronemeier
 ! implement new palm_date_time_mod
-! 
+!
 ! 4146 2019-08-07 07:47:36Z gronemeier
 ! added rotation_angle to initialization_parameters
-! 
+!
 ! 4191 2019-08-27 15:45:07Z gronemeier
 ! bugfix: add recycling_method_for_thermodynamic_quantities to inipar namelist
-! 
+!
 ! 4183 2019-08-23 07:33:16Z oliver.maas
 ! replaced recycle_absolute_quantities by recycling_method_for_thermodynamic_quantities
-! 
+!
 ! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
-! 
+!
 ! 4176 2019-08-20 14:10:41Z oliver.maas
 ! added recycle_absolute_quantities to initialization_parameters namelist
-! 
+!
 ! 4173 2019-08-20 12:04:06Z gronemeier
 ! add vdi_internal_controls
-! 
+!
 ! 4131 2019-08-02 11:06:18Z monakurppa
 ! Allocate hom and hom_sum to allow profile output for salsa variables.
-! 
+!
 ! 4079 2019-07-09 18:04:41Z suehring
 ! +monotonic_limiter_z
-! 
+!
 ! 4022 2019-06-12 11:52:39Z suehring
 ! Change default top boundary condition for pressure to Neumann in offline
 ! nesting case
-! 
+!
 ! 4017 2019-06-06 12:16:46Z schwenkel
 ! Introduce alternative switch for debug output during timestepping
-! 
+!
 ! 3885 2019-04-11 11:29:34Z kanani
-! Changes related to global restructuring of location messages and introduction 
+! Changes related to global restructuring of location messages and introduction
 ! of additional debug messages
-! 
+!
 ! 3806 2019-03-21 12:45:50Z raasch
 ! additional check for lateral boundary conditions added
-! 
+!
 ! 3747 2019-02-16 15:15:23Z gronemeier
 ! removed setting of parameter region
-! 
+!
 ! 3746 2019-02-16 12:41:27Z gronemeier
 ! Removed most_method
-! 
+!
 ! 3649 2019-01-02 16:52:21Z suehring
 ! Delete debug-print statements
@@ -103,5 +106,5 @@
 !------------------------------------------------------------------------------!
  SUBROUTINE parin
- 
+
 
     USE arrays_3d,                                                             &
@@ -156,5 +159,5 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file 
+    CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
 
     INTEGER(iwp) ::  global_id      !< process id with respect to MPI_COMM_WORLD
@@ -224,4 +227,5 @@
              turbulent_inflow, turbulent_outflow,                              &
              use_subsidence_tendencies, ug_surface, ug_vertical_gradient,      &
+             use_fixed_date, use_fixed_time,                                   &
              use_free_convection_scaling,                                      &
              ug_vertical_gradient_level, use_surface_fluxes, use_cmax,         &
@@ -298,4 +302,5 @@
              ug_vertical_gradient_level, use_surface_fluxes, use_cmax,         &
              use_top_fluxes, use_ug_for_galilei_tr, use_upstream_for_tke,      &
+             use_fixed_date, use_fixed_time,                                   &
              use_free_convection_scaling,                                      &
              uv_heights, u_bulk, u_profile, vdi_checks,                        &
@@ -304,5 +309,5 @@
              wall_adjustment, wall_heatflux, wall_humidityflux,                &
              wall_scalarflux, y_shift, zeta_max, zeta_min, z0h_factor
-             
+
     NAMELIST /d3par/  averaging_interval, averaging_interval_pr,               &
              cpu_log_barrierwait, create_disturbances,                         &
@@ -418,5 +423,5 @@
     io_blocks = global_procs / maximum_parallel_io_streams
     io_group  = MOD( global_id+1, io_blocks )
-    
+
     CALL location_message( 'reading NAMELIST parameters from PARIN', 'start' )
 !
@@ -434,5 +439,5 @@
           READ ( 11, initialization_parameters, ERR=10, END=11 )
           GOTO 14
-          
+
  10       BACKSPACE( 11 )
           READ( 11 , '(A)') line
@@ -441,12 +446,12 @@
  11       REWIND ( 11 )
           READ ( 11, inipar, ERR=12, END=13 )
- 
+
           message_string = 'namelist inipar is deprecated and will be ' //    &
                           'removed in near future. & Please use namelist ' // &
                           'initialization_parameters instead'
           CALL message( 'parin', 'PA0017', 0, 1, 0, 6, 0 )
- 
+
           GOTO 14
- 
+
  12       BACKSPACE( 11 )
           READ( 11 , '(A)') line
@@ -458,6 +463,6 @@
 !
 !--       Try to read runtime parameters given by the user for this run
-!--       (namelist "runtime_parameters"). The namelist "runtime_parmeters"    
-!--       can be omitted. In that case default values are used for the         
+!--       (namelist "runtime_parameters"). The namelist "runtime_parmeters"
+!--       can be omitted. In that case default values are used for the
 !--       parameters.
  14       line = ' '
@@ -533,5 +538,5 @@
 !--          In case of a restart run, the number of user-defined profiles on
 !--          the restart file (already stored in max_pr_user) has to match the
-!--          one given for the current run. max_pr_user_tmp is calculated in 
+!--          one given for the current run. max_pr_user_tmp is calculated in
 !--          user_parin and max_pr_user is read in via rrd_global.
              IF ( max_pr_user /= max_pr_user_tmp )  THEN
@@ -566,5 +571,5 @@
 
 !
-!--       In case of nested runs, explicitly set nesting boundary conditions. 
+!--       In case of nested runs, explicitly set nesting boundary conditions.
 !--       This will overwrite the user settings and basic defaults.
 !--       bc_lr and bc_ns always need to be cyclic for vertical nesting.
@@ -584,10 +589,10 @@
                    bc_s_t   = 'nested'
                    bc_cs_t  = 'nested'
-                   bc_p_t   = 'neumann'  
+                   bc_p_t   = 'neumann'
                 ENDIF
 !
-!--          For other nesting modes only set boundary conditions for 
+!--          For other nesting modes only set boundary conditions for
 !--          nested domains.
-             ELSE 
+             ELSE
                 IF ( child_domain )  THEN
                    bc_lr    = 'nested'
@@ -616,10 +621,10 @@
           ENDIF
 
-!         
+!
 !--       In case of nested runs, make sure that initializing_actions =
-!--       'set_constant_profiles' even though the constant-profiles 
-!--       initializations for the prognostic variables will be overwritten 
-!--       by pmci_child_initialize and pmci_parent_initialize. This is, 
-!--       however, important e.g. to make sure that diagnostic variables 
+!--       'set_constant_profiles' even though the constant-profiles
+!--       initializations for the prognostic variables will be overwritten
+!--       by pmci_child_initialize and pmci_parent_initialize. This is,
+!--       however, important e.g. to make sure that diagnostic variables
 !--       are set properly. An exception is made in case of restart runs and
 !--       if user decides to do everything by its own.
@@ -631,9 +636,9 @@
                               TRIM( initializing_actions ) // ' has been ' //  &
                               'changed to set_constant_profiles in child ' //  &
-                              'domain.' 
+                              'domain.'
              CALL message( 'parin', 'PA0492', 0, 0, 0, 6, 0 )
 
              initializing_actions = 'set_constant_profiles'
-          ENDIF            
+          ENDIF
 !
 !--       Check validity of lateral boundary conditions. This has to be done
