Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_EndFlowSolver.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: shut down Rocflo-MP.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = all grid regions.
30 !
31 ! Output: none.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_EndFlowSolver.F90,v 1.3 2008/12/06 08:44:26 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_endflowsolver( regions )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
48  USE moderror
49  USE modmpi
50  USE modparameters
51  IMPLICIT NONE
52 
53 ! ... parameters
54  TYPE (t_region), POINTER :: regions(:)
55 
56 ! ... loop variables
57  INTEGER :: iprobe
58 
59 ! ... local variables
60  INTEGER :: errorflag
61 
62  TYPE(t_global), POINTER :: global
63 
64 !******************************************************************************
65 
66  global => regions(1)%global
67 
68  CALL registerfunction( global,'RFLO_EndFlowSolver',&
69  'RFLO_EndFlowSolver.F90' )
70 
71 ! close convergence, probe & thrust file --------------------------------------
72 
73  IF (global%myProcid == masterproc) THEN
74  CLOSE(if_conver,iostat=errorflag)
75  global%error = errorflag
76  IF (global%error /= 0) CALL errorstop( global,err_file_close,__line__ )
77  IF (global%thrustType /= thrust_none) THEN
78  CLOSE(if_thrust,iostat=errorflag)
79  global%error = errorflag
80  IF (global%error /= 0) CALL errorstop( global,err_file_close,__line__ )
81  ENDIF
82  ENDIF
83 
84  IF (global%nProbes > 0) THEN
85  DO iprobe=1,global%nProbes
86  IF (regions(global%probePos(iprobe,1))%procid==global%myProcid .AND. &
87  regions(global%probePos(iprobe,1))%active==active) THEN
88  CLOSE(if_probe+iprobe-1,iostat=errorflag)
89  global%error = errorflag
90  IF (global%error /= 0) CALL errorstop( global,err_file_close,__line__ )
91  ENDIF
92  ENDDO
93  ENDIF
94 
95  IF (global%myProcid==masterproc .AND. global%verbLevel/=verbose_none) &
96  WRITE(stdout,'(/,A,/)') solver_name//' Program finished.'
97 
98 ! finish MPI ------------------------------------------------------------------
99 
100 #ifndef GENX
101 #ifdef MPI
102  CALL mpi_barrier( global%mpiComm,global%mpierr )
103  CALL mpi_finalize( global%mpierr )
104  IF (global%mpierr /=0 ) CALL errorstop( global,err_mpi_trouble,__line__ )
105 #endif
106 #endif
107 
108  CALL deregisterfunction( global )
109 
110 END SUBROUTINE rflo_endflowsolver
111 
112 !******************************************************************************
113 !
114 ! RCS Revision history:
115 !
116 ! $Log: RFLO_EndFlowSolver.F90,v $
117 ! Revision 1.3 2008/12/06 08:44:26 mtcampbe
118 ! Updated license.
119 !
120 ! Revision 1.2 2008/11/19 22:17:37 mtcampbe
121 ! Added Illinois Open Source License/Copyright
122 !
123 ! Revision 1.1 2004/11/29 20:51:39 wasistho
124 ! lower to upper case
125 !
126 ! Revision 1.9 2003/06/02 17:12:00 jblazek
127 ! Added computation of thrust.
128 !
129 ! Revision 1.8 2003/05/15 02:57:03 jblazek
130 ! Inlined index function.
131 !
132 ! Revision 1.7 2002/10/25 18:36:47 jblazek
133 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
134 !
135 ! Revision 1.6 2002/09/25 17:57:09 jblazek
136 ! Added call to EndFlowSolver from genx/fluid_finalize.
137 !
138 ! Revision 1.5 2002/09/20 22:22:36 jblazek
139 ! Finalized integration into GenX.
140 !
141 ! Revision 1.4 2002/09/05 17:40:21 jblazek
142 ! Variable global moved into regions().
143 !
144 ! Revision 1.3 2002/07/16 21:34:37 jblazek
145 ! Prefixed screen output with SOLVER_NAME.
146 !
147 ! Revision 1.2 2002/03/18 23:11:33 jblazek
148 ! Finished multiblock and MPI.
149 !
150 ! Revision 1.1 2002/02/25 22:36:52 jblazek
151 ! Simplified solver initialization routine.
152 !
153 !******************************************************************************
154 
155 
156 
157 
158 
159 
160 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_endflowsolver(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469