#if defined( __vtk ) SUBROUTINE palm #else PROGRAM palm #endif !------------------------------------------------------------------------------! ! Actual revisions: ! ----------------- ! TEST: open(9) ! ! Former revisions: ! ----------------- ! $Id: palm.f90 4 2007-02-13 11:33:16Z knoop $ ! RCS Log replace by Id keyword, revision history cleaned up ! ! Revision 1.10 2006/08/04 14:53:12 raasch ! Distibution of run description header removed, call of header moved behind ! init_3d_model ! ! Revision 1.2 2001/01/25 07:15:06 raasch ! Program name changed to PALM, module test_variables removed. ! Initialization of dvrp logging as well as exit of dvrp moved to new ! subroutines init_dvrp_logging and close_dvrp (file init_dvrp.f90) ! ! Revision 1.1 1997/07/24 11:23:35 raasch ! Initial revision ! ! ! Description: ! ------------ ! Large-Eddy Simulation (LES) model for the convective boundary layer, ! optimized for use on parallel machines (implementation realized using the ! Message Passing Interface (MPI)). The model can also be run on vector machines ! (less well optimized) and workstations. Versions for the different types of ! machines are controlled via cpp-directives. ! Model runs are only feasible using the ksh-script mrun. !------------------------------------------------------------------------------! USE arrays_3d USE constants USE cpulog USE dvrp_variables USE grid_variables USE indices USE interfaces USE model_1d USE particle_attributes USE pegrid USE spectrum USE statistics USE control_parameters IMPLICIT NONE ! !-- Local variables CHARACTER (LEN=9) :: time_to_string CHARACTER (LEN=1) :: cdum INTEGER :: i, run_description_header_i(80) #if defined( __parallel ) ! !-- MPI initialisation. comm2d is preliminary set, because !-- it will be defined in init_pegrid but is used before in cpu_log. CALL MPI_INIT( ierr ) CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr ) comm_palm = MPI_COMM_WORLD comm2d = MPI_COMM_WORLD #endif ! !-- Initialize measuring of the CPU-time remaining to the run CALL local_tremain_ini ! !-- Start of total CPU time measuring. CALL cpu_log( log_point(1), 'total', 'start' ) CALL cpu_log( log_point(2), 'initialisation', 'start' ) ! !-- Initialize dvrp logging. Also, one PE maybe split from the global !-- communicator for doing the dvrp output. In that case, the number of !-- PEs available for PALM is reduced by one and communicator comm_palm !-- is changed respectively. #if defined( __parallel ) CALL MPI_COMM_RANK( comm_palm, myid, ierr ) #endif CALL init_dvrp_logging ! !-- Read control parameters from NAMELIST files and read environment-variables CALL parin ! !-- Determine processor topology and local array indices CALL init_pegrid ! !-- Generate grid parameters CALL init_grid ! !-- Check control parameters and deduce further quantities CALL check_parameters OPEN( 9, FILE='DEBUG'//myid_char, FORM='FORMATTED' ) ! !-- Initialize all necessary variables CALL init_3d_model ! !-- Output of program header IF ( myid == 0 ) CALL header CALL cpu_log( log_point(2), 'initialisation', 'stop' ) ! !-- Set start time in format hh:mm:ss simulated_time_chr = time_to_string( simulated_time ) ! !-- If required, output of initial arrays IF ( do2d_at_begin ) THEN CALL data_output_2d( 'xy', 0 ) CALL data_output_2d( 'xz', 0 ) CALL data_output_2d( 'yz', 0 ) ENDIF IF ( do3d_at_begin ) THEN CALL data_output_3d( 0 ) ENDIF ! !-- Integration of the model equations using the leap-frog scheme CALL time_integration ! !-- If required, write binary data for model continuation runs IF ( write_binary(1:4) == 'true' ) CALL write_3d_binary ! !-- If required, write binary particle data CALL write_particles ! !-- If required, repeat output of header including the required CPU-time IF ( myid == 0 ) CALL header ! !-- If required, final user-defined actions, and !-- last actions on the open files and close files. Unit 14 was opened !-- in write_3d_binary but it is closed here, to allow writing on this !-- unit in routine user_last_actions. CALL cpu_log( log_point(4), 'last actions', 'start' ) CALL user_last_actions IF ( write_binary(1:4) == 'true' ) CALL close_file( 14 ) CALL close_file( 0 ) CALL close_dvrp CALL cpu_log( log_point(4), 'last actions', 'stop' ) ! !-- Take final CPU-time for CPU-time analysis CALL cpu_log( log_point(1), 'total', 'stop' ) CALL cpu_statistics #if defined( __parallel ) CALL MPI_FINALIZE( ierr ) #endif #if defined( __vtk ) END SUBROUTINE palm #else END PROGRAM palm #endif