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

Last change on this file since 24 was 4, checked in by raasch, 18 years ago

Id keyword set as property for all *.f90 files

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1#if defined( __vtk )
2 SUBROUTINE palm
3#else
4 PROGRAM palm
5#endif
6
7!------------------------------------------------------------------------------!
8! Actual revisions:
9! -----------------
10! TEST: open(9)
11!
12! Former revisions:
13! -----------------
14! $Id: palm.f90 4 2007-02-13 11:33:16Z raasch $
15! RCS Log replace by Id keyword, revision history cleaned up
16!
17! Revision 1.10  2006/08/04 14:53:12  raasch
18! Distibution of run description header removed, call of header moved behind
19! init_3d_model
20!
21! Revision 1.2  2001/01/25 07:15:06  raasch
22! Program name changed to PALM, module test_variables removed.
23! Initialization of dvrp logging as well as exit of dvrp moved to new
24! subroutines init_dvrp_logging and close_dvrp (file init_dvrp.f90)
25!
26! Revision 1.1  1997/07/24 11:23:35  raasch
27! Initial revision
28!
29!
30! Description:
31! ------------
32! Large-Eddy Simulation (LES) model for the convective boundary layer,
33! optimized for use on parallel machines (implementation realized using the
34! Message Passing Interface (MPI)). The model can also be run on vector machines
35! (less well optimized) and workstations. Versions for the different types of
36! machines are controlled via cpp-directives.
37! Model runs are only feasible using the ksh-script mrun.
38!------------------------------------------------------------------------------!
39
40
41    USE arrays_3d
42    USE constants
43    USE cpulog
44    USE dvrp_variables
45    USE grid_variables
46    USE indices
47    USE interfaces
48    USE model_1d
49    USE particle_attributes
50    USE pegrid
51    USE spectrum
52    USE statistics
53    USE control_parameters
54
55    IMPLICIT NONE
56
57!
58!-- Local variables
59    CHARACTER (LEN=9) ::  time_to_string
60    CHARACTER (LEN=1) ::  cdum
61    INTEGER           ::  i, run_description_header_i(80)
62
63#if defined( __parallel )
64!
65!-- MPI initialisation. comm2d is preliminary set, because
66!-- it will be defined in init_pegrid but is used before in cpu_log.
67    CALL MPI_INIT( ierr )
68    CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
69    comm_palm = MPI_COMM_WORLD
70    comm2d    = MPI_COMM_WORLD
71#endif
72
73!
74!-- Initialize measuring of the CPU-time remaining to the run
75    CALL local_tremain_ini
76
77!
78!-- Start of total CPU time measuring.
79    CALL cpu_log( log_point(1), 'total', 'start' )
80    CALL cpu_log( log_point(2), 'initialisation', 'start' )
81
82!
83!-- Initialize dvrp logging. Also, one PE maybe split from the global
84!-- communicator for doing the dvrp output. In that case, the number of
85!-- PEs available for PALM is reduced by one and communicator comm_palm
86!-- is changed respectively.
87#if defined( __parallel )
88    CALL MPI_COMM_RANK( comm_palm, myid, ierr )
89#endif
90    CALL init_dvrp_logging
91
92!
93!-- Read control parameters from NAMELIST files and read environment-variables
94    CALL parin
95
96!
97!-- Determine processor topology and local array indices
98    CALL init_pegrid
99
100!
101!-- Generate grid parameters
102    CALL init_grid
103
104!
105!-- Check control parameters and deduce further quantities
106    CALL check_parameters
107
108    OPEN( 9, FILE='DEBUG'//myid_char, FORM='FORMATTED' )
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    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#if defined( __vtk )
172 END SUBROUTINE palm
173#else
174 END PROGRAM palm
175#endif
176
177
Note: See TracBrowser for help on using the repository browser.