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

Last change on this file since 74 was 70, checked in by raasch, 18 years ago

bugs fixed for particle code and bc-scheme

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