source: palm/trunk/SOURCE/local_stop.f90 @ 1353

Last change on this file since 1353 was 1353, checked in by heinze, 7 years ago

REAL constants provided with KIND-attribute

  • Property svn:keywords set to Id
File size: 5.0 KB
RevLine 
[1]1 SUBROUTINE local_stop
2
[1036]3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
[1310]17! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]18!--------------------------------------------------------------------------------!
19!
[484]20! Current revisions:
[1]21! -----------------
[1353]22! REAL constants provided with KIND-attribute
[1]23!
24! Former revisions:
25! -----------------
[3]26! $Id: local_stop.f90 1353 2014-04-08 15:21:23Z heinze $
[110]27!
[1321]28! 1320 2014-03-20 08:40:49Z raasch
29! ONLY-attribute added to USE-statements,
30! revision history before 2012 removed
31!
[1037]32! 1036 2012-10-22 13:43:42Z raasch
33! code put under GPL (PALM 3.9)
34!
[810]35! 809 2012-01-30 13:32:58Z maronga
36! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
37!
[808]38! 807 2012-01-25 11:53:51Z maronga
39! New cpp directive "__check" implemented which is used by check_namelist_files
40!
[1]41! Revision 1.1  2002/12/19 15:46:23  raasch
42! Initial revision
43!
44!
45! Description:
46! ------------
47! Stop program execution
[3]48!------------------------------------------------------------------------------!
[1]49
50    USE pegrid
[1320]51   
52    USE control_parameters,                                                    &
53        ONLY:  abort_mode, coupling_mode, coupling_mode_remote, dt_restart,    &
54               stop_dt, terminate_coupled, terminate_coupled_remote,           &
55               terminate_run, time_restart
[1]56
[206]57
[809]58#if defined( __parallel ) && ! defined ( __check )
[108]59    IF ( coupling_mode == 'uncoupled' )  THEN
[213]60       IF ( abort_mode == 1 )  THEN
61          CALL MPI_FINALIZE( ierr )
62          STOP
63       ELSEIF ( abort_mode == 2 )  THEN
64          CALL MPI_ABORT( comm2d, 9999, ierr )
65       ENDIF
[108]66    ELSE
[1]67
[108]68       SELECT CASE ( terminate_coupled_remote )
69
70          CASE ( 0 )
71             IF ( myid == 0 )  THEN
72                PRINT*, '+++ local_stop:'
73                PRINT*, '    local model "', TRIM( coupling_mode ), &
74                     '" stops now'
75             ENDIF
76!
77!--          Inform the remote model of the termination and its reason, provided
78!--          the remote model has not already been informed of another
79!--          termination reason (terminate_coupled > 0) before.
80             IF ( terminate_coupled == 0 )  THEN
81                terminate_coupled = 1
[667]82                IF ( myid == 0 ) THEN
83                   CALL MPI_SENDRECV( &
84                        terminate_coupled,        1, MPI_INTEGER, target_id,  0, &
85                        terminate_coupled_remote, 1, MPI_INTEGER, target_id,  0, &
86                        comm_inter, status, ierr )
87                ENDIF
88                CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_REAL, 0, comm2d, ierr)
[108]89             ENDIF
90             CALL MPI_FINALIZE( ierr )
[147]91             STOP
[108]92
93          CASE ( 1 )
94             IF ( myid == 0 )  THEN
95                PRINT*, '+++ local_stop:'
96                PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
97                     '" stopped'
98             ENDIF
99             CALL MPI_FINALIZE( ierr )
[147]100             STOP
[108]101
102          CASE ( 2 )
103             IF ( myid == 0 )  THEN
104                PRINT*, '+++ local_stop:'
105                PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
106                     '" terminated'
107                PRINT*, '    with stop_dt = .T.'
108             ENDIF
109             stop_dt = .TRUE.
110
111          CASE ( 3 )
112             IF ( myid == 0 )  THEN
113                PRINT*, '+++ local_stop:'
114                PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
115                     '" terminated'
116                PRINT*, '    with terminate_run = .T. (CPU-time limit)'
117             ENDIF
118             terminate_run = .TRUE.
119
120          CASE ( 4 )
121             IF ( myid == 0 )  THEN
122                PRINT*, '+++ local_stop:'
123                PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
124                     '" terminated'
125                PRINT*, '    with terminate_run = .T. (restart)'
126             ENDIF
127             terminate_run = .TRUE.
128             time_restart = time_restart + dt_restart
129
130          CASE ( 5 )
131             IF ( myid == 0 )  THEN
132                PRINT*, '+++ local_stop:'
133                PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
134                     '" terminated'
135                PRINT*, '    with terminate_run = .T. (single restart)'
136             ENDIF
137             terminate_run = .TRUE.
[1353]138             time_restart = 9999999.9_wp
[108]139
140       END SELECT
141
142    ENDIF
143
144#else
145
[1]146    STOP
147
[108]148#endif
149
[1]150 END SUBROUTINE local_stop   
Note: See TracBrowser for help on using the repository browser.