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