source: palm/trunk/SOURCE/palm.f90 @ 357

Last change on this file since 357 was 234, checked in by raasch, 16 years ago

updating version number and rc-file

  • Property svn:keywords set to Id
File size: 6.1 KB
RevLine 
[1]1 PROGRAM palm
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
[226]6!
[77]7!
8! Former revisions:
9! -----------------
10! $Id: palm.f90 234 2009-02-10 05:48:39Z heinze $
11!
[226]12! 215 2008-11-18 09:54:31Z raasch
13! Initialization of coupled runs modified for MPI-1 and moved to external
14! subroutine init_coupling
15!
[198]16! 197 2008-09-16 15:29:03Z raasch
17! Workaround for getting information about the coupling mode
18!
[110]19! 108 2007-08-24 15:10:38Z letzel
20! Get coupling mode from environment variable, change location of debug output
21!
[77]22! 75 2007-03-22 09:54:05Z raasch
[70]23! __vtk directives removed, write_particles is called only in case of particle
[75]24! advection switched on, open unit 9 for debug output,
25! setting of palm version moved from modules to here
[1]26!
[3]27! RCS Log replace by Id keyword, revision history cleaned up
28!
[1]29! Revision 1.10  2006/08/04 14:53:12  raasch
30! Distibution of run description header removed, call of header moved behind
31! init_3d_model
32!
33! Revision 1.2  2001/01/25 07:15:06  raasch
34! Program name changed to PALM, module test_variables removed.
35! Initialization of dvrp logging as well as exit of dvrp moved to new
36! subroutines init_dvrp_logging and close_dvrp (file init_dvrp.f90)
37!
38! Revision 1.1  1997/07/24 11:23:35  raasch
39! Initial revision
40!
41!
42! Description:
43! ------------
44! Large-Eddy Simulation (LES) model for the convective boundary layer,
45! optimized for use on parallel machines (implementation realized using the
46! Message Passing Interface (MPI)). The model can also be run on vector machines
47! (less well optimized) and workstations. Versions for the different types of
48! machines are controlled via cpp-directives.
49! Model runs are only feasible using the ksh-script mrun.
50!------------------------------------------------------------------------------!
51
52
53    USE arrays_3d
54    USE constants
[102]55    USE control_parameters
[1]56    USE cpulog
57    USE dvrp_variables
58    USE grid_variables
59    USE indices
60    USE interfaces
61    USE model_1d
62    USE particle_attributes
63    USE pegrid
64    USE spectrum
65    USE statistics
66
67    IMPLICIT NONE
68
69!
70!-- Local variables
71    CHARACTER (LEN=9) ::  time_to_string
72    CHARACTER (LEN=1) ::  cdum
73    INTEGER           ::  i, run_description_header_i(80)
74
[234]75    version = 'PALM 3.6'
[75]76
[1]77#if defined( __parallel )
78!
79!-- MPI initialisation. comm2d is preliminary set, because
80!-- it will be defined in init_pegrid but is used before in cpu_log.
81    CALL MPI_INIT( ierr )
82    CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
[206]83    CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
[1]84    comm_palm = MPI_COMM_WORLD
85    comm2d    = MPI_COMM_WORLD
86
87!
[206]88!-- Initialize PE topology in case of coupled runs
89    CALL init_coupling
[102]90#endif
91
92!
[1]93!-- Initialize measuring of the CPU-time remaining to the run
94    CALL local_tremain_ini
95
96!
97!-- Start of total CPU time measuring.
98    CALL cpu_log( log_point(1), 'total', 'start' )
99    CALL cpu_log( log_point(2), 'initialisation', 'start' )
100
101!
[206]102!-- Open a file for debug output
103    WRITE (myid_char,'(''_'',I4.4)')  myid
104    OPEN( 9, FILE='DEBUG'//TRIM( coupling_char )//myid_char, FORM='FORMATTED' )
105
106!
[1]107!-- Initialize dvrp logging. Also, one PE maybe split from the global
108!-- communicator for doing the dvrp output. In that case, the number of
109!-- PEs available for PALM is reduced by one and communicator comm_palm
110!-- is changed respectively.
111#if defined( __parallel )
112    CALL MPI_COMM_RANK( comm_palm, myid, ierr )
113!
[102]114!-- TEST OUTPUT (TO BE REMOVED)
115    WRITE(9,*) '*** coupling_mode = "', TRIM( coupling_mode ), '"'
116    CALL LOCAL_FLUSH( 9 )
[215]117    IF ( TRIM( coupling_mode ) /= 'uncoupled' )  THEN
118       PRINT*, '*** PE', myid, ' Global target PE:', target_id, &
119               TRIM( coupling_mode )
120    ENDIF
[102]121#endif
122
[108]123    CALL init_dvrp_logging
124
[102]125!
[108]126!-- Read control parameters from NAMELIST files and read environment-variables
127    CALL parin
128
129!
130!-- Determine processor topology and local array indices
131    CALL init_pegrid
132
133!
[1]134!-- Generate grid parameters
135    CALL init_grid
136
137!
138!-- Check control parameters and deduce further quantities
139    CALL check_parameters
140
141!
142!-- Initialize all necessary variables
143    CALL init_3d_model
144
145!
146!-- Output of program header
147    IF ( myid == 0 )  CALL header
148
149    CALL cpu_log( log_point(2), 'initialisation', 'stop' )
150
151!
152!-- Set start time in format hh:mm:ss
153    simulated_time_chr = time_to_string( simulated_time )
154
155!
156!-- If required, output of initial arrays
157    IF ( do2d_at_begin )  THEN
158       CALL data_output_2d( 'xy', 0 )
159       CALL data_output_2d( 'xz', 0 )
160       CALL data_output_2d( 'yz', 0 )
161    ENDIF
162    IF ( do3d_at_begin )  THEN
163       CALL data_output_3d( 0 )
164    ENDIF
165
166!
167!-- Integration of the model equations using the leap-frog scheme
168    CALL time_integration
169
170!
171!-- If required, write binary data for model continuation runs
172    IF ( write_binary(1:4) == 'true' )  CALL write_3d_binary
173
174!
175!-- If required, write binary particle data
[70]176    IF ( particle_advection )  CALL write_particles
[1]177
178!
179!-- If required, repeat output of header including the required CPU-time
180    IF ( myid == 0 )  CALL header
181
182!
183!-- If required, final user-defined actions, and
184!-- last actions on the open files and close files. Unit 14 was opened
185!-- in write_3d_binary but it is closed here, to allow writing on this
186!-- unit in routine user_last_actions.
187    CALL cpu_log( log_point(4), 'last actions', 'start' )
188    CALL user_last_actions
189    IF ( write_binary(1:4) == 'true' )  CALL close_file( 14 )
190    CALL close_file( 0 )
191    CALL close_dvrp
192    CALL cpu_log( log_point(4), 'last actions', 'stop' )
193
[102]194#if defined( __mpi2 )
[1]195!
[206]196!-- Test exchange via intercommunicator in case of a MPI-2 coupling
[102]197    IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
198       i = 12345 + myid
199       CALL MPI_SEND( i, 1, MPI_INTEGER, myid, 11, comm_inter, ierr )
200    ELSEIF ( coupling_mode == 'ocean_to_atmosphere' )  THEN
201       CALL MPI_RECV( i, 1, MPI_INTEGER, myid, 11, comm_inter, status, ierr )
202       PRINT*, '### myid: ', myid, '   received from atmosphere:  i = ', i
203    ENDIF
204#endif
205
206!
[1]207!-- Take final CPU-time for CPU-time analysis
208    CALL cpu_log( log_point(1), 'total', 'stop' )
209    CALL cpu_statistics
210
211#if defined( __parallel )
212    CALL MPI_FINALIZE( ierr )
213#endif
214
215 END PROGRAM palm
Note: See TracBrowser for help on using the repository browser.